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 /* turn on/off EAPD control (only if available) */
1097 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1099 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1101 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1102 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1106 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1111 case ALC_INIT_GPIO1:
1112 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1114 case ALC_INIT_GPIO2:
1115 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1117 case ALC_INIT_GPIO3:
1118 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1120 case ALC_INIT_DEFAULT:
1121 switch (codec->vendor_id) {
1123 set_eapd(codec, 0x0f, 1);
1124 set_eapd(codec, 0x10, 1);
1137 set_eapd(codec, 0x14, 1);
1138 set_eapd(codec, 0x15, 1);
1141 switch (codec->vendor_id) {
1143 snd_hda_codec_write(codec, 0x1a, 0,
1144 AC_VERB_SET_COEF_INDEX, 7);
1145 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1146 AC_VERB_GET_PROC_COEF, 0);
1147 snd_hda_codec_write(codec, 0x1a, 0,
1148 AC_VERB_SET_COEF_INDEX, 7);
1149 snd_hda_codec_write(codec, 0x1a, 0,
1150 AC_VERB_SET_PROC_COEF,
1160 alc889_coef_init(codec);
1163 alc888_coef_init(codec);
1167 snd_hda_codec_write(codec, 0x20, 0,
1168 AC_VERB_SET_COEF_INDEX, 7);
1169 tmp = snd_hda_codec_read(codec, 0x20, 0,
1170 AC_VERB_GET_PROC_COEF, 0);
1171 snd_hda_codec_write(codec, 0x20, 0,
1172 AC_VERB_SET_COEF_INDEX, 7);
1173 snd_hda_codec_write(codec, 0x20, 0,
1174 AC_VERB_SET_PROC_COEF,
1182 static void alc_init_auto_hp(struct hda_codec *codec)
1184 struct alc_spec *spec = codec->spec;
1186 if (!spec->autocfg.hp_pins[0])
1189 if (!spec->autocfg.speaker_pins[0]) {
1190 if (spec->autocfg.line_out_pins[0] &&
1191 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1192 spec->autocfg.speaker_pins[0] =
1193 spec->autocfg.line_out_pins[0];
1198 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1199 spec->autocfg.hp_pins[0]);
1200 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1201 AC_VERB_SET_UNSOLICITED_ENABLE,
1202 AC_USRSP_EN | ALC880_HP_EVENT);
1203 spec->unsol_event = alc_sku_unsol_event;
1206 static void alc_init_auto_mic(struct hda_codec *codec)
1208 struct alc_spec *spec = codec->spec;
1209 struct auto_pin_cfg *cfg = &spec->autocfg;
1210 hda_nid_t fixed, ext;
1213 /* there must be only two mic inputs exclusively */
1214 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1215 if (cfg->input_pins[i])
1219 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1220 hda_nid_t nid = cfg->input_pins[i];
1221 unsigned int defcfg;
1224 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1225 switch (get_defcfg_connect(defcfg)) {
1226 case AC_JACK_PORT_FIXED:
1228 return; /* already occupied */
1231 case AC_JACK_PORT_COMPLEX:
1233 return; /* already occupied */
1237 return; /* invalid entry */
1242 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1243 return; /* no unsol support */
1244 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1246 spec->ext_mic.pin = ext;
1247 spec->int_mic.pin = fixed;
1248 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1249 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1251 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1252 AC_VERB_SET_UNSOLICITED_ENABLE,
1253 AC_USRSP_EN | ALC880_MIC_EVENT);
1254 spec->unsol_event = alc_sku_unsol_event;
1257 /* check subsystem ID and set up device-specific initialization;
1258 * return 1 if initialized, 0 if invalid SSID
1260 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1261 * 31 ~ 16 : Manufacture ID
1263 * 7 ~ 0 : Assembly ID
1264 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1266 static int alc_subsystem_id(struct hda_codec *codec,
1267 hda_nid_t porta, hda_nid_t porte,
1270 unsigned int ass, tmp, i;
1272 struct alc_spec *spec = codec->spec;
1274 ass = codec->subsystem_id & 0xffff;
1275 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1278 /* invalid SSID, check the special NID pin defcfg instead */
1280 * 31~30 : port connectivity
1283 * 19~16 : Check sum (15:1)
1288 if (codec->vendor_id == 0x10ec0260)
1290 ass = snd_hda_codec_get_pincfg(codec, nid);
1291 snd_printd("realtek: No valid SSID, "
1292 "checking pincfg 0x%08x for NID 0x%x\n",
1294 if (!(ass & 1) && !(ass & 0x100000))
1296 if ((ass >> 30) != 1) /* no physical connection */
1301 for (i = 1; i < 16; i++) {
1305 if (((ass >> 16) & 0xf) != tmp)
1308 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1309 ass & 0xffff, codec->vendor_id);
1313 * 2 : 0 --> Desktop, 1 --> Laptop
1314 * 3~5 : External Amplifier control
1317 tmp = (ass & 0x38) >> 3; /* external Amp control */
1320 spec->init_amp = ALC_INIT_GPIO1;
1323 spec->init_amp = ALC_INIT_GPIO2;
1326 spec->init_amp = ALC_INIT_GPIO3;
1329 spec->init_amp = ALC_INIT_DEFAULT;
1333 /* is laptop or Desktop and enable the function "Mute internal speaker
1334 * when the external headphone out jack is plugged"
1336 if (!(ass & 0x8000))
1339 * 10~8 : Jack location
1340 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1342 * 15 : 1 --> enable the function "Mute internal speaker
1343 * when the external headphone out jack is plugged"
1345 if (!spec->autocfg.hp_pins[0]) {
1347 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1356 for (i = 0; i < spec->autocfg.line_outs; i++)
1357 if (spec->autocfg.line_out_pins[i] == nid)
1359 spec->autocfg.hp_pins[0] = nid;
1362 alc_init_auto_hp(codec);
1363 alc_init_auto_mic(codec);
1367 static void alc_ssid_check(struct hda_codec *codec,
1368 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1370 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1371 struct alc_spec *spec = codec->spec;
1372 snd_printd("realtek: "
1373 "Enable default setup for auto mode as fallback\n");
1374 spec->init_amp = ALC_INIT_DEFAULT;
1375 alc_init_auto_hp(codec);
1376 alc_init_auto_mic(codec);
1381 * Fix-up pin default configurations and add default verbs
1390 const struct alc_pincfg *pins;
1391 const struct hda_verb *verbs;
1394 static void alc_pick_fixup(struct hda_codec *codec,
1395 const struct snd_pci_quirk *quirk,
1396 const struct alc_fixup *fix)
1398 const struct alc_pincfg *cfg;
1400 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1404 fix += quirk->value;
1407 for (; cfg->nid; cfg++)
1408 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1411 add_verb(codec->spec, fix->verbs);
1414 static int alc_read_coef_idx(struct hda_codec *codec,
1415 unsigned int coef_idx)
1418 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1420 val = snd_hda_codec_read(codec, 0x20, 0,
1421 AC_VERB_GET_PROC_COEF, 0);
1432 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1433 /* Mic-in jack as mic in */
1434 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1435 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1436 /* Line-in jack as Line in */
1437 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1438 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1439 /* Line-Out as Front */
1440 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1447 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1448 /* Mic-in jack as mic in */
1449 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1450 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1451 /* Line-in jack as Surround */
1452 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1453 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1454 /* Line-Out as Front */
1455 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1462 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1463 /* Mic-in jack as CLFE */
1464 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1465 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1466 /* Line-in jack as Surround */
1467 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1468 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1469 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1470 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1477 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1478 /* Mic-in jack as CLFE */
1479 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1480 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1481 /* Line-in jack as Surround */
1482 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1483 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1484 /* Line-Out as Side */
1485 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1489 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1490 { 2, alc888_4ST_ch2_intel_init },
1491 { 4, alc888_4ST_ch4_intel_init },
1492 { 6, alc888_4ST_ch6_intel_init },
1493 { 8, alc888_4ST_ch8_intel_init },
1497 * ALC888 Fujitsu Siemens Amillo xa3530
1500 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1501 /* Front Mic: set to PIN_IN (empty by default) */
1502 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1503 /* Connect Internal HP to Front */
1504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1506 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1507 /* Connect Bass HP to Front */
1508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1511 /* Connect Line-Out side jack (SPDIF) to Side */
1512 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1513 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1514 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1515 /* Connect Mic jack to CLFE */
1516 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1517 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1518 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1519 /* Connect Line-in jack to Surround */
1520 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1521 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1522 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1523 /* Connect HP out jack to Front */
1524 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1525 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1526 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1527 /* Enable unsolicited event for HP jack and Line-out jack */
1528 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1529 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1533 static void alc_automute_amp(struct hda_codec *codec)
1535 struct alc_spec *spec = codec->spec;
1540 spec->jack_present = 0;
1541 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1542 nid = spec->autocfg.hp_pins[i];
1545 if (snd_hda_jack_detect(codec, nid)) {
1546 spec->jack_present = 1;
1551 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1552 /* Toggle internal speakers muting */
1553 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1554 nid = spec->autocfg.speaker_pins[i];
1557 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1558 HDA_AMP_MUTE, mute);
1562 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1565 if (codec->vendor_id == 0x10ec0880)
1569 if (res == ALC880_HP_EVENT)
1570 alc_automute_amp(codec);
1573 static void alc889_automute_setup(struct hda_codec *codec)
1575 struct alc_spec *spec = codec->spec;
1577 spec->autocfg.hp_pins[0] = 0x15;
1578 spec->autocfg.speaker_pins[0] = 0x14;
1579 spec->autocfg.speaker_pins[1] = 0x16;
1580 spec->autocfg.speaker_pins[2] = 0x17;
1581 spec->autocfg.speaker_pins[3] = 0x19;
1582 spec->autocfg.speaker_pins[4] = 0x1a;
1585 static void alc889_intel_init_hook(struct hda_codec *codec)
1587 alc889_coef_init(codec);
1588 alc_automute_amp(codec);
1591 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1593 struct alc_spec *spec = codec->spec;
1595 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1596 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1597 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1598 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1602 * ALC888 Acer Aspire 4930G model
1605 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1606 /* Front Mic: set to PIN_IN (empty by default) */
1607 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1608 /* Unselect Front Mic by default in input mixer 3 */
1609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1610 /* Enable unsolicited event for HP jack */
1611 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1612 /* Connect Internal HP to front */
1613 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1614 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1615 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1616 /* Connect HP out to front */
1617 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1618 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1619 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1624 * ALC888 Acer Aspire 6530G model
1627 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1628 /* Bias voltage on for external mic port */
1629 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1630 /* Front Mic: set to PIN_IN (empty by default) */
1631 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1632 /* Unselect Front Mic by default in input mixer 3 */
1633 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1634 /* Enable unsolicited event for HP jack */
1635 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1636 /* Enable speaker output */
1637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1638 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1639 /* Enable headphone output */
1640 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1642 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1647 * ALC889 Acer Aspire 8930G model
1650 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1651 /* Front Mic: set to PIN_IN (empty by default) */
1652 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1653 /* Unselect Front Mic by default in input mixer 3 */
1654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1655 /* Enable unsolicited event for HP jack */
1656 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1657 /* Connect Internal Front to Front */
1658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1660 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1661 /* Connect Internal Rear to Rear */
1662 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1663 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1664 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1665 /* Connect Internal CLFE to CLFE */
1666 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1667 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1668 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1669 /* Connect HP out to Front */
1670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1671 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1672 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1673 /* Enable all DACs */
1674 /* DAC DISABLE/MUTE 1? */
1675 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1676 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1677 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1678 /* DAC DISABLE/MUTE 2? */
1679 /* some bit here disables the other DACs. Init=0x4900 */
1680 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1681 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1683 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1684 * which makes the stereo useless. However, either the mic or the ALC889
1685 * makes the signal become a difference/sum signal instead of standard
1686 * stereo, which is annoying. So instead we flip this bit which makes the
1687 * codec replicate the sum signal to both channels, turning it into a
1690 /* DMIC_CONTROL? Init value = 0x0001 */
1691 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1692 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1696 static struct hda_input_mux alc888_2_capture_sources[2] = {
1697 /* Front mic only available on one ADC */
1704 { "Front Mic", 0xb },
1717 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1718 /* Interal mic only available on one ADC */
1725 { "Input Mix", 0xa },
1735 { "Input Mix", 0xa },
1740 static struct hda_input_mux alc889_capture_sources[3] = {
1741 /* Digital mic only available on first "ADC" */
1748 { "Front Mic", 0xb },
1749 { "Input Mix", 0xa },
1758 { "Input Mix", 0xa },
1767 { "Input Mix", 0xa },
1772 static struct snd_kcontrol_new alc888_base_mixer[] = {
1773 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1774 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1776 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1777 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1779 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1780 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1781 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1782 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1783 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1784 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1785 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1786 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1787 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1789 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1794 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1795 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1796 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1797 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1798 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1799 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1801 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1802 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1803 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1813 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1815 struct alc_spec *spec = codec->spec;
1817 spec->autocfg.hp_pins[0] = 0x15;
1818 spec->autocfg.speaker_pins[0] = 0x14;
1819 spec->autocfg.speaker_pins[1] = 0x16;
1820 spec->autocfg.speaker_pins[2] = 0x17;
1823 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1825 struct alc_spec *spec = codec->spec;
1827 spec->autocfg.hp_pins[0] = 0x15;
1828 spec->autocfg.speaker_pins[0] = 0x14;
1829 spec->autocfg.speaker_pins[1] = 0x16;
1830 spec->autocfg.speaker_pins[2] = 0x17;
1833 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1835 struct alc_spec *spec = codec->spec;
1837 spec->autocfg.hp_pins[0] = 0x15;
1838 spec->autocfg.speaker_pins[0] = 0x14;
1839 spec->autocfg.speaker_pins[1] = 0x16;
1840 spec->autocfg.speaker_pins[2] = 0x1b;
1843 #ifdef CONFIG_SND_HDA_POWER_SAVE
1844 static void alc889_power_eapd(struct hda_codec *codec, int power)
1846 set_eapd(codec, 0x14, power);
1847 set_eapd(codec, 0x15, power);
1852 * ALC880 3-stack model
1854 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1855 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1856 * F-Mic = 0x1b, HP = 0x19
1859 static hda_nid_t alc880_dac_nids[4] = {
1860 /* front, rear, clfe, rear_surr */
1861 0x02, 0x05, 0x04, 0x03
1864 static hda_nid_t alc880_adc_nids[3] = {
1869 /* The datasheet says the node 0x07 is connected from inputs,
1870 * but it shows zero connection in the real implementation on some devices.
1871 * Note: this is a 915GAV bug, fixed on 915GLV
1873 static hda_nid_t alc880_adc_nids_alt[2] = {
1878 #define ALC880_DIGOUT_NID 0x06
1879 #define ALC880_DIGIN_NID 0x0a
1881 static struct hda_input_mux alc880_capture_source = {
1885 { "Front Mic", 0x3 },
1891 /* channel source setting (2/6 channel selection for 3-stack) */
1893 static struct hda_verb alc880_threestack_ch2_init[] = {
1894 /* set line-in to input, mute it */
1895 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1896 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1897 /* set mic-in to input vref 80%, mute it */
1898 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1899 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1904 static struct hda_verb alc880_threestack_ch6_init[] = {
1905 /* set line-in to output, unmute it */
1906 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1907 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1908 /* set mic-in to output, unmute it */
1909 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1910 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1914 static struct hda_channel_mode alc880_threestack_modes[2] = {
1915 { 2, alc880_threestack_ch2_init },
1916 { 6, alc880_threestack_ch6_init },
1919 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1920 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1921 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1922 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1923 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1924 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1925 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1926 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1927 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1928 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1929 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1930 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1931 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1932 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1933 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1934 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1935 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1936 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1938 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1939 .name = "Channel Mode",
1940 .info = alc_ch_mode_info,
1941 .get = alc_ch_mode_get,
1942 .put = alc_ch_mode_put,
1947 /* capture mixer elements */
1948 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1949 struct snd_ctl_elem_info *uinfo)
1951 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1952 struct alc_spec *spec = codec->spec;
1955 mutex_lock(&codec->control_mutex);
1956 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1958 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1959 mutex_unlock(&codec->control_mutex);
1963 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1964 unsigned int size, unsigned int __user *tlv)
1966 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1967 struct alc_spec *spec = codec->spec;
1970 mutex_lock(&codec->control_mutex);
1971 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1973 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1974 mutex_unlock(&codec->control_mutex);
1978 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1979 struct snd_ctl_elem_value *ucontrol);
1981 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1982 struct snd_ctl_elem_value *ucontrol,
1985 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1986 struct alc_spec *spec = codec->spec;
1987 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1990 mutex_lock(&codec->control_mutex);
1991 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1993 err = func(kcontrol, ucontrol);
1994 mutex_unlock(&codec->control_mutex);
1998 static int alc_cap_vol_get(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_get);
2005 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2006 struct snd_ctl_elem_value *ucontrol)
2008 return alc_cap_getput_caller(kcontrol, ucontrol,
2009 snd_hda_mixer_amp_volume_put);
2012 /* capture mixer elements */
2013 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2015 static int alc_cap_sw_get(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_get);
2022 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2023 struct snd_ctl_elem_value *ucontrol)
2025 return alc_cap_getput_caller(kcontrol, ucontrol,
2026 snd_hda_mixer_amp_switch_put);
2029 #define _DEFINE_CAPMIX(num) \
2031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2032 .name = "Capture Switch", \
2033 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2035 .info = alc_cap_sw_info, \
2036 .get = alc_cap_sw_get, \
2037 .put = alc_cap_sw_put, \
2040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2041 .name = "Capture Volume", \
2042 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2043 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2044 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2046 .info = alc_cap_vol_info, \
2047 .get = alc_cap_vol_get, \
2048 .put = alc_cap_vol_put, \
2049 .tlv = { .c = alc_cap_vol_tlv }, \
2052 #define _DEFINE_CAPSRC(num) \
2054 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2055 /* .name = "Capture Source", */ \
2056 .name = "Input Source", \
2058 .info = alc_mux_enum_info, \
2059 .get = alc_mux_enum_get, \
2060 .put = alc_mux_enum_put, \
2063 #define DEFINE_CAPMIX(num) \
2064 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2065 _DEFINE_CAPMIX(num), \
2066 _DEFINE_CAPSRC(num), \
2070 #define DEFINE_CAPMIX_NOSRC(num) \
2071 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2072 _DEFINE_CAPMIX(num), \
2076 /* up to three ADCs */
2080 DEFINE_CAPMIX_NOSRC(1);
2081 DEFINE_CAPMIX_NOSRC(2);
2082 DEFINE_CAPMIX_NOSRC(3);
2085 * ALC880 5-stack model
2087 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2089 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2090 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2093 /* additional mixers to alc880_three_stack_mixer */
2094 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2095 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2096 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2100 /* channel source setting (6/8 channel selection for 5-stack) */
2102 static struct hda_verb alc880_fivestack_ch6_init[] = {
2103 /* set line-in to input, mute it */
2104 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2105 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2110 static struct hda_verb alc880_fivestack_ch8_init[] = {
2111 /* set line-in to output, unmute it */
2112 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2113 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2117 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2118 { 6, alc880_fivestack_ch6_init },
2119 { 8, alc880_fivestack_ch8_init },
2124 * ALC880 6-stack model
2126 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2127 * Side = 0x05 (0x0f)
2128 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2129 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2132 static hda_nid_t alc880_6st_dac_nids[4] = {
2133 /* front, rear, clfe, rear_surr */
2134 0x02, 0x03, 0x04, 0x05
2137 static struct hda_input_mux alc880_6stack_capture_source = {
2141 { "Front Mic", 0x1 },
2147 /* fixed 8-channels */
2148 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2152 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2153 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2154 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2155 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2156 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2157 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2158 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2159 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2160 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2161 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2162 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2163 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2164 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2165 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2166 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2169 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2170 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2172 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2173 .name = "Channel Mode",
2174 .info = alc_ch_mode_info,
2175 .get = alc_ch_mode_get,
2176 .put = alc_ch_mode_put,
2185 * W810 has rear IO for:
2188 * Center/LFE (DAC 04)
2191 * The system also has a pair of internal speakers, and a headphone jack.
2192 * These are both connected to Line2 on the codec, hence to DAC 02.
2194 * There is a variable resistor to control the speaker or headphone
2195 * volume. This is a hardware-only device without a software API.
2197 * Plugging headphones in will disable the internal speakers. This is
2198 * implemented in hardware, not via the driver using jack sense. In
2199 * a similar fashion, plugging into the rear socket marked "front" will
2200 * disable both the speakers and headphones.
2202 * For input, there's a microphone jack, and an "audio in" jack.
2203 * These may not do anything useful with this driver yet, because I
2204 * haven't setup any initialization verbs for these yet...
2207 static hda_nid_t alc880_w810_dac_nids[3] = {
2208 /* front, rear/surround, clfe */
2212 /* fixed 6 channels */
2213 static struct hda_channel_mode alc880_w810_modes[1] = {
2217 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2218 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2219 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2220 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2221 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2222 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2223 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2224 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2225 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2226 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2235 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2236 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2240 static hda_nid_t alc880_z71v_dac_nids[1] = {
2243 #define ALC880_Z71V_HP_DAC 0x03
2245 /* fixed 2 channels */
2246 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2250 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2252 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2254 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2255 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2256 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2257 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2258 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2264 * ALC880 F1734 model
2266 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2267 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2270 static hda_nid_t alc880_f1734_dac_nids[1] = {
2273 #define ALC880_F1734_HP_DAC 0x02
2275 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2276 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2277 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2278 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2279 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2280 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2281 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2287 static struct hda_input_mux alc880_f1734_capture_source = {
2299 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2300 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2301 * Mic = 0x18, Line = 0x1a
2304 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2305 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2307 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2308 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2309 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2310 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2311 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2312 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2313 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2314 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2315 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2316 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2317 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2323 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2324 .name = "Channel Mode",
2325 .info = alc_ch_mode_info,
2326 .get = alc_ch_mode_get,
2327 .put = alc_ch_mode_put,
2333 * ALC880 ASUS W1V model
2335 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2336 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2337 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2340 /* additional mixers to alc880_asus_mixer */
2341 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2342 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2343 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2348 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2349 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2350 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2353 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2357 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2362 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2363 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2364 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2365 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2366 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2367 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2368 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2369 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2370 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2371 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2372 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2373 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2374 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2376 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2377 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2378 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2380 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2381 .name = "Channel Mode",
2382 .info = alc_ch_mode_info,
2383 .get = alc_ch_mode_get,
2384 .put = alc_ch_mode_put,
2389 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2390 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2391 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2392 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2393 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2394 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2395 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2396 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2397 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2398 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2399 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2403 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2404 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2405 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2406 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2407 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2408 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2409 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2414 * virtual master controls
2418 * slave controls for virtual master
2420 static const char *alc_slave_vols[] = {
2421 "Front Playback Volume",
2422 "Surround Playback Volume",
2423 "Center Playback Volume",
2424 "LFE Playback Volume",
2425 "Side Playback Volume",
2426 "Headphone Playback Volume",
2427 "Speaker Playback Volume",
2428 "Mono Playback Volume",
2429 "Line-Out Playback Volume",
2430 "PCM Playback Volume",
2434 static const char *alc_slave_sws[] = {
2435 "Front Playback Switch",
2436 "Surround Playback Switch",
2437 "Center Playback Switch",
2438 "LFE Playback Switch",
2439 "Side Playback Switch",
2440 "Headphone Playback Switch",
2441 "Speaker Playback Switch",
2442 "Mono Playback Switch",
2443 "IEC958 Playback Switch",
2444 "Line-Out Playback Switch",
2445 "PCM Playback Switch",
2450 * build control elements
2453 static void alc_free_kctls(struct hda_codec *codec);
2455 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2456 /* additional beep mixers; the actual parameters are overwritten at build */
2457 static struct snd_kcontrol_new alc_beep_mixer[] = {
2458 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2459 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2464 static int alc_build_controls(struct hda_codec *codec)
2466 struct alc_spec *spec = codec->spec;
2470 for (i = 0; i < spec->num_mixers; i++) {
2471 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2475 if (spec->cap_mixer) {
2476 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2480 if (spec->multiout.dig_out_nid) {
2481 err = snd_hda_create_spdif_out_ctls(codec,
2482 spec->multiout.dig_out_nid);
2485 if (!spec->no_analog) {
2486 err = snd_hda_create_spdif_share_sw(codec,
2490 spec->multiout.share_spdif = 1;
2493 if (spec->dig_in_nid) {
2494 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2499 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2500 /* create beep controls if needed */
2501 if (spec->beep_amp) {
2502 struct snd_kcontrol_new *knew;
2503 for (knew = alc_beep_mixer; knew->name; knew++) {
2504 struct snd_kcontrol *kctl;
2505 kctl = snd_ctl_new1(knew, codec);
2508 kctl->private_value = spec->beep_amp;
2509 err = snd_hda_ctl_add(codec,
2510 get_amp_nid_(spec->beep_amp), kctl);
2517 /* if we have no master control, let's create it */
2518 if (!spec->no_analog &&
2519 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2520 unsigned int vmaster_tlv[4];
2521 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2522 HDA_OUTPUT, vmaster_tlv);
2523 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2524 vmaster_tlv, alc_slave_vols);
2528 if (!spec->no_analog &&
2529 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2530 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2531 NULL, alc_slave_sws);
2536 alc_free_kctls(codec); /* no longer needed */
2542 * initialize the codec volumes, etc
2546 * generic initialization of ADC, input mixers and output mixers
2548 static struct hda_verb alc880_volume_init_verbs[] = {
2550 * Unmute ADC0-2 and set the default input to mic-in
2552 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2554 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2556 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2559 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2561 * Note: PASD motherboards uses the Line In 2 as the input for front
2564 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2565 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2574 * Set up output mixers (0x0c - 0x0f)
2576 /* set vol=0 to output mixers */
2577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2579 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2580 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2581 /* set up input amps for analog loopback */
2582 /* Amp Indices: DAC = 0, mixer = 1 */
2583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2590 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2596 * 3-stack pin configuration:
2597 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2599 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2601 * preset connection lists of input pins
2602 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2604 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2605 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2606 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2609 * Set pin mode and muting
2611 /* set front pin widgets 0x14 for output */
2612 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2613 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2614 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2615 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2616 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2617 /* Mic2 (as headphone out) for HP output */
2618 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2619 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2620 /* Line In pin widget for input */
2621 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2622 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2623 /* Line2 (as front mic) pin widget for input and vref at 80% */
2624 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2625 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2626 /* CD pin widget for input */
2627 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2633 * 5-stack pin configuration:
2634 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2635 * line-in/side = 0x1a, f-mic = 0x1b
2637 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2639 * preset connection lists of input pins
2640 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2642 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2643 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2646 * Set pin mode and muting
2648 /* set pin widgets 0x14-0x17 for output */
2649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2650 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2651 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2652 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2653 /* unmute pins for output (no gain on this amp) */
2654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2656 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2657 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2659 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2660 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2661 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2662 /* Mic2 (as headphone out) for HP output */
2663 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2664 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2665 /* Line In pin widget for input */
2666 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2667 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2668 /* Line2 (as front mic) pin widget for input and vref at 80% */
2669 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2670 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2671 /* CD pin widget for input */
2672 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2678 * W810 pin configuration:
2679 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2681 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2682 /* hphone/speaker input selector: front DAC */
2683 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2685 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2686 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2689 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2690 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2693 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2699 * Z71V pin configuration:
2700 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2702 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2703 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2704 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2705 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2708 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2709 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2717 * 6-stack pin configuration:
2718 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2719 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2721 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2722 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2724 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2725 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2726 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2728 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2729 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2730 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2731 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2734 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2735 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2736 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2737 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2738 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2739 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2740 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2741 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2747 * Uniwill pin configuration:
2748 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2751 static struct hda_verb alc880_uniwill_init_verbs[] = {
2752 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2754 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2755 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2756 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2758 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2759 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2760 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2761 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2763 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2764 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2765 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2766 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2769 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2770 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2771 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2772 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2773 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2774 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2775 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2776 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2777 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2779 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2780 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2787 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2789 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2790 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2792 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2793 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2794 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2795 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2796 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2797 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2800 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2802 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2803 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2805 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2806 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2809 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2810 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2812 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2813 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2818 static struct hda_verb alc880_beep_init_verbs[] = {
2819 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2823 /* auto-toggle front mic */
2824 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2826 unsigned int present;
2829 present = snd_hda_jack_detect(codec, 0x18);
2830 bits = present ? HDA_AMP_MUTE : 0;
2831 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2834 static void alc880_uniwill_setup(struct hda_codec *codec)
2836 struct alc_spec *spec = codec->spec;
2838 spec->autocfg.hp_pins[0] = 0x14;
2839 spec->autocfg.speaker_pins[0] = 0x15;
2840 spec->autocfg.speaker_pins[0] = 0x16;
2843 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2845 alc_automute_amp(codec);
2846 alc880_uniwill_mic_automute(codec);
2849 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2852 /* Looks like the unsol event is incompatible with the standard
2853 * definition. 4bit tag is placed at 28 bit!
2855 switch (res >> 28) {
2856 case ALC880_MIC_EVENT:
2857 alc880_uniwill_mic_automute(codec);
2860 alc_automute_amp_unsol_event(codec, res);
2865 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2867 struct alc_spec *spec = codec->spec;
2869 spec->autocfg.hp_pins[0] = 0x14;
2870 spec->autocfg.speaker_pins[0] = 0x15;
2873 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2875 unsigned int present;
2877 present = snd_hda_codec_read(codec, 0x21, 0,
2878 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2879 present &= HDA_AMP_VOLMASK;
2880 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2881 HDA_AMP_VOLMASK, present);
2882 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2883 HDA_AMP_VOLMASK, present);
2886 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2889 /* Looks like the unsol event is incompatible with the standard
2890 * definition. 4bit tag is placed at 28 bit!
2892 if ((res >> 28) == ALC880_DCVOL_EVENT)
2893 alc880_uniwill_p53_dcvol_automute(codec);
2895 alc_automute_amp_unsol_event(codec, res);
2899 * F1734 pin configuration:
2900 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2902 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2903 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2904 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2905 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2906 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2907 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2909 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2911 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2914 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2915 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2916 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2917 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2918 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2919 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2920 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2921 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2922 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2924 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2925 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2931 * ASUS pin configuration:
2932 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2934 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2935 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2936 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2937 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2938 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2940 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2941 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2943 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2944 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2945 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2946 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2949 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2951 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2952 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2955 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2956 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2957 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2962 /* Enable GPIO mask and set output */
2963 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2964 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2965 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2967 /* Clevo m520g init */
2968 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2969 /* headphone output */
2970 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2972 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2973 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2975 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2978 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2979 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2980 /* Mic1 (rear panel) */
2981 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2982 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2983 /* Mic2 (front panel) */
2984 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2985 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2987 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2988 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2989 /* change to EAPD mode */
2990 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2991 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2996 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2997 /* change to EAPD mode */
2998 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2999 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3001 /* Headphone output */
3002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3004 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3005 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3007 /* Line In pin widget for input */
3008 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3009 /* CD pin widget for input */
3010 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3011 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3012 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3014 /* change to EAPD mode */
3015 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3016 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3022 * LG m1 express dual
3025 * Rear Line-In/Out (blue): 0x14
3026 * Build-in Mic-In: 0x15
3028 * HP-Out (green): 0x1b
3029 * Mic-In/Out (red): 0x19
3033 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3034 static hda_nid_t alc880_lg_dac_nids[3] = {
3038 /* seems analog CD is not working */
3039 static struct hda_input_mux alc880_lg_capture_source = {
3044 { "Internal Mic", 0x6 },
3048 /* 2,4,6 channel modes */
3049 static struct hda_verb alc880_lg_ch2_init[] = {
3050 /* set line-in and mic-in to input */
3051 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3052 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3056 static struct hda_verb alc880_lg_ch4_init[] = {
3057 /* set line-in to out and mic-in to input */
3058 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3059 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3063 static struct hda_verb alc880_lg_ch6_init[] = {
3064 /* set line-in and mic-in to output */
3065 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3066 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3070 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3071 { 2, alc880_lg_ch2_init },
3072 { 4, alc880_lg_ch4_init },
3073 { 6, alc880_lg_ch6_init },
3076 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3078 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3079 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3080 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3081 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3082 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3083 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3084 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3085 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3086 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3087 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3088 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3089 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3090 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3092 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3093 .name = "Channel Mode",
3094 .info = alc_ch_mode_info,
3095 .get = alc_ch_mode_get,
3096 .put = alc_ch_mode_put,
3101 static struct hda_verb alc880_lg_init_verbs[] = {
3102 /* set capture source to mic-in */
3103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3104 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3105 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3106 /* mute all amp mixer inputs */
3107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3110 /* line-in to input */
3111 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3112 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3114 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3117 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3118 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3119 /* mic-in to input */
3120 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3121 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3122 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3124 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3125 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3126 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3128 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3132 /* toggle speaker-output according to the hp-jack state */
3133 static void alc880_lg_setup(struct hda_codec *codec)
3135 struct alc_spec *spec = codec->spec;
3137 spec->autocfg.hp_pins[0] = 0x1b;
3138 spec->autocfg.speaker_pins[0] = 0x17;
3147 * Built-in Mic-In: 0x19
3153 static struct hda_input_mux alc880_lg_lw_capture_source = {
3157 { "Internal Mic", 0x1 },
3162 #define alc880_lg_lw_modes alc880_threestack_modes
3164 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3166 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3167 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3168 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3169 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3170 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3171 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3172 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3173 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3174 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3177 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3178 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3181 .name = "Channel Mode",
3182 .info = alc_ch_mode_info,
3183 .get = alc_ch_mode_get,
3184 .put = alc_ch_mode_put,
3189 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3190 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3191 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3192 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3194 /* set capture source to mic-in */
3195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3197 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3198 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3201 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3203 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3204 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3205 /* mic-in to input */
3206 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3207 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3210 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3212 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3216 /* toggle speaker-output according to the hp-jack state */
3217 static void alc880_lg_lw_setup(struct hda_codec *codec)
3219 struct alc_spec *spec = codec->spec;
3221 spec->autocfg.hp_pins[0] = 0x1b;
3222 spec->autocfg.speaker_pins[0] = 0x14;
3225 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3226 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3227 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3230 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3231 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3235 static struct hda_input_mux alc880_medion_rim_capture_source = {
3239 { "Internal Mic", 0x1 },
3243 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3244 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3246 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3247 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3249 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3252 /* Mic2 (as headphone out) for HP output */
3253 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3254 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3255 /* Internal Speaker */
3256 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3257 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3259 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3260 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3262 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3266 /* toggle speaker-output according to the hp-jack state */
3267 static void alc880_medion_rim_automute(struct hda_codec *codec)
3269 struct alc_spec *spec = codec->spec;
3270 alc_automute_amp(codec);
3272 if (spec->jack_present)
3273 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3275 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3278 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3281 /* Looks like the unsol event is incompatible with the standard
3282 * definition. 4bit tag is placed at 28 bit!
3284 if ((res >> 28) == ALC880_HP_EVENT)
3285 alc880_medion_rim_automute(codec);
3288 static void alc880_medion_rim_setup(struct hda_codec *codec)
3290 struct alc_spec *spec = codec->spec;
3292 spec->autocfg.hp_pins[0] = 0x14;
3293 spec->autocfg.speaker_pins[0] = 0x1b;
3296 #ifdef CONFIG_SND_HDA_POWER_SAVE
3297 static struct hda_amp_list alc880_loopbacks[] = {
3298 { 0x0b, HDA_INPUT, 0 },
3299 { 0x0b, HDA_INPUT, 1 },
3300 { 0x0b, HDA_INPUT, 2 },
3301 { 0x0b, HDA_INPUT, 3 },
3302 { 0x0b, HDA_INPUT, 4 },
3306 static struct hda_amp_list alc880_lg_loopbacks[] = {
3307 { 0x0b, HDA_INPUT, 1 },
3308 { 0x0b, HDA_INPUT, 6 },
3309 { 0x0b, HDA_INPUT, 7 },
3318 static int alc_init(struct hda_codec *codec)
3320 struct alc_spec *spec = codec->spec;
3324 alc_auto_init_amp(codec, spec->init_amp);
3326 for (i = 0; i < spec->num_init_verbs; i++)
3327 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3329 if (spec->init_hook)
3330 spec->init_hook(codec);
3335 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3337 struct alc_spec *spec = codec->spec;
3339 if (spec->unsol_event)
3340 spec->unsol_event(codec, res);
3343 #ifdef CONFIG_SND_HDA_POWER_SAVE
3344 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3346 struct alc_spec *spec = codec->spec;
3347 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3352 * Analog playback callbacks
3354 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3355 struct hda_codec *codec,
3356 struct snd_pcm_substream *substream)
3358 struct alc_spec *spec = codec->spec;
3359 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3363 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3364 struct hda_codec *codec,
3365 unsigned int stream_tag,
3366 unsigned int format,
3367 struct snd_pcm_substream *substream)
3369 struct alc_spec *spec = codec->spec;
3370 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3371 stream_tag, format, substream);
3374 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3375 struct hda_codec *codec,
3376 struct snd_pcm_substream *substream)
3378 struct alc_spec *spec = codec->spec;
3379 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3385 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3386 struct hda_codec *codec,
3387 struct snd_pcm_substream *substream)
3389 struct alc_spec *spec = codec->spec;
3390 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3393 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3394 struct hda_codec *codec,
3395 unsigned int stream_tag,
3396 unsigned int format,
3397 struct snd_pcm_substream *substream)
3399 struct alc_spec *spec = codec->spec;
3400 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3401 stream_tag, format, substream);
3404 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3405 struct hda_codec *codec,
3406 struct snd_pcm_substream *substream)
3408 struct alc_spec *spec = codec->spec;
3409 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3412 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3413 struct hda_codec *codec,
3414 struct snd_pcm_substream *substream)
3416 struct alc_spec *spec = codec->spec;
3417 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3423 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3424 struct hda_codec *codec,
3425 unsigned int stream_tag,
3426 unsigned int format,
3427 struct snd_pcm_substream *substream)
3429 struct alc_spec *spec = codec->spec;
3431 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3432 stream_tag, 0, format);
3436 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3437 struct hda_codec *codec,
3438 struct snd_pcm_substream *substream)
3440 struct alc_spec *spec = codec->spec;
3442 snd_hda_codec_cleanup_stream(codec,
3443 spec->adc_nids[substream->number + 1]);
3450 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3454 /* NID is set in alc_build_pcms */
3456 .open = alc880_playback_pcm_open,
3457 .prepare = alc880_playback_pcm_prepare,
3458 .cleanup = alc880_playback_pcm_cleanup
3462 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3466 /* NID is set in alc_build_pcms */
3469 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3473 /* NID is set in alc_build_pcms */
3476 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3477 .substreams = 2, /* can be overridden */
3480 /* NID is set in alc_build_pcms */
3482 .prepare = alc880_alt_capture_pcm_prepare,
3483 .cleanup = alc880_alt_capture_pcm_cleanup
3487 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3491 /* NID is set in alc_build_pcms */
3493 .open = alc880_dig_playback_pcm_open,
3494 .close = alc880_dig_playback_pcm_close,
3495 .prepare = alc880_dig_playback_pcm_prepare,
3496 .cleanup = alc880_dig_playback_pcm_cleanup
3500 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3504 /* NID is set in alc_build_pcms */
3507 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3508 static struct hda_pcm_stream alc_pcm_null_stream = {
3514 static int alc_build_pcms(struct hda_codec *codec)
3516 struct alc_spec *spec = codec->spec;
3517 struct hda_pcm *info = spec->pcm_rec;
3520 codec->num_pcms = 1;
3521 codec->pcm_info = info;
3523 if (spec->no_analog)
3526 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3527 "%s Analog", codec->chip_name);
3528 info->name = spec->stream_name_analog;
3530 if (spec->stream_analog_playback) {
3531 if (snd_BUG_ON(!spec->multiout.dac_nids))
3533 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3534 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3536 if (spec->stream_analog_capture) {
3537 if (snd_BUG_ON(!spec->adc_nids))
3539 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3540 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3543 if (spec->channel_mode) {
3544 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3545 for (i = 0; i < spec->num_channel_mode; i++) {
3546 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3547 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3553 /* SPDIF for stream index #1 */
3554 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3555 snprintf(spec->stream_name_digital,
3556 sizeof(spec->stream_name_digital),
3557 "%s Digital", codec->chip_name);
3558 codec->num_pcms = 2;
3559 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3560 info = spec->pcm_rec + 1;
3561 info->name = spec->stream_name_digital;
3562 if (spec->dig_out_type)
3563 info->pcm_type = spec->dig_out_type;
3565 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3566 if (spec->multiout.dig_out_nid &&
3567 spec->stream_digital_playback) {
3568 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3569 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3571 if (spec->dig_in_nid &&
3572 spec->stream_digital_capture) {
3573 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3574 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3576 /* FIXME: do we need this for all Realtek codec models? */
3577 codec->spdif_status_reset = 1;
3580 if (spec->no_analog)
3583 /* If the use of more than one ADC is requested for the current
3584 * model, configure a second analog capture-only PCM.
3586 /* Additional Analaog capture for index #2 */
3587 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3588 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3589 codec->num_pcms = 3;
3590 info = spec->pcm_rec + 2;
3591 info->name = spec->stream_name_analog;
3592 if (spec->alt_dac_nid) {
3593 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3594 *spec->stream_analog_alt_playback;
3595 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3598 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3599 alc_pcm_null_stream;
3600 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3602 if (spec->num_adc_nids > 1) {
3603 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3604 *spec->stream_analog_alt_capture;
3605 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3607 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3608 spec->num_adc_nids - 1;
3610 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3611 alc_pcm_null_stream;
3612 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3619 static void alc_free_kctls(struct hda_codec *codec)
3621 struct alc_spec *spec = codec->spec;
3623 if (spec->kctls.list) {
3624 struct snd_kcontrol_new *kctl = spec->kctls.list;
3626 for (i = 0; i < spec->kctls.used; i++)
3627 kfree(kctl[i].name);
3629 snd_array_free(&spec->kctls);
3632 static void alc_free(struct hda_codec *codec)
3634 struct alc_spec *spec = codec->spec;
3639 alc_free_kctls(codec);
3641 snd_hda_detach_beep_device(codec);
3644 #ifdef CONFIG_SND_HDA_POWER_SAVE
3645 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3647 struct alc_spec *spec = codec->spec;
3648 if (spec && spec->power_hook)
3649 spec->power_hook(codec, 0);
3654 #ifdef SND_HDA_NEEDS_RESUME
3655 static int alc_resume(struct hda_codec *codec)
3657 #ifdef CONFIG_SND_HDA_POWER_SAVE
3658 struct alc_spec *spec = codec->spec;
3660 codec->patch_ops.init(codec);
3661 snd_hda_codec_resume_amp(codec);
3662 snd_hda_codec_resume_cache(codec);
3663 #ifdef CONFIG_SND_HDA_POWER_SAVE
3664 if (spec && spec->power_hook)
3665 spec->power_hook(codec, 1);
3673 static struct hda_codec_ops alc_patch_ops = {
3674 .build_controls = alc_build_controls,
3675 .build_pcms = alc_build_pcms,
3678 .unsol_event = alc_unsol_event,
3679 #ifdef SND_HDA_NEEDS_RESUME
3680 .resume = alc_resume,
3682 #ifdef CONFIG_SND_HDA_POWER_SAVE
3683 .suspend = alc_suspend,
3684 .check_power_status = alc_check_power_status,
3690 * Test configuration for debugging
3692 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3695 #ifdef CONFIG_SND_DEBUG
3696 static hda_nid_t alc880_test_dac_nids[4] = {
3697 0x02, 0x03, 0x04, 0x05
3700 static struct hda_input_mux alc880_test_capture_source = {
3709 { "Surround", 0x6 },
3713 static struct hda_channel_mode alc880_test_modes[4] = {
3720 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3721 struct snd_ctl_elem_info *uinfo)
3723 static char *texts[] = {
3724 "N/A", "Line Out", "HP Out",
3725 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3727 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3729 uinfo->value.enumerated.items = 8;
3730 if (uinfo->value.enumerated.item >= 8)
3731 uinfo->value.enumerated.item = 7;
3732 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3736 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3737 struct snd_ctl_elem_value *ucontrol)
3739 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3740 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3741 unsigned int pin_ctl, item = 0;
3743 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3744 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3745 if (pin_ctl & AC_PINCTL_OUT_EN) {
3746 if (pin_ctl & AC_PINCTL_HP_EN)
3750 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3751 switch (pin_ctl & AC_PINCTL_VREFEN) {
3752 case AC_PINCTL_VREF_HIZ: item = 3; break;
3753 case AC_PINCTL_VREF_50: item = 4; break;
3754 case AC_PINCTL_VREF_GRD: item = 5; break;
3755 case AC_PINCTL_VREF_80: item = 6; break;
3756 case AC_PINCTL_VREF_100: item = 7; break;
3759 ucontrol->value.enumerated.item[0] = item;
3763 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3764 struct snd_ctl_elem_value *ucontrol)
3766 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3767 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3768 static unsigned int ctls[] = {
3769 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3770 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3771 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3772 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3773 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3774 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3776 unsigned int old_ctl, new_ctl;
3778 old_ctl = snd_hda_codec_read(codec, nid, 0,
3779 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3780 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3781 if (old_ctl != new_ctl) {
3783 snd_hda_codec_write_cache(codec, nid, 0,
3784 AC_VERB_SET_PIN_WIDGET_CONTROL,
3786 val = ucontrol->value.enumerated.item[0] >= 3 ?
3788 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3795 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3796 struct snd_ctl_elem_info *uinfo)
3798 static char *texts[] = {
3799 "Front", "Surround", "CLFE", "Side"
3801 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3803 uinfo->value.enumerated.items = 4;
3804 if (uinfo->value.enumerated.item >= 4)
3805 uinfo->value.enumerated.item = 3;
3806 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3810 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3811 struct snd_ctl_elem_value *ucontrol)
3813 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3814 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3817 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3818 ucontrol->value.enumerated.item[0] = sel & 3;
3822 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3823 struct snd_ctl_elem_value *ucontrol)
3825 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3826 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3829 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3830 if (ucontrol->value.enumerated.item[0] != sel) {
3831 sel = ucontrol->value.enumerated.item[0] & 3;
3832 snd_hda_codec_write_cache(codec, nid, 0,
3833 AC_VERB_SET_CONNECT_SEL, sel);
3839 #define PIN_CTL_TEST(xname,nid) { \
3840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3842 .info = alc_test_pin_ctl_info, \
3843 .get = alc_test_pin_ctl_get, \
3844 .put = alc_test_pin_ctl_put, \
3845 .private_value = nid \
3848 #define PIN_SRC_TEST(xname,nid) { \
3849 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3851 .info = alc_test_pin_src_info, \
3852 .get = alc_test_pin_src_get, \
3853 .put = alc_test_pin_src_put, \
3854 .private_value = nid \
3857 static struct snd_kcontrol_new alc880_test_mixer[] = {
3858 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3859 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3860 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3861 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3862 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3863 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3864 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3865 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3866 PIN_CTL_TEST("Front Pin Mode", 0x14),
3867 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3868 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3869 PIN_CTL_TEST("Side Pin Mode", 0x17),
3870 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3871 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3872 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3873 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3874 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3875 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3876 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3877 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3878 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3879 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3880 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3881 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3882 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3883 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3884 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3885 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3886 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3887 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3889 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3890 .name = "Channel Mode",
3891 .info = alc_ch_mode_info,
3892 .get = alc_ch_mode_get,
3893 .put = alc_ch_mode_put,
3898 static struct hda_verb alc880_test_init_verbs[] = {
3899 /* Unmute inputs of 0x0c - 0x0f */
3900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3905 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3906 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3907 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3908 /* Vol output for 0x0c-0x0f */
3909 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3912 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3913 /* Set output pins 0x14-0x17 */
3914 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3915 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3916 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3917 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3918 /* Unmute output pins 0x14-0x17 */
3919 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3921 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3922 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3923 /* Set input pins 0x18-0x1c */
3924 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3925 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3926 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3927 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3928 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3929 /* Mute input pins 0x18-0x1b */
3930 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3932 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3933 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3936 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3937 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3938 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3939 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3940 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3941 /* Analog input/passthru */
3942 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3943 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3944 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3946 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3954 static const char *alc880_models[ALC880_MODEL_LAST] = {
3955 [ALC880_3ST] = "3stack",
3956 [ALC880_TCL_S700] = "tcl",
3957 [ALC880_3ST_DIG] = "3stack-digout",
3958 [ALC880_CLEVO] = "clevo",
3959 [ALC880_5ST] = "5stack",
3960 [ALC880_5ST_DIG] = "5stack-digout",
3961 [ALC880_W810] = "w810",
3962 [ALC880_Z71V] = "z71v",
3963 [ALC880_6ST] = "6stack",
3964 [ALC880_6ST_DIG] = "6stack-digout",
3965 [ALC880_ASUS] = "asus",
3966 [ALC880_ASUS_W1V] = "asus-w1v",
3967 [ALC880_ASUS_DIG] = "asus-dig",
3968 [ALC880_ASUS_DIG2] = "asus-dig2",
3969 [ALC880_UNIWILL_DIG] = "uniwill",
3970 [ALC880_UNIWILL_P53] = "uniwill-p53",
3971 [ALC880_FUJITSU] = "fujitsu",
3972 [ALC880_F1734] = "F1734",
3974 [ALC880_LG_LW] = "lg-lw",
3975 [ALC880_MEDION_RIM] = "medion",
3976 #ifdef CONFIG_SND_DEBUG
3977 [ALC880_TEST] = "test",
3979 [ALC880_AUTO] = "auto",
3982 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3983 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3984 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3985 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3986 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3987 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3988 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3989 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3990 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3991 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3992 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3993 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3994 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3995 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3996 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3997 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3998 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3999 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4000 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4001 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4002 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4003 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4004 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4005 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4006 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4007 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4008 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4009 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4010 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4011 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4012 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4013 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4014 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4015 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4016 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4017 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4018 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4019 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4020 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4021 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4022 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4023 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4024 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4025 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4026 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4027 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4028 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4029 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4030 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4031 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4032 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4033 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4034 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4035 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4036 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4037 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4038 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4039 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4040 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4041 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4042 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4043 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4044 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4045 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4046 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4047 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4048 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4049 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4050 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4052 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4053 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4054 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4059 * ALC880 codec presets
4061 static struct alc_config_preset alc880_presets[] = {
4063 .mixers = { alc880_three_stack_mixer },
4064 .init_verbs = { alc880_volume_init_verbs,
4065 alc880_pin_3stack_init_verbs },
4066 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4067 .dac_nids = alc880_dac_nids,
4068 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4069 .channel_mode = alc880_threestack_modes,
4071 .input_mux = &alc880_capture_source,
4073 [ALC880_3ST_DIG] = {
4074 .mixers = { alc880_three_stack_mixer },
4075 .init_verbs = { alc880_volume_init_verbs,
4076 alc880_pin_3stack_init_verbs },
4077 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4078 .dac_nids = alc880_dac_nids,
4079 .dig_out_nid = ALC880_DIGOUT_NID,
4080 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4081 .channel_mode = alc880_threestack_modes,
4083 .input_mux = &alc880_capture_source,
4085 [ALC880_TCL_S700] = {
4086 .mixers = { alc880_tcl_s700_mixer },
4087 .init_verbs = { alc880_volume_init_verbs,
4088 alc880_pin_tcl_S700_init_verbs,
4089 alc880_gpio2_init_verbs },
4090 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4091 .dac_nids = alc880_dac_nids,
4092 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4093 .num_adc_nids = 1, /* single ADC */
4095 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4096 .channel_mode = alc880_2_jack_modes,
4097 .input_mux = &alc880_capture_source,
4100 .mixers = { alc880_three_stack_mixer,
4101 alc880_five_stack_mixer},
4102 .init_verbs = { alc880_volume_init_verbs,
4103 alc880_pin_5stack_init_verbs },
4104 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4105 .dac_nids = alc880_dac_nids,
4106 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4107 .channel_mode = alc880_fivestack_modes,
4108 .input_mux = &alc880_capture_source,
4110 [ALC880_5ST_DIG] = {
4111 .mixers = { alc880_three_stack_mixer,
4112 alc880_five_stack_mixer },
4113 .init_verbs = { alc880_volume_init_verbs,
4114 alc880_pin_5stack_init_verbs },
4115 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4116 .dac_nids = alc880_dac_nids,
4117 .dig_out_nid = ALC880_DIGOUT_NID,
4118 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4119 .channel_mode = alc880_fivestack_modes,
4120 .input_mux = &alc880_capture_source,
4123 .mixers = { alc880_six_stack_mixer },
4124 .init_verbs = { alc880_volume_init_verbs,
4125 alc880_pin_6stack_init_verbs },
4126 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4127 .dac_nids = alc880_6st_dac_nids,
4128 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4129 .channel_mode = alc880_sixstack_modes,
4130 .input_mux = &alc880_6stack_capture_source,
4132 [ALC880_6ST_DIG] = {
4133 .mixers = { alc880_six_stack_mixer },
4134 .init_verbs = { alc880_volume_init_verbs,
4135 alc880_pin_6stack_init_verbs },
4136 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4137 .dac_nids = alc880_6st_dac_nids,
4138 .dig_out_nid = ALC880_DIGOUT_NID,
4139 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4140 .channel_mode = alc880_sixstack_modes,
4141 .input_mux = &alc880_6stack_capture_source,
4144 .mixers = { alc880_w810_base_mixer },
4145 .init_verbs = { alc880_volume_init_verbs,
4146 alc880_pin_w810_init_verbs,
4147 alc880_gpio2_init_verbs },
4148 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4149 .dac_nids = alc880_w810_dac_nids,
4150 .dig_out_nid = ALC880_DIGOUT_NID,
4151 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4152 .channel_mode = alc880_w810_modes,
4153 .input_mux = &alc880_capture_source,
4156 .mixers = { alc880_z71v_mixer },
4157 .init_verbs = { alc880_volume_init_verbs,
4158 alc880_pin_z71v_init_verbs },
4159 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4160 .dac_nids = alc880_z71v_dac_nids,
4161 .dig_out_nid = ALC880_DIGOUT_NID,
4163 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4164 .channel_mode = alc880_2_jack_modes,
4165 .input_mux = &alc880_capture_source,
4168 .mixers = { alc880_f1734_mixer },
4169 .init_verbs = { alc880_volume_init_verbs,
4170 alc880_pin_f1734_init_verbs },
4171 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4172 .dac_nids = alc880_f1734_dac_nids,
4174 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4175 .channel_mode = alc880_2_jack_modes,
4176 .input_mux = &alc880_f1734_capture_source,
4177 .unsol_event = alc880_uniwill_p53_unsol_event,
4178 .setup = alc880_uniwill_p53_setup,
4179 .init_hook = alc_automute_amp,
4182 .mixers = { alc880_asus_mixer },
4183 .init_verbs = { alc880_volume_init_verbs,
4184 alc880_pin_asus_init_verbs,
4185 alc880_gpio1_init_verbs },
4186 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4187 .dac_nids = alc880_asus_dac_nids,
4188 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4189 .channel_mode = alc880_asus_modes,
4191 .input_mux = &alc880_capture_source,
4193 [ALC880_ASUS_DIG] = {
4194 .mixers = { alc880_asus_mixer },
4195 .init_verbs = { alc880_volume_init_verbs,
4196 alc880_pin_asus_init_verbs,
4197 alc880_gpio1_init_verbs },
4198 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4199 .dac_nids = alc880_asus_dac_nids,
4200 .dig_out_nid = ALC880_DIGOUT_NID,
4201 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4202 .channel_mode = alc880_asus_modes,
4204 .input_mux = &alc880_capture_source,
4206 [ALC880_ASUS_DIG2] = {
4207 .mixers = { alc880_asus_mixer },
4208 .init_verbs = { alc880_volume_init_verbs,
4209 alc880_pin_asus_init_verbs,
4210 alc880_gpio2_init_verbs }, /* use GPIO2 */
4211 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4212 .dac_nids = alc880_asus_dac_nids,
4213 .dig_out_nid = ALC880_DIGOUT_NID,
4214 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4215 .channel_mode = alc880_asus_modes,
4217 .input_mux = &alc880_capture_source,
4219 [ALC880_ASUS_W1V] = {
4220 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4221 .init_verbs = { alc880_volume_init_verbs,
4222 alc880_pin_asus_init_verbs,
4223 alc880_gpio1_init_verbs },
4224 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4225 .dac_nids = alc880_asus_dac_nids,
4226 .dig_out_nid = ALC880_DIGOUT_NID,
4227 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4228 .channel_mode = alc880_asus_modes,
4230 .input_mux = &alc880_capture_source,
4232 [ALC880_UNIWILL_DIG] = {
4233 .mixers = { alc880_asus_mixer },
4234 .init_verbs = { alc880_volume_init_verbs,
4235 alc880_pin_asus_init_verbs },
4236 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4237 .dac_nids = alc880_asus_dac_nids,
4238 .dig_out_nid = ALC880_DIGOUT_NID,
4239 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4240 .channel_mode = alc880_asus_modes,
4242 .input_mux = &alc880_capture_source,
4244 [ALC880_UNIWILL] = {
4245 .mixers = { alc880_uniwill_mixer },
4246 .init_verbs = { alc880_volume_init_verbs,
4247 alc880_uniwill_init_verbs },
4248 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4249 .dac_nids = alc880_asus_dac_nids,
4250 .dig_out_nid = ALC880_DIGOUT_NID,
4251 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4252 .channel_mode = alc880_threestack_modes,
4254 .input_mux = &alc880_capture_source,
4255 .unsol_event = alc880_uniwill_unsol_event,
4256 .setup = alc880_uniwill_setup,
4257 .init_hook = alc880_uniwill_init_hook,
4259 [ALC880_UNIWILL_P53] = {
4260 .mixers = { alc880_uniwill_p53_mixer },
4261 .init_verbs = { alc880_volume_init_verbs,
4262 alc880_uniwill_p53_init_verbs },
4263 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4264 .dac_nids = alc880_asus_dac_nids,
4265 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4266 .channel_mode = alc880_threestack_modes,
4267 .input_mux = &alc880_capture_source,
4268 .unsol_event = alc880_uniwill_p53_unsol_event,
4269 .setup = alc880_uniwill_p53_setup,
4270 .init_hook = alc_automute_amp,
4272 [ALC880_FUJITSU] = {
4273 .mixers = { alc880_fujitsu_mixer },
4274 .init_verbs = { alc880_volume_init_verbs,
4275 alc880_uniwill_p53_init_verbs,
4276 alc880_beep_init_verbs },
4277 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4278 .dac_nids = alc880_dac_nids,
4279 .dig_out_nid = ALC880_DIGOUT_NID,
4280 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4281 .channel_mode = alc880_2_jack_modes,
4282 .input_mux = &alc880_capture_source,
4283 .unsol_event = alc880_uniwill_p53_unsol_event,
4284 .setup = alc880_uniwill_p53_setup,
4285 .init_hook = alc_automute_amp,
4288 .mixers = { alc880_three_stack_mixer },
4289 .init_verbs = { alc880_volume_init_verbs,
4290 alc880_pin_clevo_init_verbs },
4291 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4292 .dac_nids = alc880_dac_nids,
4294 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4295 .channel_mode = alc880_threestack_modes,
4297 .input_mux = &alc880_capture_source,
4300 .mixers = { alc880_lg_mixer },
4301 .init_verbs = { alc880_volume_init_verbs,
4302 alc880_lg_init_verbs },
4303 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4304 .dac_nids = alc880_lg_dac_nids,
4305 .dig_out_nid = ALC880_DIGOUT_NID,
4306 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4307 .channel_mode = alc880_lg_ch_modes,
4309 .input_mux = &alc880_lg_capture_source,
4310 .unsol_event = alc_automute_amp_unsol_event,
4311 .setup = alc880_lg_setup,
4312 .init_hook = alc_automute_amp,
4313 #ifdef CONFIG_SND_HDA_POWER_SAVE
4314 .loopbacks = alc880_lg_loopbacks,
4318 .mixers = { alc880_lg_lw_mixer },
4319 .init_verbs = { alc880_volume_init_verbs,
4320 alc880_lg_lw_init_verbs },
4321 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4322 .dac_nids = alc880_dac_nids,
4323 .dig_out_nid = ALC880_DIGOUT_NID,
4324 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4325 .channel_mode = alc880_lg_lw_modes,
4326 .input_mux = &alc880_lg_lw_capture_source,
4327 .unsol_event = alc_automute_amp_unsol_event,
4328 .setup = alc880_lg_lw_setup,
4329 .init_hook = alc_automute_amp,
4331 [ALC880_MEDION_RIM] = {
4332 .mixers = { alc880_medion_rim_mixer },
4333 .init_verbs = { alc880_volume_init_verbs,
4334 alc880_medion_rim_init_verbs,
4335 alc_gpio2_init_verbs },
4336 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4337 .dac_nids = alc880_dac_nids,
4338 .dig_out_nid = ALC880_DIGOUT_NID,
4339 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4340 .channel_mode = alc880_2_jack_modes,
4341 .input_mux = &alc880_medion_rim_capture_source,
4342 .unsol_event = alc880_medion_rim_unsol_event,
4343 .setup = alc880_medion_rim_setup,
4344 .init_hook = alc880_medion_rim_automute,
4346 #ifdef CONFIG_SND_DEBUG
4348 .mixers = { alc880_test_mixer },
4349 .init_verbs = { alc880_test_init_verbs },
4350 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4351 .dac_nids = alc880_test_dac_nids,
4352 .dig_out_nid = ALC880_DIGOUT_NID,
4353 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4354 .channel_mode = alc880_test_modes,
4355 .input_mux = &alc880_test_capture_source,
4361 * Automatic parse of I/O pins from the BIOS configuration
4366 ALC_CTL_WIDGET_MUTE,
4369 static struct snd_kcontrol_new alc880_control_templates[] = {
4370 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4371 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4372 HDA_BIND_MUTE(NULL, 0, 0, 0),
4375 /* add dynamic controls */
4376 static int add_control(struct alc_spec *spec, int type, const char *name,
4379 struct snd_kcontrol_new *knew;
4381 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4382 knew = snd_array_new(&spec->kctls);
4385 *knew = alc880_control_templates[type];
4386 knew->name = kstrdup(name, GFP_KERNEL);
4389 if (get_amp_nid_(val))
4390 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4391 knew->private_value = val;
4395 static int add_control_with_pfx(struct alc_spec *spec, int type,
4396 const char *pfx, const char *dir,
4397 const char *sfx, unsigned long val)
4400 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4401 return add_control(spec, type, name, val);
4404 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4405 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4406 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4407 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4409 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4410 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4411 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4412 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4413 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4414 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4415 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4416 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4417 #define ALC880_PIN_CD_NID 0x1c
4419 /* fill in the dac_nids table from the parsed pin configuration */
4420 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4421 const struct auto_pin_cfg *cfg)
4427 memset(assigned, 0, sizeof(assigned));
4428 spec->multiout.dac_nids = spec->private_dac_nids;
4430 /* check the pins hardwired to audio widget */
4431 for (i = 0; i < cfg->line_outs; i++) {
4432 nid = cfg->line_out_pins[i];
4433 if (alc880_is_fixed_pin(nid)) {
4434 int idx = alc880_fixed_pin_idx(nid);
4435 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4439 /* left pins can be connect to any audio widget */
4440 for (i = 0; i < cfg->line_outs; i++) {
4441 nid = cfg->line_out_pins[i];
4442 if (alc880_is_fixed_pin(nid))
4444 /* search for an empty channel */
4445 for (j = 0; j < cfg->line_outs; j++) {
4447 spec->multiout.dac_nids[i] =
4448 alc880_idx_to_dac(j);
4454 spec->multiout.num_dacs = cfg->line_outs;
4458 /* add playback controls from the parsed DAC table */
4459 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4460 const struct auto_pin_cfg *cfg)
4462 static const char *chname[4] = {
4463 "Front", "Surround", NULL /*CLFE*/, "Side"
4468 for (i = 0; i < cfg->line_outs; i++) {
4469 if (!spec->multiout.dac_nids[i])
4471 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4474 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4476 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4480 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4482 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4486 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4488 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4492 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4494 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4500 if (cfg->line_outs == 1 &&
4501 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4505 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4506 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4510 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4511 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4520 /* add playback controls for speaker and HP outputs */
4521 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4530 if (alc880_is_fixed_pin(pin)) {
4531 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4532 /* specify the DAC as the extra output */
4533 if (!spec->multiout.hp_nid)
4534 spec->multiout.hp_nid = nid;
4536 spec->multiout.extra_out_nid[0] = nid;
4537 /* control HP volume/switch on the output mixer amp */
4538 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4539 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4540 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4543 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4544 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4547 } else if (alc880_is_multi_pin(pin)) {
4548 /* set manual connection */
4549 /* we have only a switch on HP-out PIN */
4550 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4551 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4558 /* create input playback/capture controls for the given pin */
4559 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4560 const char *ctlname,
4561 int idx, hda_nid_t mix_nid)
4565 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4566 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4569 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4570 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4576 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4578 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4579 return (pincap & AC_PINCAP_IN) != 0;
4582 /* create playback/capture controls for input pins */
4583 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4584 const struct auto_pin_cfg *cfg,
4586 hda_nid_t cap1, hda_nid_t cap2)
4588 struct alc_spec *spec = codec->spec;
4589 struct hda_input_mux *imux = &spec->private_imux[0];
4592 for (i = 0; i < AUTO_PIN_LAST; i++) {
4595 pin = cfg->input_pins[i];
4596 if (!alc_is_input_pin(codec, pin))
4600 idx = get_connection_index(codec, mixer, pin);
4602 err = new_analog_input(spec, pin,
4603 auto_pin_cfg_labels[i],
4612 idx = get_connection_index(codec, cap1, pin);
4613 if (idx < 0 && cap2)
4614 idx = get_connection_index(codec, cap2, pin);
4616 imux->items[imux->num_items].label =
4617 auto_pin_cfg_labels[i];
4618 imux->items[imux->num_items].index = idx;
4625 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4626 const struct auto_pin_cfg *cfg)
4628 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4631 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4632 unsigned int pin_type)
4634 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4637 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4641 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4642 hda_nid_t nid, int pin_type,
4645 alc_set_pin_output(codec, nid, pin_type);
4646 /* need the manual connection? */
4647 if (alc880_is_multi_pin(nid)) {
4648 struct alc_spec *spec = codec->spec;
4649 int idx = alc880_multi_pin_idx(nid);
4650 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4651 AC_VERB_SET_CONNECT_SEL,
4652 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4656 static int get_pin_type(int line_out_type)
4658 if (line_out_type == AUTO_PIN_HP_OUT)
4664 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4666 struct alc_spec *spec = codec->spec;
4669 for (i = 0; i < spec->autocfg.line_outs; i++) {
4670 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4671 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4672 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4676 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4678 struct alc_spec *spec = codec->spec;
4681 pin = spec->autocfg.speaker_pins[0];
4682 if (pin) /* connect to front */
4683 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4684 pin = spec->autocfg.hp_pins[0];
4685 if (pin) /* connect to front */
4686 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4689 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4691 struct alc_spec *spec = codec->spec;
4694 for (i = 0; i < AUTO_PIN_LAST; i++) {
4695 hda_nid_t nid = spec->autocfg.input_pins[i];
4696 if (alc_is_input_pin(codec, nid)) {
4697 alc_set_input_pin(codec, nid, i);
4698 if (nid != ALC880_PIN_CD_NID &&
4699 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4700 snd_hda_codec_write(codec, nid, 0,
4701 AC_VERB_SET_AMP_GAIN_MUTE,
4707 /* parse the BIOS configuration and set up the alc_spec */
4708 /* return 1 if successful, 0 if the proper config is not found,
4709 * or a negative error code
4711 static int alc880_parse_auto_config(struct hda_codec *codec)
4713 struct alc_spec *spec = codec->spec;
4715 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4717 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4721 if (!spec->autocfg.line_outs)
4722 return 0; /* can't find valid BIOS pin config */
4724 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4727 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4730 err = alc880_auto_create_extra_out(spec,
4731 spec->autocfg.speaker_pins[0],
4735 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4739 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4743 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4745 /* check multiple SPDIF-out (for recent codecs) */
4746 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4748 err = snd_hda_get_connections(codec,
4749 spec->autocfg.dig_out_pins[i],
4754 spec->multiout.dig_out_nid = dig_nid;
4756 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4757 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4759 spec->slave_dig_outs[i - 1] = dig_nid;
4762 if (spec->autocfg.dig_in_pin)
4763 spec->dig_in_nid = ALC880_DIGIN_NID;
4765 if (spec->kctls.list)
4766 add_mixer(spec, spec->kctls.list);
4768 add_verb(spec, alc880_volume_init_verbs);
4770 spec->num_mux_defs = 1;
4771 spec->input_mux = &spec->private_imux[0];
4773 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4778 /* additional initialization for auto-configuration model */
4779 static void alc880_auto_init(struct hda_codec *codec)
4781 struct alc_spec *spec = codec->spec;
4782 alc880_auto_init_multi_out(codec);
4783 alc880_auto_init_extra_out(codec);
4784 alc880_auto_init_analog_input(codec);
4785 if (spec->unsol_event)
4786 alc_inithook(codec);
4789 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4790 * one of two digital mic pins, e.g. on ALC272
4792 static void fixup_automic_adc(struct hda_codec *codec)
4794 struct alc_spec *spec = codec->spec;
4797 for (i = 0; i < spec->num_adc_nids; i++) {
4798 hda_nid_t cap = spec->capsrc_nids ?
4799 spec->capsrc_nids[i] : spec->adc_nids[i];
4802 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4805 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4808 spec->int_mic.mux_idx = iidx;
4809 spec->ext_mic.mux_idx = eidx;
4810 if (spec->capsrc_nids)
4811 spec->capsrc_nids += i;
4812 spec->adc_nids += i;
4813 spec->num_adc_nids = 1;
4816 snd_printd(KERN_INFO "hda_codec: %s: "
4817 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4818 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4819 spec->auto_mic = 0; /* disable auto-mic to be sure */
4822 /* choose the ADC/MUX containing the input pin and initialize the setup */
4823 static void fixup_single_adc(struct hda_codec *codec)
4825 struct alc_spec *spec = codec->spec;
4829 /* search for the input pin; there must be only one */
4830 for (i = 0; i < AUTO_PIN_LAST; i++) {
4831 if (spec->autocfg.input_pins[i]) {
4832 pin = spec->autocfg.input_pins[i];
4839 /* set the default connection to that pin */
4840 for (i = 0; i < spec->num_adc_nids; i++) {
4841 hda_nid_t cap = spec->capsrc_nids ?
4842 spec->capsrc_nids[i] : spec->adc_nids[i];
4845 idx = get_connection_index(codec, cap, pin);
4848 /* use only this ADC */
4849 if (spec->capsrc_nids)
4850 spec->capsrc_nids += i;
4851 spec->adc_nids += i;
4852 spec->num_adc_nids = 1;
4853 /* select or unmute this route */
4854 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4855 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4858 snd_hda_codec_write_cache(codec, cap, 0,
4859 AC_VERB_SET_CONNECT_SEL, idx);
4865 static void set_capture_mixer(struct hda_codec *codec)
4867 struct alc_spec *spec = codec->spec;
4868 static struct snd_kcontrol_new *caps[2][3] = {
4869 { alc_capture_mixer_nosrc1,
4870 alc_capture_mixer_nosrc2,
4871 alc_capture_mixer_nosrc3 },
4872 { alc_capture_mixer1,
4874 alc_capture_mixer3 },
4876 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4879 fixup_automic_adc(codec);
4880 else if (spec->input_mux) {
4881 if (spec->input_mux->num_items > 1)
4883 else if (spec->input_mux->num_items == 1)
4884 fixup_single_adc(codec);
4886 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4890 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4891 #define set_beep_amp(spec, nid, idx, dir) \
4892 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4894 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4898 * OK, here we have finally the patch for ALC880
4901 static int patch_alc880(struct hda_codec *codec)
4903 struct alc_spec *spec;
4907 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4913 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4916 if (board_config < 0) {
4917 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4919 board_config = ALC880_AUTO;
4922 if (board_config == ALC880_AUTO) {
4923 /* automatic parse from the BIOS config */
4924 err = alc880_parse_auto_config(codec);
4930 "hda_codec: Cannot set up configuration "
4931 "from BIOS. Using 3-stack mode...\n");
4932 board_config = ALC880_3ST;
4936 err = snd_hda_attach_beep_device(codec, 0x1);
4942 if (board_config != ALC880_AUTO)
4943 setup_preset(codec, &alc880_presets[board_config]);
4945 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4946 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4947 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4949 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4950 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4952 if (!spec->adc_nids && spec->input_mux) {
4953 /* check whether NID 0x07 is valid */
4954 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4956 wcap = get_wcaps_type(wcap);
4957 if (wcap != AC_WID_AUD_IN) {
4958 spec->adc_nids = alc880_adc_nids_alt;
4959 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4961 spec->adc_nids = alc880_adc_nids;
4962 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4965 set_capture_mixer(codec);
4966 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4968 spec->vmaster_nid = 0x0c;
4970 codec->patch_ops = alc_patch_ops;
4971 if (board_config == ALC880_AUTO)
4972 spec->init_hook = alc880_auto_init;
4973 #ifdef CONFIG_SND_HDA_POWER_SAVE
4974 if (!spec->loopback.amplist)
4975 spec->loopback.amplist = alc880_loopbacks;
4977 codec->proc_widget_hook = print_realtek_coef;
4987 static hda_nid_t alc260_dac_nids[1] = {
4992 static hda_nid_t alc260_adc_nids[1] = {
4997 static hda_nid_t alc260_adc_nids_alt[1] = {
5002 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5003 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5005 static hda_nid_t alc260_dual_adc_nids[2] = {
5010 #define ALC260_DIGOUT_NID 0x03
5011 #define ALC260_DIGIN_NID 0x06
5013 static struct hda_input_mux alc260_capture_source = {
5017 { "Front Mic", 0x1 },
5023 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5024 * headphone jack and the internal CD lines since these are the only pins at
5025 * which audio can appear. For flexibility, also allow the option of
5026 * recording the mixer output on the second ADC (ADC0 doesn't have a
5027 * connection to the mixer output).
5029 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5033 { "Mic/Line", 0x0 },
5035 { "Headphone", 0x2 },
5041 { "Mic/Line", 0x0 },
5043 { "Headphone", 0x2 },
5050 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5051 * the Fujitsu S702x, but jacks are marked differently.
5053 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5060 { "Headphone", 0x5 },
5069 { "Headphone", 0x6 },
5075 /* Maxdata Favorit 100XS */
5076 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5080 { "Line/Mic", 0x0 },
5087 { "Line/Mic", 0x0 },
5095 * This is just place-holder, so there's something for alc_build_pcms to look
5096 * at when it calculates the maximum number of channels. ALC260 has no mixer
5097 * element which allows changing the channel mode, so the verb list is
5100 static struct hda_channel_mode alc260_modes[1] = {
5105 /* Mixer combinations
5107 * basic: base_output + input + pc_beep + capture
5108 * HP: base_output + input + capture_alt
5109 * HP_3013: hp_3013 + input + capture
5110 * fujitsu: fujitsu + capture
5111 * acer: acer + capture
5114 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5115 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5116 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5117 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5118 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5119 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5120 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5124 static struct snd_kcontrol_new alc260_input_mixer[] = {
5125 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5126 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5127 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5128 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5130 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5131 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5132 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5136 /* update HP, line and mono out pins according to the master switch */
5137 static void alc260_hp_master_update(struct hda_codec *codec,
5138 hda_nid_t hp, hda_nid_t line,
5141 struct alc_spec *spec = codec->spec;
5142 unsigned int val = spec->master_sw ? PIN_HP : 0;
5143 /* change HP and line-out pins */
5144 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5146 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5148 /* mono (speaker) depending on the HP jack sense */
5149 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5150 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5154 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5155 struct snd_ctl_elem_value *ucontrol)
5157 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5158 struct alc_spec *spec = codec->spec;
5159 *ucontrol->value.integer.value = spec->master_sw;
5163 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5164 struct snd_ctl_elem_value *ucontrol)
5166 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5167 struct alc_spec *spec = codec->spec;
5168 int val = !!*ucontrol->value.integer.value;
5169 hda_nid_t hp, line, mono;
5171 if (val == spec->master_sw)
5173 spec->master_sw = val;
5174 hp = (kcontrol->private_value >> 16) & 0xff;
5175 line = (kcontrol->private_value >> 8) & 0xff;
5176 mono = kcontrol->private_value & 0xff;
5177 alc260_hp_master_update(codec, hp, line, mono);
5181 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5183 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5184 .name = "Master Playback Switch",
5185 .info = snd_ctl_boolean_mono_info,
5186 .get = alc260_hp_master_sw_get,
5187 .put = alc260_hp_master_sw_put,
5188 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5190 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5191 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5192 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5193 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5194 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5196 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5200 static struct hda_verb alc260_hp_unsol_verbs[] = {
5201 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5205 static void alc260_hp_automute(struct hda_codec *codec)
5207 struct alc_spec *spec = codec->spec;
5209 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5210 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5213 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5215 if ((res >> 26) == ALC880_HP_EVENT)
5216 alc260_hp_automute(codec);
5219 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5222 .name = "Master Playback Switch",
5223 .info = snd_ctl_boolean_mono_info,
5224 .get = alc260_hp_master_sw_get,
5225 .put = alc260_hp_master_sw_put,
5226 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5228 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5229 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5230 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5231 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5232 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5233 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5234 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5235 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5239 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5240 .ops = &snd_hda_bind_vol,
5242 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5243 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5244 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5249 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5250 .ops = &snd_hda_bind_sw,
5252 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5253 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5258 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5259 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5260 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5261 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5262 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5266 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5267 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5271 static void alc260_hp_3013_automute(struct hda_codec *codec)
5273 struct alc_spec *spec = codec->spec;
5275 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5276 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5279 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5282 if ((res >> 26) == ALC880_HP_EVENT)
5283 alc260_hp_3013_automute(codec);
5286 static void alc260_hp_3012_automute(struct hda_codec *codec)
5288 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5290 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5292 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5294 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5298 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5301 if ((res >> 26) == ALC880_HP_EVENT)
5302 alc260_hp_3012_automute(codec);
5305 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5306 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5308 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5309 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5310 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5311 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5312 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5313 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5314 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5315 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5316 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5317 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5318 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5322 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5323 * versions of the ALC260 don't act on requests to enable mic bias from NID
5324 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5325 * datasheet doesn't mention this restriction. At this stage it's not clear
5326 * whether this behaviour is intentional or is a hardware bug in chip
5327 * revisions available in early 2006. Therefore for now allow the
5328 * "Headphone Jack Mode" control to span all choices, but if it turns out
5329 * that the lack of mic bias for this NID is intentional we could change the
5330 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5332 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5333 * don't appear to make the mic bias available from the "line" jack, even
5334 * though the NID used for this jack (0x14) can supply it. The theory is
5335 * that perhaps Acer have included blocking capacitors between the ALC260
5336 * and the output jack. If this turns out to be the case for all such
5337 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5338 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5340 * The C20x Tablet series have a mono internal speaker which is controlled
5341 * via the chip's Mono sum widget and pin complex, so include the necessary
5342 * controls for such models. On models without a "mono speaker" the control
5343 * won't do anything.
5345 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5346 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5347 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5348 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5349 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5351 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5353 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5354 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5356 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5357 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5358 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5359 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5360 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5364 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5366 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5367 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5368 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5369 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5370 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5371 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5372 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5376 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5377 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5379 static struct snd_kcontrol_new alc260_will_mixer[] = {
5380 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5381 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5382 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5383 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5384 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5385 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5386 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5387 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5388 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5389 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5393 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5394 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5396 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5397 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5398 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5400 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5401 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5402 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5403 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5404 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5405 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5406 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5411 * initialization verbs
5413 static struct hda_verb alc260_init_verbs[] = {
5414 /* Line In pin widget for input */
5415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5416 /* CD pin widget for input */
5417 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5418 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5419 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5420 /* Mic2 (front panel) pin widget for input and vref at 80% */
5421 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5422 /* LINE-2 is used for line-out in rear */
5423 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5424 /* select line-out */
5425 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5427 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5429 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5431 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5432 /* mute capture amp left and right */
5433 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5434 /* set connection select to line in (default select for this ADC) */
5435 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5436 /* mute capture amp left and right */
5437 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5438 /* set connection select to line in (default select for this ADC) */
5439 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5440 /* set vol=0 Line-Out mixer amp left and right */
5441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5442 /* unmute pin widget amp left and right (no gain on this amp) */
5443 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5444 /* set vol=0 HP mixer amp left and right */
5445 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5446 /* unmute pin widget amp left and right (no gain on this amp) */
5447 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5448 /* set vol=0 Mono mixer amp left and right */
5449 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5450 /* unmute pin widget amp left and right (no gain on this amp) */
5451 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5452 /* unmute LINE-2 out pin */
5453 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5454 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5457 /* mute analog inputs */
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5462 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5463 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5464 /* mute Front out path */
5465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5466 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5467 /* mute Headphone out path */
5468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5469 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5470 /* mute Mono out path */
5471 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5472 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5476 #if 0 /* should be identical with alc260_init_verbs? */
5477 static struct hda_verb alc260_hp_init_verbs[] = {
5478 /* Headphone and output */
5479 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5481 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5482 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5483 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5484 /* Mic2 (front panel) pin widget for input and vref at 80% */
5485 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5486 /* Line In pin widget for input */
5487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5488 /* Line-2 pin widget for output */
5489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5490 /* CD pin widget for input */
5491 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5492 /* unmute amp left and right */
5493 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5494 /* set connection select to line in (default select for this ADC) */
5495 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5496 /* unmute Line-Out mixer amp left and right (volume = 0) */
5497 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5498 /* mute pin widget amp left and right (no gain on this amp) */
5499 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5500 /* unmute HP mixer amp left and right (volume = 0) */
5501 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5502 /* mute pin widget amp left and right (no gain on this amp) */
5503 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5504 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5507 /* mute analog inputs */
5508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5513 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5514 /* Unmute Front out path */
5515 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5516 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5517 /* Unmute Headphone out path */
5518 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5519 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5520 /* Unmute Mono out path */
5521 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5522 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5527 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5528 /* Line out and output */
5529 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5531 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5532 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5533 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5534 /* Mic2 (front panel) pin widget for input and vref at 80% */
5535 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5536 /* Line In pin widget for input */
5537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5538 /* Headphone pin widget for output */
5539 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5540 /* CD pin widget for input */
5541 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5542 /* unmute amp left and right */
5543 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5544 /* set connection select to line in (default select for this ADC) */
5545 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5546 /* unmute Line-Out mixer amp left and right (volume = 0) */
5547 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5548 /* mute pin widget amp left and right (no gain on this amp) */
5549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5550 /* unmute HP mixer amp left and right (volume = 0) */
5551 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5552 /* mute pin widget amp left and right (no gain on this amp) */
5553 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5554 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5557 /* mute analog inputs */
5558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5560 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5561 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5563 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5564 /* Unmute Front out path */
5565 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5566 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5567 /* Unmute Headphone out path */
5568 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5569 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5570 /* Unmute Mono out path */
5571 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5572 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5576 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5577 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5578 * audio = 0x16, internal speaker = 0x10.
5580 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5581 /* Disable all GPIOs */
5582 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5583 /* Internal speaker is connected to headphone pin */
5584 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5585 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5586 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5587 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5588 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5589 /* Ensure all other unused pins are disabled and muted. */
5590 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5591 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5592 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5593 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5594 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5595 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5597 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 /* Disable digital (SPDIF) pins */
5600 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5601 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5603 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5604 * when acting as an output.
5606 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5608 /* Start with output sum widgets muted and their output gains at min */
5609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5610 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5612 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5613 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5615 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5616 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5617 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5619 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5620 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5621 /* Unmute Line1 pin widget output buffer since it starts as an output.
5622 * If the pin mode is changed by the user the pin mode control will
5623 * take care of enabling the pin's input/output buffers as needed.
5624 * Therefore there's no need to enable the input buffer at this
5627 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5628 /* Unmute input buffer of pin widget used for Line-in (no equiv
5631 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5633 /* Mute capture amp left and right */
5634 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5635 /* Set ADC connection select to match default mixer setting - line
5638 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5640 /* Do the same for the second ADC: mute capture input amp and
5641 * set ADC connection to line in (on mic1 pin)
5643 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5644 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5646 /* Mute all inputs to mixer widget (even unconnected ones) */
5647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5649 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5652 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5654 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5659 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5660 * similar laptops (adapted from Fujitsu init verbs).
5662 static struct hda_verb alc260_acer_init_verbs[] = {
5663 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5664 * the headphone jack. Turn this on and rely on the standard mute
5665 * methods whenever the user wants to turn these outputs off.
5667 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5668 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5669 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5670 /* Internal speaker/Headphone jack is connected to Line-out pin */
5671 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5672 /* Internal microphone/Mic jack is connected to Mic1 pin */
5673 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5674 /* Line In jack is connected to Line1 pin */
5675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5676 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5677 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5678 /* Ensure all other unused pins are disabled and muted. */
5679 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5680 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5682 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 /* Disable digital (SPDIF) pins */
5686 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5687 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5689 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5690 * bus when acting as outputs.
5692 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5693 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5695 /* Start with output sum widgets muted and their output gains at min */
5696 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5699 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5702 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5703 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5704 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5706 /* Unmute Line-out pin widget amp left and right
5707 * (no equiv mixer ctrl)
5709 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5710 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5711 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5712 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5713 * inputs. If the pin mode is changed by the user the pin mode control
5714 * will take care of enabling the pin's input/output buffers as needed.
5715 * Therefore there's no need to enable the input buffer at this
5718 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5719 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5721 /* Mute capture amp left and right */
5722 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5723 /* Set ADC connection select to match default mixer setting - mic
5726 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5728 /* Do similar with the second ADC: mute capture input amp and
5729 * set ADC connection to mic to match ALSA's default state.
5731 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5732 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5734 /* Mute all inputs to mixer widget (even unconnected ones) */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5747 /* Initialisation sequence for Maxdata Favorit 100XS
5748 * (adapted from Acer init verbs).
5750 static struct hda_verb alc260_favorit100_init_verbs[] = {
5751 /* GPIO 0 enables the output jack.
5752 * Turn this on and rely on the standard mute
5753 * methods whenever the user wants to turn these outputs off.
5755 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5756 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5757 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5758 /* Line/Mic input jack is connected to Mic1 pin */
5759 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5760 /* Ensure all other unused pins are disabled and muted. */
5761 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5762 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5763 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5764 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5765 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5766 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5771 /* Disable digital (SPDIF) pins */
5772 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5773 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5775 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5776 * bus when acting as outputs.
5778 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5779 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5781 /* Start with output sum widgets muted and their output gains at min */
5782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5786 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5787 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5788 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5789 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5790 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5792 /* Unmute Line-out pin widget amp left and right
5793 * (no equiv mixer ctrl)
5795 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5796 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5797 * inputs. If the pin mode is changed by the user the pin mode control
5798 * will take care of enabling the pin's input/output buffers as needed.
5799 * Therefore there's no need to enable the input buffer at this
5802 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5804 /* Mute capture amp left and right */
5805 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5806 /* Set ADC connection select to match default mixer setting - mic
5809 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5811 /* Do similar with the second ADC: mute capture input amp and
5812 * set ADC connection to mic to match ALSA's default state.
5814 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5815 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5817 /* Mute all inputs to mixer widget (even unconnected ones) */
5818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5820 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5830 static struct hda_verb alc260_will_verbs[] = {
5831 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5832 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5833 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5834 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5835 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5836 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5840 static struct hda_verb alc260_replacer_672v_verbs[] = {
5841 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5842 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5843 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5845 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5846 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5847 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5849 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5853 /* toggle speaker-output according to the hp-jack state */
5854 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5856 unsigned int present;
5858 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5859 present = snd_hda_jack_detect(codec, 0x0f);
5861 snd_hda_codec_write_cache(codec, 0x01, 0,
5862 AC_VERB_SET_GPIO_DATA, 1);
5863 snd_hda_codec_write_cache(codec, 0x0f, 0,
5864 AC_VERB_SET_PIN_WIDGET_CONTROL,
5867 snd_hda_codec_write_cache(codec, 0x01, 0,
5868 AC_VERB_SET_GPIO_DATA, 0);
5869 snd_hda_codec_write_cache(codec, 0x0f, 0,
5870 AC_VERB_SET_PIN_WIDGET_CONTROL,
5875 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5878 if ((res >> 26) == ALC880_HP_EVENT)
5879 alc260_replacer_672v_automute(codec);
5882 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5883 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5884 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5885 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5886 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5887 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5888 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5889 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5890 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5891 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5892 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5896 /* Test configuration for debugging, modelled after the ALC880 test
5899 #ifdef CONFIG_SND_DEBUG
5900 static hda_nid_t alc260_test_dac_nids[1] = {
5903 static hda_nid_t alc260_test_adc_nids[2] = {
5906 /* For testing the ALC260, each input MUX needs its own definition since
5907 * the signal assignments are different. This assumes that the first ADC
5910 static struct hda_input_mux alc260_test_capture_sources[2] = {
5914 { "MIC1 pin", 0x0 },
5915 { "MIC2 pin", 0x1 },
5916 { "LINE1 pin", 0x2 },
5917 { "LINE2 pin", 0x3 },
5919 { "LINE-OUT pin", 0x5 },
5920 { "HP-OUT pin", 0x6 },
5926 { "MIC1 pin", 0x0 },
5927 { "MIC2 pin", 0x1 },
5928 { "LINE1 pin", 0x2 },
5929 { "LINE2 pin", 0x3 },
5932 { "LINE-OUT pin", 0x6 },
5933 { "HP-OUT pin", 0x7 },
5937 static struct snd_kcontrol_new alc260_test_mixer[] = {
5938 /* Output driver widgets */
5939 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5940 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5941 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5942 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5943 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5944 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5946 /* Modes for retasking pin widgets
5947 * Note: the ALC260 doesn't seem to act on requests to enable mic
5948 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5949 * mention this restriction. At this stage it's not clear whether
5950 * this behaviour is intentional or is a hardware bug in chip
5951 * revisions available at least up until early 2006. Therefore for
5952 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5953 * choices, but if it turns out that the lack of mic bias for these
5954 * NIDs is intentional we could change their modes from
5955 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5957 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5958 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5959 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5960 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5961 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5962 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5964 /* Loopback mixer controls */
5965 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5966 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5967 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5968 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5969 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5970 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5971 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5972 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5973 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5974 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5975 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5976 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5977 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5978 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5980 /* Controls for GPIO pins, assuming they are configured as outputs */
5981 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5982 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5983 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5984 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5986 /* Switches to allow the digital IO pins to be enabled. The datasheet
5987 * is ambigious as to which NID is which; testing on laptops which
5988 * make this output available should provide clarification.
5990 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5991 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5993 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5994 * this output to turn on an external amplifier.
5996 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5997 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6001 static struct hda_verb alc260_test_init_verbs[] = {
6002 /* Enable all GPIOs as outputs with an initial value of 0 */
6003 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6004 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6005 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6007 /* Enable retasking pins as output, initially without power amp */
6008 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6009 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6011 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6012 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6013 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6015 /* Disable digital (SPDIF) pins initially, but users can enable
6016 * them via a mixer switch. In the case of SPDIF-out, this initverb
6017 * payload also sets the generation to 0, output to be in "consumer"
6018 * PCM format, copyright asserted, no pre-emphasis and no validity
6021 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6022 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6024 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6025 * OUT1 sum bus when acting as an output.
6027 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6028 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6029 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6030 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6032 /* Start with output sum widgets muted and their output gains at min */
6033 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6034 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6035 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6036 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6037 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6038 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6039 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6040 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6041 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6043 /* Unmute retasking pin widget output buffers since the default
6044 * state appears to be output. As the pin mode is changed by the
6045 * user the pin mode control will take care of enabling the pin's
6046 * input/output buffers as needed.
6048 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6049 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6051 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6052 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6053 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6054 /* Also unmute the mono-out pin widget */
6055 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6057 /* Mute capture amp left and right */
6058 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6059 /* Set ADC connection select to match default mixer setting (mic1
6062 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6064 /* Do the same for the second ADC: mute capture input amp and
6065 * set ADC connection to mic1 pin
6067 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6068 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6070 /* Mute all inputs to mixer widget (even unconnected ones) */
6071 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6072 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6073 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6074 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6075 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6077 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6078 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6084 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6085 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6087 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6088 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6091 * for BIOS auto-configuration
6094 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6095 const char *pfx, int *vol_bits)
6098 unsigned long vol_val, sw_val;
6101 if (nid >= 0x0f && nid < 0x11) {
6102 nid_vol = nid - 0x7;
6103 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6104 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6105 } else if (nid == 0x11) {
6106 nid_vol = nid - 0x7;
6107 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6108 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6109 } else if (nid >= 0x12 && nid <= 0x15) {
6111 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6112 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6116 if (!(*vol_bits & (1 << nid_vol))) {
6117 /* first control for the volume widget */
6118 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6121 *vol_bits |= (1 << nid_vol);
6123 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6129 /* add playback controls from the parsed DAC table */
6130 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6131 const struct auto_pin_cfg *cfg)
6137 spec->multiout.num_dacs = 1;
6138 spec->multiout.dac_nids = spec->private_dac_nids;
6139 spec->multiout.dac_nids[0] = 0x02;
6141 nid = cfg->line_out_pins[0];
6144 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6146 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6150 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6155 nid = cfg->speaker_pins[0];
6157 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6162 nid = cfg->hp_pins[0];
6164 err = alc260_add_playback_controls(spec, nid, "Headphone",
6172 /* create playback/capture controls for input pins */
6173 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6174 const struct auto_pin_cfg *cfg)
6176 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6179 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6180 hda_nid_t nid, int pin_type,
6183 alc_set_pin_output(codec, nid, pin_type);
6184 /* need the manual connection? */
6186 int idx = nid - 0x12;
6187 snd_hda_codec_write(codec, idx + 0x0b, 0,
6188 AC_VERB_SET_CONNECT_SEL, sel_idx);
6192 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6194 struct alc_spec *spec = codec->spec;
6197 nid = spec->autocfg.line_out_pins[0];
6199 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6200 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6203 nid = spec->autocfg.speaker_pins[0];
6205 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6207 nid = spec->autocfg.hp_pins[0];
6209 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6212 #define ALC260_PIN_CD_NID 0x16
6213 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6215 struct alc_spec *spec = codec->spec;
6218 for (i = 0; i < AUTO_PIN_LAST; i++) {
6219 hda_nid_t nid = spec->autocfg.input_pins[i];
6221 alc_set_input_pin(codec, nid, i);
6222 if (nid != ALC260_PIN_CD_NID &&
6223 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6224 snd_hda_codec_write(codec, nid, 0,
6225 AC_VERB_SET_AMP_GAIN_MUTE,
6232 * generic initialization of ADC, input mixers and output mixers
6234 static struct hda_verb alc260_volume_init_verbs[] = {
6236 * Unmute ADC0-1 and set the default input to mic-in
6238 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6239 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6240 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6241 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6243 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6245 * Note: PASD motherboards uses the Line In 2 as the input for
6246 * front panel mic (mic 2)
6248 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6249 /* mute analog inputs */
6250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6251 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6253 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6254 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6257 * Set up output mixers (0x08 - 0x0a)
6259 /* set vol=0 to output mixers */
6260 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6261 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6262 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6263 /* set up input amps for analog loopback */
6264 /* Amp Indices: DAC = 0, mixer = 1 */
6265 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6266 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6267 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6269 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6270 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6275 static int alc260_parse_auto_config(struct hda_codec *codec)
6277 struct alc_spec *spec = codec->spec;
6279 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6281 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6285 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6288 if (!spec->kctls.list)
6289 return 0; /* can't find valid BIOS pin config */
6290 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6294 spec->multiout.max_channels = 2;
6296 if (spec->autocfg.dig_outs)
6297 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6298 if (spec->kctls.list)
6299 add_mixer(spec, spec->kctls.list);
6301 add_verb(spec, alc260_volume_init_verbs);
6303 spec->num_mux_defs = 1;
6304 spec->input_mux = &spec->private_imux[0];
6306 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6311 /* additional initialization for auto-configuration model */
6312 static void alc260_auto_init(struct hda_codec *codec)
6314 struct alc_spec *spec = codec->spec;
6315 alc260_auto_init_multi_out(codec);
6316 alc260_auto_init_analog_input(codec);
6317 if (spec->unsol_event)
6318 alc_inithook(codec);
6321 #ifdef CONFIG_SND_HDA_POWER_SAVE
6322 static struct hda_amp_list alc260_loopbacks[] = {
6323 { 0x07, HDA_INPUT, 0 },
6324 { 0x07, HDA_INPUT, 1 },
6325 { 0x07, HDA_INPUT, 2 },
6326 { 0x07, HDA_INPUT, 3 },
6327 { 0x07, HDA_INPUT, 4 },
6333 * ALC260 configurations
6335 static const char *alc260_models[ALC260_MODEL_LAST] = {
6336 [ALC260_BASIC] = "basic",
6338 [ALC260_HP_3013] = "hp-3013",
6339 [ALC260_HP_DC7600] = "hp-dc7600",
6340 [ALC260_FUJITSU_S702X] = "fujitsu",
6341 [ALC260_ACER] = "acer",
6342 [ALC260_WILL] = "will",
6343 [ALC260_REPLACER_672V] = "replacer",
6344 [ALC260_FAVORIT100] = "favorit100",
6345 #ifdef CONFIG_SND_DEBUG
6346 [ALC260_TEST] = "test",
6348 [ALC260_AUTO] = "auto",
6351 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6352 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6353 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6354 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6355 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6356 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6357 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6358 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6359 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6360 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6361 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6362 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6363 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6364 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6365 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6366 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6367 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6368 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6369 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6370 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6371 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6375 static struct alc_config_preset alc260_presets[] = {
6377 .mixers = { alc260_base_output_mixer,
6378 alc260_input_mixer },
6379 .init_verbs = { alc260_init_verbs },
6380 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6381 .dac_nids = alc260_dac_nids,
6382 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6383 .adc_nids = alc260_adc_nids,
6384 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6385 .channel_mode = alc260_modes,
6386 .input_mux = &alc260_capture_source,
6389 .mixers = { alc260_hp_output_mixer,
6390 alc260_input_mixer },
6391 .init_verbs = { alc260_init_verbs,
6392 alc260_hp_unsol_verbs },
6393 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6394 .dac_nids = alc260_dac_nids,
6395 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6396 .adc_nids = alc260_adc_nids_alt,
6397 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6398 .channel_mode = alc260_modes,
6399 .input_mux = &alc260_capture_source,
6400 .unsol_event = alc260_hp_unsol_event,
6401 .init_hook = alc260_hp_automute,
6403 [ALC260_HP_DC7600] = {
6404 .mixers = { alc260_hp_dc7600_mixer,
6405 alc260_input_mixer },
6406 .init_verbs = { alc260_init_verbs,
6407 alc260_hp_dc7600_verbs },
6408 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6409 .dac_nids = alc260_dac_nids,
6410 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6411 .adc_nids = alc260_adc_nids_alt,
6412 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6413 .channel_mode = alc260_modes,
6414 .input_mux = &alc260_capture_source,
6415 .unsol_event = alc260_hp_3012_unsol_event,
6416 .init_hook = alc260_hp_3012_automute,
6418 [ALC260_HP_3013] = {
6419 .mixers = { alc260_hp_3013_mixer,
6420 alc260_input_mixer },
6421 .init_verbs = { alc260_hp_3013_init_verbs,
6422 alc260_hp_3013_unsol_verbs },
6423 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6424 .dac_nids = alc260_dac_nids,
6425 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6426 .adc_nids = alc260_adc_nids_alt,
6427 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6428 .channel_mode = alc260_modes,
6429 .input_mux = &alc260_capture_source,
6430 .unsol_event = alc260_hp_3013_unsol_event,
6431 .init_hook = alc260_hp_3013_automute,
6433 [ALC260_FUJITSU_S702X] = {
6434 .mixers = { alc260_fujitsu_mixer },
6435 .init_verbs = { alc260_fujitsu_init_verbs },
6436 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6437 .dac_nids = alc260_dac_nids,
6438 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6439 .adc_nids = alc260_dual_adc_nids,
6440 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6441 .channel_mode = alc260_modes,
6442 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6443 .input_mux = alc260_fujitsu_capture_sources,
6446 .mixers = { alc260_acer_mixer },
6447 .init_verbs = { alc260_acer_init_verbs },
6448 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6449 .dac_nids = alc260_dac_nids,
6450 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6451 .adc_nids = alc260_dual_adc_nids,
6452 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6453 .channel_mode = alc260_modes,
6454 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6455 .input_mux = alc260_acer_capture_sources,
6457 [ALC260_FAVORIT100] = {
6458 .mixers = { alc260_favorit100_mixer },
6459 .init_verbs = { alc260_favorit100_init_verbs },
6460 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6461 .dac_nids = alc260_dac_nids,
6462 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6463 .adc_nids = alc260_dual_adc_nids,
6464 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6465 .channel_mode = alc260_modes,
6466 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6467 .input_mux = alc260_favorit100_capture_sources,
6470 .mixers = { alc260_will_mixer },
6471 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6472 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6473 .dac_nids = alc260_dac_nids,
6474 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6475 .adc_nids = alc260_adc_nids,
6476 .dig_out_nid = ALC260_DIGOUT_NID,
6477 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6478 .channel_mode = alc260_modes,
6479 .input_mux = &alc260_capture_source,
6481 [ALC260_REPLACER_672V] = {
6482 .mixers = { alc260_replacer_672v_mixer },
6483 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6484 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6485 .dac_nids = alc260_dac_nids,
6486 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6487 .adc_nids = alc260_adc_nids,
6488 .dig_out_nid = ALC260_DIGOUT_NID,
6489 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6490 .channel_mode = alc260_modes,
6491 .input_mux = &alc260_capture_source,
6492 .unsol_event = alc260_replacer_672v_unsol_event,
6493 .init_hook = alc260_replacer_672v_automute,
6495 #ifdef CONFIG_SND_DEBUG
6497 .mixers = { alc260_test_mixer },
6498 .init_verbs = { alc260_test_init_verbs },
6499 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6500 .dac_nids = alc260_test_dac_nids,
6501 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6502 .adc_nids = alc260_test_adc_nids,
6503 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6504 .channel_mode = alc260_modes,
6505 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6506 .input_mux = alc260_test_capture_sources,
6511 static int patch_alc260(struct hda_codec *codec)
6513 struct alc_spec *spec;
6514 int err, board_config;
6516 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6522 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6525 if (board_config < 0) {
6526 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6528 board_config = ALC260_AUTO;
6531 if (board_config == ALC260_AUTO) {
6532 /* automatic parse from the BIOS config */
6533 err = alc260_parse_auto_config(codec);
6539 "hda_codec: Cannot set up configuration "
6540 "from BIOS. Using base mode...\n");
6541 board_config = ALC260_BASIC;
6545 err = snd_hda_attach_beep_device(codec, 0x1);
6551 if (board_config != ALC260_AUTO)
6552 setup_preset(codec, &alc260_presets[board_config]);
6554 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6555 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6557 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6558 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6560 if (!spec->adc_nids && spec->input_mux) {
6561 /* check whether NID 0x04 is valid */
6562 unsigned int wcap = get_wcaps(codec, 0x04);
6563 wcap = get_wcaps_type(wcap);
6565 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6566 spec->adc_nids = alc260_adc_nids_alt;
6567 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6569 spec->adc_nids = alc260_adc_nids;
6570 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6573 set_capture_mixer(codec);
6574 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6576 spec->vmaster_nid = 0x08;
6578 codec->patch_ops = alc_patch_ops;
6579 if (board_config == ALC260_AUTO)
6580 spec->init_hook = alc260_auto_init;
6581 #ifdef CONFIG_SND_HDA_POWER_SAVE
6582 if (!spec->loopback.amplist)
6583 spec->loopback.amplist = alc260_loopbacks;
6585 codec->proc_widget_hook = print_realtek_coef;
6592 * ALC882/883/885/888/889 support
6594 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6595 * configuration. Each pin widget can choose any input DACs and a mixer.
6596 * Each ADC is connected from a mixer of all inputs. This makes possible
6597 * 6-channel independent captures.
6599 * In addition, an independent DAC for the multi-playback (not used in this
6602 #define ALC882_DIGOUT_NID 0x06
6603 #define ALC882_DIGIN_NID 0x0a
6604 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6605 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6606 #define ALC1200_DIGOUT_NID 0x10
6609 static struct hda_channel_mode alc882_ch_modes[1] = {
6614 static hda_nid_t alc882_dac_nids[4] = {
6615 /* front, rear, clfe, rear_surr */
6616 0x02, 0x03, 0x04, 0x05
6618 #define alc883_dac_nids alc882_dac_nids
6621 #define alc882_adc_nids alc880_adc_nids
6622 #define alc882_adc_nids_alt alc880_adc_nids_alt
6623 #define alc883_adc_nids alc882_adc_nids_alt
6624 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6625 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6626 #define alc889_adc_nids alc880_adc_nids
6628 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6629 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6630 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6631 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6632 #define alc889_capsrc_nids alc882_capsrc_nids
6635 /* FIXME: should be a matrix-type input source selection */
6637 static struct hda_input_mux alc882_capture_source = {
6641 { "Front Mic", 0x1 },
6647 #define alc883_capture_source alc882_capture_source
6649 static struct hda_input_mux alc889_capture_source = {
6652 { "Front Mic", 0x0 },
6658 static struct hda_input_mux mb5_capture_source = {
6667 static struct hda_input_mux alc883_3stack_6ch_intel = {
6671 { "Front Mic", 0x0 },
6677 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6685 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6695 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6703 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6707 { "Front Mic", 0x1 },
6712 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6720 static struct hda_input_mux alc889A_mb31_capture_source = {
6724 /* Front Mic (0x01) unused */
6726 /* Line 2 (0x03) unused */
6727 /* CD (0x04) unused? */
6734 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6741 static struct hda_verb alc882_3ST_ch2_init[] = {
6742 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6743 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6744 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6745 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6752 static struct hda_verb alc882_3ST_ch4_init[] = {
6753 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6754 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6755 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6756 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6757 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6764 static struct hda_verb alc882_3ST_ch6_init[] = {
6765 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6766 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6767 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6770 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6774 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6775 { 2, alc882_3ST_ch2_init },
6776 { 4, alc882_3ST_ch4_init },
6777 { 6, alc882_3ST_ch6_init },
6780 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6785 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6786 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6787 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6788 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6789 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6790 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6797 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6798 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6800 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6801 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6802 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6803 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6810 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6811 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6812 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6813 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6814 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6815 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6816 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6817 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6821 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6822 { 2, alc883_3ST_ch2_clevo_init },
6823 { 4, alc883_3ST_ch4_clevo_init },
6824 { 6, alc883_3ST_ch6_clevo_init },
6831 static struct hda_verb alc882_sixstack_ch6_init[] = {
6832 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6833 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6834 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6835 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6842 static struct hda_verb alc882_sixstack_ch8_init[] = {
6843 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6844 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6845 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6846 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6850 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6851 { 6, alc882_sixstack_ch6_init },
6852 { 8, alc882_sixstack_ch8_init },
6856 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6862 static struct hda_verb alc885_mbp_ch2_init[] = {
6863 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6864 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6865 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6872 static struct hda_verb alc885_mbp_ch4_init[] = {
6873 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6874 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6875 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6876 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6877 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6881 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6882 { 2, alc885_mbp_ch2_init },
6883 { 4, alc885_mbp_ch4_init },
6888 * Speakers/Woofer/HP = Front
6891 static struct hda_verb alc885_mb5_ch2_init[] = {
6892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6893 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6899 * Speakers/HP = Front
6903 static struct hda_verb alc885_mb5_ch6_init[] = {
6904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6906 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6910 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6911 { 2, alc885_mb5_ch2_init },
6912 { 6, alc885_mb5_ch6_init },
6919 static struct hda_verb alc883_4ST_ch2_init[] = {
6920 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6921 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6922 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6923 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6924 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6925 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6932 static struct hda_verb alc883_4ST_ch4_init[] = {
6933 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6934 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6935 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6936 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6937 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6938 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6939 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6946 static struct hda_verb alc883_4ST_ch6_init[] = {
6947 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6948 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6949 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6950 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6951 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6952 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6953 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6954 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6961 static struct hda_verb alc883_4ST_ch8_init[] = {
6962 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6963 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6964 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6965 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6966 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6967 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6968 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6969 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6970 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6974 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6975 { 2, alc883_4ST_ch2_init },
6976 { 4, alc883_4ST_ch4_init },
6977 { 6, alc883_4ST_ch6_init },
6978 { 8, alc883_4ST_ch8_init },
6985 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6986 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6987 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6988 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6989 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6996 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6997 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6998 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6999 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7000 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7001 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7008 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7009 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7010 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7011 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7012 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7013 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7014 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7018 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7019 { 2, alc883_3ST_ch2_intel_init },
7020 { 4, alc883_3ST_ch4_intel_init },
7021 { 6, alc883_3ST_ch6_intel_init },
7027 static struct hda_verb alc889_ch2_intel_init[] = {
7028 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7029 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7030 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7031 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7032 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7033 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7040 static struct hda_verb alc889_ch6_intel_init[] = {
7041 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7042 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7043 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7044 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7045 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7046 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7053 static struct hda_verb alc889_ch8_intel_init[] = {
7054 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7055 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7056 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7057 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7058 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7059 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7060 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7064 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7065 { 2, alc889_ch2_intel_init },
7066 { 6, alc889_ch6_intel_init },
7067 { 8, alc889_ch8_intel_init },
7073 static struct hda_verb alc883_sixstack_ch6_init[] = {
7074 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7075 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7076 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7077 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7084 static struct hda_verb alc883_sixstack_ch8_init[] = {
7085 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7086 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7087 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7088 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7092 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7093 { 6, alc883_sixstack_ch6_init },
7094 { 8, alc883_sixstack_ch8_init },
7098 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7099 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7101 static struct snd_kcontrol_new alc882_base_mixer[] = {
7102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7103 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7104 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7105 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7106 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7107 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7108 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7109 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7110 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7111 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7113 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7114 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7115 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7116 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7118 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7120 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7121 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7122 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7126 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7127 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7128 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7129 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7130 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7131 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7133 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7135 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7136 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7141 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7142 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7143 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7144 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7145 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7146 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7147 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7149 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7151 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7153 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7154 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7155 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7159 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7160 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7161 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7162 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7163 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7165 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7167 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7173 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7174 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7175 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
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_targa_mixer[] = {
7187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7188 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7189 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7190 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7191 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7192 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7193 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7196 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7197 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7198 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7199 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7203 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7204 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7206 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7207 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7208 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7210 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7216 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7219 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7223 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7226 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7227 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7228 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7229 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7230 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7232 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7237 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7240 .name = "Channel Mode",
7241 .info = alc_ch_mode_info,
7242 .get = alc_ch_mode_get,
7243 .put = alc_ch_mode_put,
7248 static struct hda_verb alc882_base_init_verbs[] = {
7249 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7255 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7256 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7258 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7262 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7263 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7266 /* mute analog input loopbacks */
7267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7273 /* Front Pin: output 0 (0x0c) */
7274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7275 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7276 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7277 /* Rear Pin: output 1 (0x0d) */
7278 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7279 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7280 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7281 /* CLFE Pin: output 2 (0x0e) */
7282 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7283 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7284 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7285 /* Side Pin: output 3 (0x0f) */
7286 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7287 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7288 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7289 /* Mic (rear) pin: input vref at 80% */
7290 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7292 /* Front Mic pin: input vref at 80% */
7293 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7295 /* Line In pin: input */
7296 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7298 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7299 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7300 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7301 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7302 /* CD pin widget for input */
7303 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7305 /* FIXME: use matrix-type input source selection */
7306 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7317 /* ADC2: mute amp left and right */
7318 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7319 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7320 /* ADC3: mute amp left and right */
7321 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7322 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7327 static struct hda_verb alc882_adc1_init_verbs[] = {
7328 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7330 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7333 /* ADC1: mute amp left and right */
7334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7335 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7339 static struct hda_verb alc882_eapd_verbs[] = {
7340 /* change to EAPD mode */
7341 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7342 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7346 static struct hda_verb alc889_eapd_verbs[] = {
7347 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7348 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7352 static struct hda_verb alc_hp15_unsol_verbs[] = {
7353 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7354 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7358 static struct hda_verb alc885_init_verbs[] = {
7359 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7373 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7374 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7376 /* mute analog input loopbacks */
7377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7381 /* Front HP Pin: output 0 (0x0c) */
7382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7385 /* Front Pin: output 0 (0x0c) */
7386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7388 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7389 /* Rear Pin: output 1 (0x0d) */
7390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7392 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7393 /* CLFE Pin: output 2 (0x0e) */
7394 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7395 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7396 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7397 /* Side Pin: output 3 (0x0f) */
7398 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7399 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7400 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7401 /* Mic (rear) pin: input vref at 80% */
7402 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7403 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7404 /* Front Mic pin: input vref at 80% */
7405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7407 /* Line In pin: input */
7408 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7409 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7411 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7424 /* ADC2: mute amp left and right */
7425 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7426 /* ADC3: mute amp left and right */
7427 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7432 static struct hda_verb alc885_init_input_verbs[] = {
7433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7440 /* Unmute Selector 24h and set the default input to front mic */
7441 static struct hda_verb alc889_init_input_verbs[] = {
7442 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7443 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7448 #define alc883_init_verbs alc882_base_init_verbs
7451 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7452 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7453 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7454 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7455 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7456 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7457 /* FIXME: this looks suspicious...
7458 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7459 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7464 static struct hda_verb alc882_macpro_init_verbs[] = {
7465 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7469 /* Front Pin: output 0 (0x0c) */
7470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7472 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7473 /* Front Mic pin: input vref at 80% */
7474 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7475 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7476 /* Speaker: output */
7477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7478 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7479 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7480 /* Headphone output (output 0 - 0x0c) */
7481 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7482 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7483 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7485 /* FIXME: use matrix-type input source selection */
7486 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7487 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7489 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7494 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7496 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7498 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7499 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7502 /* ADC1: mute amp left and right */
7503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7504 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7505 /* ADC2: mute amp left and right */
7506 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7507 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7508 /* ADC3: mute amp left and right */
7509 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7510 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7516 static struct hda_verb alc885_mb5_init_verbs[] = {
7518 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7519 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7520 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7521 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7526 /* Surround mixer */
7527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7528 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7529 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7531 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7533 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7535 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7536 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7537 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7538 /* Front Pin (0x0c) */
7539 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7540 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7541 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7542 /* LFE Pin (0x0e) */
7543 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7544 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7545 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7549 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7550 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7551 /* Front Mic pin: input vref at 80% */
7552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7556 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7558 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7565 /* Macbook Pro rev3 */
7566 static struct hda_verb alc885_mbp3_init_verbs[] = {
7567 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7568 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7569 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7573 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7574 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7576 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7577 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7578 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7579 /* Front Pin: output 0 (0x0c) */
7580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7581 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7582 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7583 /* HP Pin: output 0 (0x0e) */
7584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7585 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7586 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7587 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7588 /* Mic (rear) pin: input vref at 80% */
7589 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7590 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7591 /* Front Mic pin: input vref at 80% */
7592 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7593 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7594 /* Line In pin: use output 1 when in LineOut mode */
7595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7597 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7599 /* FIXME: use matrix-type input source selection */
7600 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7601 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7602 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7603 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7604 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7607 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7608 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7609 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7614 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7616 /* ADC1: mute amp left and right */
7617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7618 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7619 /* ADC2: mute amp left and right */
7620 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7621 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7622 /* ADC3: mute amp left and right */
7623 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7624 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7630 static struct hda_verb alc885_imac91_init_verbs[] = {
7631 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7632 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7633 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7637 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7638 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7639 /* HP Pin: output 0 (0x0c) */
7640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7641 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7642 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7643 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7644 /* Internal Speakers: output 0 (0x0d) */
7645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7647 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7648 /* Mic (rear) pin: input vref at 80% */
7649 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7650 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7651 /* Front Mic pin: input vref at 80% */
7652 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7654 /* Line In pin: use output 1 when in LineOut mode */
7655 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7656 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7657 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7659 /* FIXME: use matrix-type input source selection */
7660 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7661 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7676 /* ADC1: mute amp left and right */
7677 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7678 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7679 /* ADC2: mute amp left and right */
7680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7681 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7682 /* ADC3: mute amp left and right */
7683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7684 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7689 /* iMac 24 mixer. */
7690 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7691 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7692 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7696 /* iMac 24 init verbs. */
7697 static struct hda_verb alc885_imac24_init_verbs[] = {
7698 /* Internal speakers: output 0 (0x0c) */
7699 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7701 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7702 /* Internal speakers: output 0 (0x0c) */
7703 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7704 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7705 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7706 /* Headphone: output 0 (0x0c) */
7707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7708 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7709 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7710 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7711 /* Front Mic: input vref at 80% */
7712 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7713 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7717 /* Toggle speaker-output according to the hp-jack state */
7718 static void alc885_imac24_setup(struct hda_codec *codec)
7720 struct alc_spec *spec = codec->spec;
7722 spec->autocfg.hp_pins[0] = 0x14;
7723 spec->autocfg.speaker_pins[0] = 0x18;
7724 spec->autocfg.speaker_pins[1] = 0x1a;
7727 static void alc885_mbp3_setup(struct hda_codec *codec)
7729 struct alc_spec *spec = codec->spec;
7731 spec->autocfg.hp_pins[0] = 0x15;
7732 spec->autocfg.speaker_pins[0] = 0x14;
7735 static void alc885_mb5_automute(struct hda_codec *codec)
7737 unsigned int present;
7739 present = snd_hda_codec_read(codec, 0x14, 0,
7740 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7741 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7742 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7743 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7744 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7748 static void alc885_mb5_unsol_event(struct hda_codec *codec,
7751 /* Headphone insertion or removal. */
7752 if ((res >> 26) == ALC880_HP_EVENT)
7753 alc885_mb5_automute(codec);
7756 static void alc885_imac91_automute(struct hda_codec *codec)
7758 unsigned int present;
7760 present = snd_hda_codec_read(codec, 0x14, 0,
7761 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7762 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7763 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7764 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7765 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7769 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7772 /* Headphone insertion or removal. */
7773 if ((res >> 26) == ALC880_HP_EVENT)
7774 alc885_imac91_automute(codec);
7777 static struct hda_verb alc882_targa_verbs[] = {
7778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7782 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7784 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7785 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7786 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7788 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7792 /* toggle speaker-output according to the hp-jack state */
7793 static void alc882_targa_automute(struct hda_codec *codec)
7795 struct alc_spec *spec = codec->spec;
7796 alc_automute_amp(codec);
7797 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7798 spec->jack_present ? 1 : 3);
7801 static void alc882_targa_setup(struct hda_codec *codec)
7803 struct alc_spec *spec = codec->spec;
7805 spec->autocfg.hp_pins[0] = 0x14;
7806 spec->autocfg.speaker_pins[0] = 0x1b;
7809 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7811 if ((res >> 26) == ALC880_HP_EVENT)
7812 alc882_targa_automute(codec);
7815 static struct hda_verb alc882_asus_a7j_verbs[] = {
7816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7820 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7821 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7823 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7824 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7825 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7827 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7828 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7829 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7833 static struct hda_verb alc882_asus_a7m_verbs[] = {
7834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7835 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7838 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7839 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7841 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7843 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7845 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7846 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7847 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7851 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7853 unsigned int gpiostate, gpiomask, gpiodir;
7855 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7856 AC_VERB_GET_GPIO_DATA, 0);
7859 gpiostate |= (1 << pin);
7861 gpiostate &= ~(1 << pin);
7863 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7864 AC_VERB_GET_GPIO_MASK, 0);
7865 gpiomask |= (1 << pin);
7867 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7868 AC_VERB_GET_GPIO_DIRECTION, 0);
7869 gpiodir |= (1 << pin);
7872 snd_hda_codec_write(codec, codec->afg, 0,
7873 AC_VERB_SET_GPIO_MASK, gpiomask);
7874 snd_hda_codec_write(codec, codec->afg, 0,
7875 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7879 snd_hda_codec_write(codec, codec->afg, 0,
7880 AC_VERB_SET_GPIO_DATA, gpiostate);
7883 /* set up GPIO at initialization */
7884 static void alc885_macpro_init_hook(struct hda_codec *codec)
7886 alc882_gpio_mute(codec, 0, 0);
7887 alc882_gpio_mute(codec, 1, 0);
7890 /* set up GPIO and update auto-muting at initialization */
7891 static void alc885_imac24_init_hook(struct hda_codec *codec)
7893 alc885_macpro_init_hook(codec);
7894 alc_automute_amp(codec);
7898 * generic initialization of ADC, input mixers and output mixers
7900 static struct hda_verb alc883_auto_init_verbs[] = {
7902 * Unmute ADC0-2 and set the default input to mic-in
7904 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7905 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7906 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7907 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7909 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7911 * Note: PASD motherboards uses the Line In 2 as the input for
7912 * front panel mic (mic 2)
7914 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7915 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7916 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7917 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7918 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7919 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7922 * Set up output mixers (0x0c - 0x0f)
7924 /* set vol=0 to output mixers */
7925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7926 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7927 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7928 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7929 /* set up input amps for analog loopback */
7930 /* Amp Indices: DAC = 0, mixer = 1 */
7931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7932 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7933 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7934 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7935 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7936 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7937 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7938 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7939 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7940 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7942 /* FIXME: use matrix-type input source selection */
7943 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7945 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7946 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7947 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7950 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7951 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7952 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7958 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7959 static struct hda_verb alc889A_mb31_ch2_init[] = {
7960 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7961 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7962 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7963 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7967 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7968 static struct hda_verb alc889A_mb31_ch4_init[] = {
7969 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7970 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7971 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7972 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7976 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7977 static struct hda_verb alc889A_mb31_ch5_init[] = {
7978 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7979 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7980 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7981 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7985 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7986 static struct hda_verb alc889A_mb31_ch6_init[] = {
7987 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7988 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7989 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7990 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7994 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7995 { 2, alc889A_mb31_ch2_init },
7996 { 4, alc889A_mb31_ch4_init },
7997 { 5, alc889A_mb31_ch5_init },
7998 { 6, alc889A_mb31_ch6_init },
8001 static struct hda_verb alc883_medion_eapd_verbs[] = {
8002 /* eanable EAPD on medion laptop */
8003 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8004 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8008 #define alc883_base_mixer alc882_base_mixer
8010 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8011 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8012 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8013 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8014 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8015 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8016 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8017 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8021 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8022 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8023 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8027 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8028 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8029 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8030 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8031 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8036 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8037 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8041 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8042 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8043 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8044 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8045 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8046 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8047 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8051 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8055 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8056 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8057 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8059 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8060 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8062 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8063 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8064 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8067 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8068 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8072 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8073 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8074 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8076 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8077 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8078 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8079 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8080 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8081 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8082 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8083 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8084 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8085 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8086 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8087 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8088 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8089 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8091 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8095 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8096 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8097 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8099 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8100 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8102 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8103 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8104 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8105 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8111 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8114 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8119 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8120 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8121 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8122 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8123 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8124 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8126 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8127 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8128 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8130 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8131 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8135 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8137 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8138 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8139 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8143 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8144 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8145 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8147 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8148 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8149 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8150 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8151 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8152 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8153 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8154 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8155 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8156 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8157 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8158 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8160 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8161 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8162 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8166 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8167 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8168 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8170 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8171 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8172 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8173 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8174 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8175 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8176 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8180 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8182 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8187 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8188 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8189 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8191 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8192 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8193 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8195 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8196 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8197 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8198 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8199 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8203 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8204 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8205 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8206 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8207 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8208 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8212 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8213 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8214 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8215 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8216 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8219 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8224 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8225 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8226 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8228 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8229 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8232 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8233 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8237 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8238 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8239 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8240 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8241 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8242 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8245 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8246 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8250 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8252 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8253 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8254 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8255 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8257 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8258 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8262 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8263 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8264 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8265 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8266 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8268 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8269 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8270 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8272 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8277 static struct snd_kcontrol_new alc888_lenovo_sky_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_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8281 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8282 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8283 0x0d, 1, 0x0, HDA_OUTPUT),
8284 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8285 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8286 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8288 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8289 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8290 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8292 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8294 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8296 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8297 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8298 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8302 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8304 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8305 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8306 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8307 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8308 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8310 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8311 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8312 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8313 /* Output switches */
8314 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8315 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8316 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8318 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8319 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8328 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8329 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8330 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8333 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8334 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8338 static struct hda_bind_ctls alc883_bind_cap_vol = {
8339 .ops = &snd_hda_bind_vol,
8341 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8342 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8347 static struct hda_bind_ctls alc883_bind_cap_switch = {
8348 .ops = &snd_hda_bind_sw,
8350 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8351 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8356 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8357 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8358 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8359 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8360 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8361 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8363 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8368 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8369 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8370 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8373 /* .name = "Capture Source", */
8374 .name = "Input Source",
8376 .info = alc_mux_enum_info,
8377 .get = alc_mux_enum_get,
8378 .put = alc_mux_enum_put,
8383 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8385 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8386 .name = "Channel Mode",
8387 .info = alc_ch_mode_info,
8388 .get = alc_ch_mode_get,
8389 .put = alc_ch_mode_put,
8394 /* toggle speaker-output according to the hp-jack state */
8395 static void alc883_mitac_setup(struct hda_codec *codec)
8397 struct alc_spec *spec = codec->spec;
8399 spec->autocfg.hp_pins[0] = 0x15;
8400 spec->autocfg.speaker_pins[0] = 0x14;
8401 spec->autocfg.speaker_pins[1] = 0x17;
8404 /* auto-toggle front mic */
8406 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8408 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8410 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8414 static struct hda_verb alc883_mitac_verbs[] = {
8416 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8417 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8419 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8420 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8422 /* enable unsolicited event */
8423 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8424 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8429 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8434 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8436 /* enable unsolicited event */
8438 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8439 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8445 static struct hda_verb alc883_clevo_m720_verbs[] = {
8447 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8448 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8450 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8451 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8453 /* enable unsolicited event */
8454 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8455 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8460 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8462 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8468 /* enable unsolicited event */
8469 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8474 static struct hda_verb alc883_targa_verbs[] = {
8475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8481 /* Connect Line-Out side jack (SPDIF) to Side */
8482 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8483 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8484 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8485 /* Connect Mic jack to CLFE */
8486 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8487 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8488 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8489 /* Connect Line-in jack to Surround */
8490 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8491 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8492 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8493 /* Connect HP out jack to Front */
8494 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8495 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8496 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8498 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8503 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8504 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8505 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8506 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8510 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8511 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8513 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8518 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8522 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8523 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8527 static struct hda_verb alc883_haier_w66_verbs[] = {
8528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8531 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8533 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8535 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8536 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8540 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8543 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8544 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8545 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8546 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8547 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8548 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8552 static struct hda_verb alc888_6st_dell_verbs[] = {
8553 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8557 static struct hda_verb alc883_vaiott_verbs[] = {
8559 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8560 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8562 /* enable unsolicited event */
8563 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8568 static void alc888_3st_hp_setup(struct hda_codec *codec)
8570 struct alc_spec *spec = codec->spec;
8572 spec->autocfg.hp_pins[0] = 0x1b;
8573 spec->autocfg.speaker_pins[0] = 0x14;
8574 spec->autocfg.speaker_pins[1] = 0x16;
8575 spec->autocfg.speaker_pins[2] = 0x18;
8578 static struct hda_verb alc888_3st_hp_verbs[] = {
8579 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8580 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8581 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8582 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8589 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8590 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8591 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8592 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8593 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8600 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8601 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8602 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8603 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8604 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8605 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8612 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8613 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8614 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8615 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8616 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8617 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8618 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8622 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8623 { 2, alc888_3st_hp_2ch_init },
8624 { 4, alc888_3st_hp_4ch_init },
8625 { 6, alc888_3st_hp_6ch_init },
8628 /* toggle front-jack and RCA according to the hp-jack state */
8629 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8631 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8633 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8634 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8635 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8636 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8639 /* toggle RCA according to the front-jack state */
8640 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8642 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8644 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8645 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8648 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8651 if ((res >> 26) == ALC880_HP_EVENT)
8652 alc888_lenovo_ms7195_front_automute(codec);
8653 if ((res >> 26) == ALC880_FRONT_EVENT)
8654 alc888_lenovo_ms7195_rca_automute(codec);
8657 static struct hda_verb alc883_medion_md2_verbs[] = {
8658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8661 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8663 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8667 /* toggle speaker-output according to the hp-jack state */
8668 static void alc883_medion_md2_setup(struct hda_codec *codec)
8670 struct alc_spec *spec = codec->spec;
8672 spec->autocfg.hp_pins[0] = 0x14;
8673 spec->autocfg.speaker_pins[0] = 0x15;
8676 /* toggle speaker-output according to the hp-jack state */
8677 #define alc883_targa_init_hook alc882_targa_init_hook
8678 #define alc883_targa_unsol_event alc882_targa_unsol_event
8680 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8682 unsigned int present;
8684 present = snd_hda_jack_detect(codec, 0x18);
8685 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8686 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8689 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8691 struct alc_spec *spec = codec->spec;
8693 spec->autocfg.hp_pins[0] = 0x15;
8694 spec->autocfg.speaker_pins[0] = 0x14;
8697 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8699 alc_automute_amp(codec);
8700 alc883_clevo_m720_mic_automute(codec);
8703 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8706 switch (res >> 26) {
8707 case ALC880_MIC_EVENT:
8708 alc883_clevo_m720_mic_automute(codec);
8711 alc_automute_amp_unsol_event(codec, res);
8716 /* toggle speaker-output according to the hp-jack state */
8717 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8719 struct alc_spec *spec = codec->spec;
8721 spec->autocfg.hp_pins[0] = 0x14;
8722 spec->autocfg.speaker_pins[0] = 0x15;
8725 static void alc883_haier_w66_setup(struct hda_codec *codec)
8727 struct alc_spec *spec = codec->spec;
8729 spec->autocfg.hp_pins[0] = 0x1b;
8730 spec->autocfg.speaker_pins[0] = 0x14;
8733 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8735 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8737 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8738 HDA_AMP_MUTE, bits);
8741 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8743 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8745 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8746 HDA_AMP_MUTE, bits);
8747 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8748 HDA_AMP_MUTE, bits);
8751 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8754 if ((res >> 26) == ALC880_HP_EVENT)
8755 alc883_lenovo_101e_all_automute(codec);
8756 if ((res >> 26) == ALC880_FRONT_EVENT)
8757 alc883_lenovo_101e_ispeaker_automute(codec);
8760 /* toggle speaker-output according to the hp-jack state */
8761 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8763 struct alc_spec *spec = codec->spec;
8765 spec->autocfg.hp_pins[0] = 0x14;
8766 spec->autocfg.speaker_pins[0] = 0x15;
8767 spec->autocfg.speaker_pins[1] = 0x16;
8770 static struct hda_verb alc883_acer_eapd_verbs[] = {
8771 /* HP Pin: output 0 (0x0c) */
8772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8774 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8775 /* Front Pin: output 0 (0x0c) */
8776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8777 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8778 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8779 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8780 /* eanable EAPD on medion laptop */
8781 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8782 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8783 /* enable unsolicited event */
8784 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8788 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8789 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8790 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8791 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8795 static void alc888_6st_dell_setup(struct hda_codec *codec)
8797 struct alc_spec *spec = codec->spec;
8799 spec->autocfg.hp_pins[0] = 0x1b;
8800 spec->autocfg.speaker_pins[0] = 0x14;
8801 spec->autocfg.speaker_pins[1] = 0x15;
8802 spec->autocfg.speaker_pins[2] = 0x16;
8803 spec->autocfg.speaker_pins[3] = 0x17;
8806 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8808 struct alc_spec *spec = codec->spec;
8810 spec->autocfg.hp_pins[0] = 0x1b;
8811 spec->autocfg.speaker_pins[0] = 0x14;
8812 spec->autocfg.speaker_pins[1] = 0x15;
8813 spec->autocfg.speaker_pins[2] = 0x16;
8814 spec->autocfg.speaker_pins[3] = 0x17;
8815 spec->autocfg.speaker_pins[4] = 0x1a;
8818 static void alc883_vaiott_setup(struct hda_codec *codec)
8820 struct alc_spec *spec = codec->spec;
8822 spec->autocfg.hp_pins[0] = 0x15;
8823 spec->autocfg.speaker_pins[0] = 0x14;
8824 spec->autocfg.speaker_pins[1] = 0x17;
8827 static struct hda_verb alc888_asus_m90v_verbs[] = {
8828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8829 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8830 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8831 /* enable unsolicited event */
8832 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8833 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8837 static void alc883_mode2_setup(struct hda_codec *codec)
8839 struct alc_spec *spec = codec->spec;
8841 spec->autocfg.hp_pins[0] = 0x1b;
8842 spec->autocfg.speaker_pins[0] = 0x14;
8843 spec->autocfg.speaker_pins[1] = 0x15;
8844 spec->autocfg.speaker_pins[2] = 0x16;
8845 spec->ext_mic.pin = 0x18;
8846 spec->int_mic.pin = 0x19;
8847 spec->ext_mic.mux_idx = 0;
8848 spec->int_mic.mux_idx = 1;
8852 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8853 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8854 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8856 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8858 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8859 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8860 /* enable unsolicited event */
8861 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8865 static void alc883_eee1601_inithook(struct hda_codec *codec)
8867 struct alc_spec *spec = codec->spec;
8869 spec->autocfg.hp_pins[0] = 0x14;
8870 spec->autocfg.speaker_pins[0] = 0x1b;
8871 alc_automute_pin(codec);
8874 static struct hda_verb alc889A_mb31_verbs[] = {
8875 /* Init rear pin (used as headphone output) */
8876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8877 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8878 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8879 /* Init line pin (used as output in 4ch and 6ch mode) */
8880 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8881 /* Init line 2 pin (used as headphone out by default) */
8882 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8883 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8887 /* Mute speakers according to the headphone jack state */
8888 static void alc889A_mb31_automute(struct hda_codec *codec)
8890 unsigned int present;
8892 /* Mute only in 2ch or 4ch mode */
8893 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8895 present = snd_hda_jack_detect(codec, 0x15);
8896 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8897 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8898 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8899 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8903 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8905 if ((res >> 26) == ALC880_HP_EVENT)
8906 alc889A_mb31_automute(codec);
8910 #ifdef CONFIG_SND_HDA_POWER_SAVE
8911 #define alc882_loopbacks alc880_loopbacks
8914 /* pcm configuration: identical with ALC880 */
8915 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8916 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8917 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8918 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8920 static hda_nid_t alc883_slave_dig_outs[] = {
8921 ALC1200_DIGOUT_NID, 0,
8924 static hda_nid_t alc1200_slave_dig_outs[] = {
8925 ALC883_DIGOUT_NID, 0,
8929 * configuration and preset
8931 static const char *alc882_models[ALC882_MODEL_LAST] = {
8932 [ALC882_3ST_DIG] = "3stack-dig",
8933 [ALC882_6ST_DIG] = "6stack-dig",
8934 [ALC882_ARIMA] = "arima",
8935 [ALC882_W2JC] = "w2jc",
8936 [ALC882_TARGA] = "targa",
8937 [ALC882_ASUS_A7J] = "asus-a7j",
8938 [ALC882_ASUS_A7M] = "asus-a7m",
8939 [ALC885_MACPRO] = "macpro",
8940 [ALC885_MB5] = "mb5",
8941 [ALC885_MBP3] = "mbp3",
8942 [ALC885_IMAC24] = "imac24",
8943 [ALC885_IMAC91] = "imac91",
8944 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8945 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8946 [ALC883_3ST_6ch] = "3stack-6ch",
8947 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8948 [ALC883_TARGA_DIG] = "targa-dig",
8949 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8950 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8951 [ALC883_ACER] = "acer",
8952 [ALC883_ACER_ASPIRE] = "acer-aspire",
8953 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8954 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8955 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8956 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8957 [ALC883_MEDION] = "medion",
8958 [ALC883_MEDION_MD2] = "medion-md2",
8959 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8960 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8961 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8962 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8963 [ALC888_LENOVO_SKY] = "lenovo-sky",
8964 [ALC883_HAIER_W66] = "haier-w66",
8965 [ALC888_3ST_HP] = "3stack-hp",
8966 [ALC888_6ST_DELL] = "6stack-dell",
8967 [ALC883_MITAC] = "mitac",
8968 [ALC883_CLEVO_M540R] = "clevo-m540r",
8969 [ALC883_CLEVO_M720] = "clevo-m720",
8970 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8971 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8972 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8973 [ALC889A_INTEL] = "intel-alc889a",
8974 [ALC889_INTEL] = "intel-x58",
8975 [ALC1200_ASUS_P5Q] = "asus-p5q",
8976 [ALC889A_MB31] = "mb31",
8977 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8978 [ALC882_AUTO] = "auto",
8981 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8982 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8984 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8985 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8986 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8987 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8988 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8989 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8990 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8991 ALC888_ACER_ASPIRE_4930G),
8992 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8993 ALC888_ACER_ASPIRE_4930G),
8994 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8995 ALC888_ACER_ASPIRE_8930G),
8996 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8997 ALC888_ACER_ASPIRE_8930G),
8998 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8999 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9000 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9001 ALC888_ACER_ASPIRE_6530G),
9002 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9003 ALC888_ACER_ASPIRE_6530G),
9004 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9005 ALC888_ACER_ASPIRE_7730G),
9006 /* default Acer -- disabled as it causes more problems.
9007 * model=auto should work fine now
9009 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9011 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9013 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9014 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9015 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9016 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9017 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9018 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9020 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9021 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9022 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9023 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9024 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9025 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9026 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9027 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9028 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9029 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9030 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9032 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9033 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9034 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9035 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9036 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9037 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9038 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9039 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9040 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9042 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9043 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9044 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9045 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9046 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9047 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9048 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9049 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9050 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9051 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9052 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9053 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9054 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9055 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9056 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9057 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9058 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9059 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9060 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9061 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9062 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9063 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9064 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9065 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9066 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9067 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9068 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9069 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9070 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9072 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9073 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9074 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9075 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9076 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9077 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9078 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9079 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9080 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9081 ALC883_FUJITSU_PI2515),
9082 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9083 ALC888_FUJITSU_XA3530),
9084 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9085 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9086 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9087 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9088 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9089 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9090 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9091 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9092 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9094 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9095 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9096 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9097 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9098 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9099 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9100 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9105 /* codec SSID table for Intel Mac */
9106 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9107 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9108 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9109 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9110 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9111 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9112 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9113 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9114 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9115 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9116 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9117 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9118 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9119 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9120 * so apparently no perfect solution yet
9122 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9123 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9127 static struct alc_config_preset alc882_presets[] = {
9128 [ALC882_3ST_DIG] = {
9129 .mixers = { alc882_base_mixer },
9130 .init_verbs = { alc882_base_init_verbs,
9131 alc882_adc1_init_verbs },
9132 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9133 .dac_nids = alc882_dac_nids,
9134 .dig_out_nid = ALC882_DIGOUT_NID,
9135 .dig_in_nid = ALC882_DIGIN_NID,
9136 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9137 .channel_mode = alc882_ch_modes,
9139 .input_mux = &alc882_capture_source,
9141 [ALC882_6ST_DIG] = {
9142 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9143 .init_verbs = { alc882_base_init_verbs,
9144 alc882_adc1_init_verbs },
9145 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9146 .dac_nids = alc882_dac_nids,
9147 .dig_out_nid = ALC882_DIGOUT_NID,
9148 .dig_in_nid = ALC882_DIGIN_NID,
9149 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9150 .channel_mode = alc882_sixstack_modes,
9151 .input_mux = &alc882_capture_source,
9154 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9155 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9156 alc882_eapd_verbs },
9157 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9158 .dac_nids = alc882_dac_nids,
9159 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9160 .channel_mode = alc882_sixstack_modes,
9161 .input_mux = &alc882_capture_source,
9164 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9165 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9166 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9167 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9168 .dac_nids = alc882_dac_nids,
9169 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9170 .channel_mode = alc880_threestack_modes,
9172 .input_mux = &alc882_capture_source,
9173 .dig_out_nid = ALC882_DIGOUT_NID,
9176 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9177 .init_verbs = { alc885_mbp3_init_verbs,
9178 alc880_gpio1_init_verbs },
9180 .dac_nids = alc882_dac_nids,
9182 .channel_mode = alc885_mbp_4ch_modes,
9183 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9184 .input_mux = &alc882_capture_source,
9185 .dig_out_nid = ALC882_DIGOUT_NID,
9186 .dig_in_nid = ALC882_DIGIN_NID,
9187 .unsol_event = alc_automute_amp_unsol_event,
9188 .setup = alc885_mbp3_setup,
9189 .init_hook = alc_automute_amp,
9192 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9193 .init_verbs = { alc885_mb5_init_verbs,
9194 alc880_gpio1_init_verbs },
9195 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9196 .dac_nids = alc882_dac_nids,
9197 .channel_mode = alc885_mb5_6ch_modes,
9198 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9199 .input_mux = &mb5_capture_source,
9200 .dig_out_nid = ALC882_DIGOUT_NID,
9201 .dig_in_nid = ALC882_DIGIN_NID,
9202 .unsol_event = alc885_mb5_unsol_event,
9203 .init_hook = alc885_mb5_automute,
9206 .mixers = { alc882_macpro_mixer },
9207 .init_verbs = { alc882_macpro_init_verbs },
9208 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9209 .dac_nids = alc882_dac_nids,
9210 .dig_out_nid = ALC882_DIGOUT_NID,
9211 .dig_in_nid = ALC882_DIGIN_NID,
9212 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9213 .channel_mode = alc882_ch_modes,
9214 .input_mux = &alc882_capture_source,
9215 .init_hook = alc885_macpro_init_hook,
9218 .mixers = { alc885_imac24_mixer },
9219 .init_verbs = { alc885_imac24_init_verbs },
9220 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9221 .dac_nids = alc882_dac_nids,
9222 .dig_out_nid = ALC882_DIGOUT_NID,
9223 .dig_in_nid = ALC882_DIGIN_NID,
9224 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9225 .channel_mode = alc882_ch_modes,
9226 .input_mux = &alc882_capture_source,
9227 .unsol_event = alc_automute_amp_unsol_event,
9228 .setup = alc885_imac24_setup,
9229 .init_hook = alc885_imac24_init_hook,
9232 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9233 .init_verbs = { alc885_imac91_init_verbs,
9234 alc880_gpio1_init_verbs },
9235 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9236 .dac_nids = alc882_dac_nids,
9237 .channel_mode = alc885_mbp_4ch_modes,
9238 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9239 .input_mux = &alc882_capture_source,
9240 .dig_out_nid = ALC882_DIGOUT_NID,
9241 .dig_in_nid = ALC882_DIGIN_NID,
9242 .unsol_event = alc885_imac91_unsol_event,
9243 .init_hook = alc885_imac91_automute,
9246 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9247 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9248 alc880_gpio3_init_verbs, alc882_targa_verbs},
9249 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9250 .dac_nids = alc882_dac_nids,
9251 .dig_out_nid = ALC882_DIGOUT_NID,
9252 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9253 .adc_nids = alc882_adc_nids,
9254 .capsrc_nids = alc882_capsrc_nids,
9255 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9256 .channel_mode = alc882_3ST_6ch_modes,
9258 .input_mux = &alc882_capture_source,
9259 .unsol_event = alc882_targa_unsol_event,
9260 .setup = alc882_targa_setup,
9261 .init_hook = alc882_targa_automute,
9263 [ALC882_ASUS_A7J] = {
9264 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9265 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9266 alc882_asus_a7j_verbs},
9267 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9268 .dac_nids = alc882_dac_nids,
9269 .dig_out_nid = ALC882_DIGOUT_NID,
9270 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9271 .adc_nids = alc882_adc_nids,
9272 .capsrc_nids = alc882_capsrc_nids,
9273 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9274 .channel_mode = alc882_3ST_6ch_modes,
9276 .input_mux = &alc882_capture_source,
9278 [ALC882_ASUS_A7M] = {
9279 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9280 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9281 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9282 alc882_asus_a7m_verbs },
9283 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9284 .dac_nids = alc882_dac_nids,
9285 .dig_out_nid = ALC882_DIGOUT_NID,
9286 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9287 .channel_mode = alc880_threestack_modes,
9289 .input_mux = &alc882_capture_source,
9291 [ALC883_3ST_2ch_DIG] = {
9292 .mixers = { alc883_3ST_2ch_mixer },
9293 .init_verbs = { alc883_init_verbs },
9294 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9295 .dac_nids = alc883_dac_nids,
9296 .dig_out_nid = ALC883_DIGOUT_NID,
9297 .dig_in_nid = ALC883_DIGIN_NID,
9298 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9299 .channel_mode = alc883_3ST_2ch_modes,
9300 .input_mux = &alc883_capture_source,
9302 [ALC883_3ST_6ch_DIG] = {
9303 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9304 .init_verbs = { alc883_init_verbs },
9305 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9306 .dac_nids = alc883_dac_nids,
9307 .dig_out_nid = ALC883_DIGOUT_NID,
9308 .dig_in_nid = ALC883_DIGIN_NID,
9309 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9310 .channel_mode = alc883_3ST_6ch_modes,
9312 .input_mux = &alc883_capture_source,
9314 [ALC883_3ST_6ch] = {
9315 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9316 .init_verbs = { alc883_init_verbs },
9317 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9318 .dac_nids = alc883_dac_nids,
9319 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9320 .channel_mode = alc883_3ST_6ch_modes,
9322 .input_mux = &alc883_capture_source,
9324 [ALC883_3ST_6ch_INTEL] = {
9325 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9326 .init_verbs = { alc883_init_verbs },
9327 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9328 .dac_nids = alc883_dac_nids,
9329 .dig_out_nid = ALC883_DIGOUT_NID,
9330 .dig_in_nid = ALC883_DIGIN_NID,
9331 .slave_dig_outs = alc883_slave_dig_outs,
9332 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9333 .channel_mode = alc883_3ST_6ch_intel_modes,
9335 .input_mux = &alc883_3stack_6ch_intel,
9338 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9339 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9340 alc_hp15_unsol_verbs },
9341 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9342 .dac_nids = alc883_dac_nids,
9343 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9344 .adc_nids = alc889_adc_nids,
9345 .dig_out_nid = ALC883_DIGOUT_NID,
9346 .dig_in_nid = ALC883_DIGIN_NID,
9347 .slave_dig_outs = alc883_slave_dig_outs,
9348 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9349 .channel_mode = alc889_8ch_intel_modes,
9350 .capsrc_nids = alc889_capsrc_nids,
9351 .input_mux = &alc889_capture_source,
9352 .setup = alc889_automute_setup,
9353 .init_hook = alc_automute_amp,
9354 .unsol_event = alc_automute_amp_unsol_event,
9358 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9359 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9360 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9361 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9362 .dac_nids = alc883_dac_nids,
9363 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9364 .adc_nids = alc889_adc_nids,
9365 .dig_out_nid = ALC883_DIGOUT_NID,
9366 .dig_in_nid = ALC883_DIGIN_NID,
9367 .slave_dig_outs = alc883_slave_dig_outs,
9368 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9369 .channel_mode = alc889_8ch_intel_modes,
9370 .capsrc_nids = alc889_capsrc_nids,
9371 .input_mux = &alc889_capture_source,
9372 .setup = alc889_automute_setup,
9373 .init_hook = alc889_intel_init_hook,
9374 .unsol_event = alc_automute_amp_unsol_event,
9377 [ALC883_6ST_DIG] = {
9378 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9379 .init_verbs = { alc883_init_verbs },
9380 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9381 .dac_nids = alc883_dac_nids,
9382 .dig_out_nid = ALC883_DIGOUT_NID,
9383 .dig_in_nid = ALC883_DIGIN_NID,
9384 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9385 .channel_mode = alc883_sixstack_modes,
9386 .input_mux = &alc883_capture_source,
9388 [ALC883_TARGA_DIG] = {
9389 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9390 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9391 alc883_targa_verbs},
9392 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9393 .dac_nids = alc883_dac_nids,
9394 .dig_out_nid = ALC883_DIGOUT_NID,
9395 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9396 .channel_mode = alc883_3ST_6ch_modes,
9398 .input_mux = &alc883_capture_source,
9399 .unsol_event = alc883_targa_unsol_event,
9400 .setup = alc882_targa_setup,
9401 .init_hook = alc882_targa_automute,
9403 [ALC883_TARGA_2ch_DIG] = {
9404 .mixers = { alc883_targa_2ch_mixer},
9405 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9406 alc883_targa_verbs},
9407 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9408 .dac_nids = alc883_dac_nids,
9409 .adc_nids = alc883_adc_nids_alt,
9410 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9411 .capsrc_nids = alc883_capsrc_nids,
9412 .dig_out_nid = ALC883_DIGOUT_NID,
9413 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9414 .channel_mode = alc883_3ST_2ch_modes,
9415 .input_mux = &alc883_capture_source,
9416 .unsol_event = alc883_targa_unsol_event,
9417 .setup = alc882_targa_setup,
9418 .init_hook = alc882_targa_automute,
9420 [ALC883_TARGA_8ch_DIG] = {
9421 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9422 alc883_chmode_mixer },
9423 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9424 alc883_targa_verbs },
9425 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9426 .dac_nids = alc883_dac_nids,
9427 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9428 .adc_nids = alc883_adc_nids_rev,
9429 .capsrc_nids = alc883_capsrc_nids_rev,
9430 .dig_out_nid = ALC883_DIGOUT_NID,
9431 .dig_in_nid = ALC883_DIGIN_NID,
9432 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9433 .channel_mode = alc883_4ST_8ch_modes,
9435 .input_mux = &alc883_capture_source,
9436 .unsol_event = alc883_targa_unsol_event,
9437 .setup = alc882_targa_setup,
9438 .init_hook = alc882_targa_automute,
9441 .mixers = { alc883_base_mixer },
9442 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9443 * and the headphone jack. Turn this on and rely on the
9444 * standard mute methods whenever the user wants to turn
9445 * these outputs off.
9447 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9448 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9449 .dac_nids = alc883_dac_nids,
9450 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9451 .channel_mode = alc883_3ST_2ch_modes,
9452 .input_mux = &alc883_capture_source,
9454 [ALC883_ACER_ASPIRE] = {
9455 .mixers = { alc883_acer_aspire_mixer },
9456 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9457 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9458 .dac_nids = alc883_dac_nids,
9459 .dig_out_nid = ALC883_DIGOUT_NID,
9460 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9461 .channel_mode = alc883_3ST_2ch_modes,
9462 .input_mux = &alc883_capture_source,
9463 .unsol_event = alc_automute_amp_unsol_event,
9464 .setup = alc883_acer_aspire_setup,
9465 .init_hook = alc_automute_amp,
9467 [ALC888_ACER_ASPIRE_4930G] = {
9468 .mixers = { alc888_base_mixer,
9469 alc883_chmode_mixer },
9470 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9471 alc888_acer_aspire_4930g_verbs },
9472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9473 .dac_nids = alc883_dac_nids,
9474 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9475 .adc_nids = alc883_adc_nids_rev,
9476 .capsrc_nids = alc883_capsrc_nids_rev,
9477 .dig_out_nid = ALC883_DIGOUT_NID,
9478 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9479 .channel_mode = alc883_3ST_6ch_modes,
9481 .const_channel_count = 6,
9483 ARRAY_SIZE(alc888_2_capture_sources),
9484 .input_mux = alc888_2_capture_sources,
9485 .unsol_event = alc_automute_amp_unsol_event,
9486 .setup = alc888_acer_aspire_4930g_setup,
9487 .init_hook = alc_automute_amp,
9489 [ALC888_ACER_ASPIRE_6530G] = {
9490 .mixers = { alc888_acer_aspire_6530_mixer },
9491 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9492 alc888_acer_aspire_6530g_verbs },
9493 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9494 .dac_nids = alc883_dac_nids,
9495 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9496 .adc_nids = alc883_adc_nids_rev,
9497 .capsrc_nids = alc883_capsrc_nids_rev,
9498 .dig_out_nid = ALC883_DIGOUT_NID,
9499 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9500 .channel_mode = alc883_3ST_2ch_modes,
9502 ARRAY_SIZE(alc888_2_capture_sources),
9503 .input_mux = alc888_acer_aspire_6530_sources,
9504 .unsol_event = alc_automute_amp_unsol_event,
9505 .setup = alc888_acer_aspire_6530g_setup,
9506 .init_hook = alc_automute_amp,
9508 [ALC888_ACER_ASPIRE_8930G] = {
9509 .mixers = { alc889_acer_aspire_8930g_mixer,
9510 alc883_chmode_mixer },
9511 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9512 alc889_acer_aspire_8930g_verbs,
9514 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9515 .dac_nids = alc883_dac_nids,
9516 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9517 .adc_nids = alc889_adc_nids,
9518 .capsrc_nids = alc889_capsrc_nids,
9519 .dig_out_nid = ALC883_DIGOUT_NID,
9520 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9521 .channel_mode = alc883_3ST_6ch_modes,
9523 .const_channel_count = 6,
9525 ARRAY_SIZE(alc889_capture_sources),
9526 .input_mux = alc889_capture_sources,
9527 .unsol_event = alc_automute_amp_unsol_event,
9528 .setup = alc889_acer_aspire_8930g_setup,
9529 .init_hook = alc_automute_amp,
9530 #ifdef CONFIG_SND_HDA_POWER_SAVE
9531 .power_hook = alc889_power_eapd,
9534 [ALC888_ACER_ASPIRE_7730G] = {
9535 .mixers = { alc883_3ST_6ch_mixer,
9536 alc883_chmode_mixer },
9537 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9538 alc888_acer_aspire_7730G_verbs },
9539 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9540 .dac_nids = alc883_dac_nids,
9541 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9542 .adc_nids = alc883_adc_nids_rev,
9543 .capsrc_nids = alc883_capsrc_nids_rev,
9544 .dig_out_nid = ALC883_DIGOUT_NID,
9545 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9546 .channel_mode = alc883_3ST_6ch_modes,
9548 .const_channel_count = 6,
9549 .input_mux = &alc883_capture_source,
9550 .unsol_event = alc_automute_amp_unsol_event,
9551 .setup = alc888_acer_aspire_6530g_setup,
9552 .init_hook = alc_automute_amp,
9555 .mixers = { alc883_fivestack_mixer,
9556 alc883_chmode_mixer },
9557 .init_verbs = { alc883_init_verbs,
9558 alc883_medion_eapd_verbs },
9559 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9560 .dac_nids = alc883_dac_nids,
9561 .adc_nids = alc883_adc_nids_alt,
9562 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9563 .capsrc_nids = alc883_capsrc_nids,
9564 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9565 .channel_mode = alc883_sixstack_modes,
9566 .input_mux = &alc883_capture_source,
9568 [ALC883_MEDION_MD2] = {
9569 .mixers = { alc883_medion_md2_mixer},
9570 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9571 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9572 .dac_nids = alc883_dac_nids,
9573 .dig_out_nid = ALC883_DIGOUT_NID,
9574 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9575 .channel_mode = alc883_3ST_2ch_modes,
9576 .input_mux = &alc883_capture_source,
9577 .unsol_event = alc_automute_amp_unsol_event,
9578 .setup = alc883_medion_md2_setup,
9579 .init_hook = alc_automute_amp,
9581 [ALC883_LAPTOP_EAPD] = {
9582 .mixers = { alc883_base_mixer },
9583 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9584 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9585 .dac_nids = alc883_dac_nids,
9586 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9587 .channel_mode = alc883_3ST_2ch_modes,
9588 .input_mux = &alc883_capture_source,
9590 [ALC883_CLEVO_M540R] = {
9591 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9592 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9593 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9594 .dac_nids = alc883_dac_nids,
9595 .dig_out_nid = ALC883_DIGOUT_NID,
9596 .dig_in_nid = ALC883_DIGIN_NID,
9597 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9598 .channel_mode = alc883_3ST_6ch_clevo_modes,
9600 .input_mux = &alc883_capture_source,
9601 /* This machine has the hardware HP auto-muting, thus
9602 * we need no software mute via unsol event
9605 [ALC883_CLEVO_M720] = {
9606 .mixers = { alc883_clevo_m720_mixer },
9607 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9608 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9609 .dac_nids = alc883_dac_nids,
9610 .dig_out_nid = ALC883_DIGOUT_NID,
9611 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9612 .channel_mode = alc883_3ST_2ch_modes,
9613 .input_mux = &alc883_capture_source,
9614 .unsol_event = alc883_clevo_m720_unsol_event,
9615 .setup = alc883_clevo_m720_setup,
9616 .init_hook = alc883_clevo_m720_init_hook,
9618 [ALC883_LENOVO_101E_2ch] = {
9619 .mixers = { alc883_lenovo_101e_2ch_mixer},
9620 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9621 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9622 .dac_nids = alc883_dac_nids,
9623 .adc_nids = alc883_adc_nids_alt,
9624 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9625 .capsrc_nids = alc883_capsrc_nids,
9626 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9627 .channel_mode = alc883_3ST_2ch_modes,
9628 .input_mux = &alc883_lenovo_101e_capture_source,
9629 .unsol_event = alc883_lenovo_101e_unsol_event,
9630 .init_hook = alc883_lenovo_101e_all_automute,
9632 [ALC883_LENOVO_NB0763] = {
9633 .mixers = { alc883_lenovo_nb0763_mixer },
9634 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9635 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9636 .dac_nids = alc883_dac_nids,
9637 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9638 .channel_mode = alc883_3ST_2ch_modes,
9640 .input_mux = &alc883_lenovo_nb0763_capture_source,
9641 .unsol_event = alc_automute_amp_unsol_event,
9642 .setup = alc883_medion_md2_setup,
9643 .init_hook = alc_automute_amp,
9645 [ALC888_LENOVO_MS7195_DIG] = {
9646 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9647 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9648 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9649 .dac_nids = alc883_dac_nids,
9650 .dig_out_nid = ALC883_DIGOUT_NID,
9651 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9652 .channel_mode = alc883_3ST_6ch_modes,
9654 .input_mux = &alc883_capture_source,
9655 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9656 .init_hook = alc888_lenovo_ms7195_front_automute,
9658 [ALC883_HAIER_W66] = {
9659 .mixers = { alc883_targa_2ch_mixer},
9660 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9661 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9662 .dac_nids = alc883_dac_nids,
9663 .dig_out_nid = ALC883_DIGOUT_NID,
9664 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9665 .channel_mode = alc883_3ST_2ch_modes,
9666 .input_mux = &alc883_capture_source,
9667 .unsol_event = alc_automute_amp_unsol_event,
9668 .setup = alc883_haier_w66_setup,
9669 .init_hook = alc_automute_amp,
9672 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9673 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9674 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9675 .dac_nids = alc883_dac_nids,
9676 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9677 .channel_mode = alc888_3st_hp_modes,
9679 .input_mux = &alc883_capture_source,
9680 .unsol_event = alc_automute_amp_unsol_event,
9681 .setup = alc888_3st_hp_setup,
9682 .init_hook = alc_automute_amp,
9684 [ALC888_6ST_DELL] = {
9685 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9686 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9687 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9688 .dac_nids = alc883_dac_nids,
9689 .dig_out_nid = ALC883_DIGOUT_NID,
9690 .dig_in_nid = ALC883_DIGIN_NID,
9691 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9692 .channel_mode = alc883_sixstack_modes,
9693 .input_mux = &alc883_capture_source,
9694 .unsol_event = alc_automute_amp_unsol_event,
9695 .setup = alc888_6st_dell_setup,
9696 .init_hook = alc_automute_amp,
9699 .mixers = { alc883_mitac_mixer },
9700 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9701 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9702 .dac_nids = alc883_dac_nids,
9703 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9704 .channel_mode = alc883_3ST_2ch_modes,
9705 .input_mux = &alc883_capture_source,
9706 .unsol_event = alc_automute_amp_unsol_event,
9707 .setup = alc883_mitac_setup,
9708 .init_hook = alc_automute_amp,
9710 [ALC883_FUJITSU_PI2515] = {
9711 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9712 .init_verbs = { alc883_init_verbs,
9713 alc883_2ch_fujitsu_pi2515_verbs},
9714 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9715 .dac_nids = alc883_dac_nids,
9716 .dig_out_nid = ALC883_DIGOUT_NID,
9717 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9718 .channel_mode = alc883_3ST_2ch_modes,
9719 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9720 .unsol_event = alc_automute_amp_unsol_event,
9721 .setup = alc883_2ch_fujitsu_pi2515_setup,
9722 .init_hook = alc_automute_amp,
9724 [ALC888_FUJITSU_XA3530] = {
9725 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9726 .init_verbs = { alc883_init_verbs,
9727 alc888_fujitsu_xa3530_verbs },
9728 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9729 .dac_nids = alc883_dac_nids,
9730 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9731 .adc_nids = alc883_adc_nids_rev,
9732 .capsrc_nids = alc883_capsrc_nids_rev,
9733 .dig_out_nid = ALC883_DIGOUT_NID,
9734 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9735 .channel_mode = alc888_4ST_8ch_intel_modes,
9737 ARRAY_SIZE(alc888_2_capture_sources),
9738 .input_mux = alc888_2_capture_sources,
9739 .unsol_event = alc_automute_amp_unsol_event,
9740 .setup = alc888_fujitsu_xa3530_setup,
9741 .init_hook = alc_automute_amp,
9743 [ALC888_LENOVO_SKY] = {
9744 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9745 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9746 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9747 .dac_nids = alc883_dac_nids,
9748 .dig_out_nid = ALC883_DIGOUT_NID,
9749 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9750 .channel_mode = alc883_sixstack_modes,
9752 .input_mux = &alc883_lenovo_sky_capture_source,
9753 .unsol_event = alc_automute_amp_unsol_event,
9754 .setup = alc888_lenovo_sky_setup,
9755 .init_hook = alc_automute_amp,
9757 [ALC888_ASUS_M90V] = {
9758 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9759 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9760 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9761 .dac_nids = alc883_dac_nids,
9762 .dig_out_nid = ALC883_DIGOUT_NID,
9763 .dig_in_nid = ALC883_DIGIN_NID,
9764 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9765 .channel_mode = alc883_3ST_6ch_modes,
9767 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9768 .unsol_event = alc_sku_unsol_event,
9769 .setup = alc883_mode2_setup,
9770 .init_hook = alc_inithook,
9772 [ALC888_ASUS_EEE1601] = {
9773 .mixers = { alc883_asus_eee1601_mixer },
9774 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9775 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9776 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9777 .dac_nids = alc883_dac_nids,
9778 .dig_out_nid = ALC883_DIGOUT_NID,
9779 .dig_in_nid = ALC883_DIGIN_NID,
9780 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9781 .channel_mode = alc883_3ST_2ch_modes,
9783 .input_mux = &alc883_asus_eee1601_capture_source,
9784 .unsol_event = alc_sku_unsol_event,
9785 .init_hook = alc883_eee1601_inithook,
9787 [ALC1200_ASUS_P5Q] = {
9788 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9789 .init_verbs = { alc883_init_verbs },
9790 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9791 .dac_nids = alc883_dac_nids,
9792 .dig_out_nid = ALC1200_DIGOUT_NID,
9793 .dig_in_nid = ALC883_DIGIN_NID,
9794 .slave_dig_outs = alc1200_slave_dig_outs,
9795 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9796 .channel_mode = alc883_sixstack_modes,
9797 .input_mux = &alc883_capture_source,
9800 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9801 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9802 alc880_gpio1_init_verbs },
9803 .adc_nids = alc883_adc_nids,
9804 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9805 .capsrc_nids = alc883_capsrc_nids,
9806 .dac_nids = alc883_dac_nids,
9807 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9808 .channel_mode = alc889A_mb31_6ch_modes,
9809 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9810 .input_mux = &alc889A_mb31_capture_source,
9811 .dig_out_nid = ALC883_DIGOUT_NID,
9812 .unsol_event = alc889A_mb31_unsol_event,
9813 .init_hook = alc889A_mb31_automute,
9815 [ALC883_SONY_VAIO_TT] = {
9816 .mixers = { alc883_vaiott_mixer },
9817 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9818 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9819 .dac_nids = alc883_dac_nids,
9820 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9821 .channel_mode = alc883_3ST_2ch_modes,
9822 .input_mux = &alc883_capture_source,
9823 .unsol_event = alc_automute_amp_unsol_event,
9824 .setup = alc883_vaiott_setup,
9825 .init_hook = alc_automute_amp,
9834 PINFIX_ABIT_AW9D_MAX
9837 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9838 { 0x15, 0x01080104 }, /* side */
9839 { 0x16, 0x01011012 }, /* rear */
9840 { 0x17, 0x01016011 }, /* clfe */
9844 static const struct alc_fixup alc882_fixups[] = {
9845 [PINFIX_ABIT_AW9D_MAX] = {
9846 .pins = alc882_abit_aw9d_pinfix
9850 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9851 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9856 * BIOS auto configuration
9858 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9859 const struct auto_pin_cfg *cfg)
9861 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9864 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9865 hda_nid_t nid, int pin_type,
9869 struct alc_spec *spec = codec->spec;
9872 alc_set_pin_output(codec, nid, pin_type);
9873 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9876 idx = spec->multiout.dac_nids[dac_idx] - 2;
9877 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9881 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9883 struct alc_spec *spec = codec->spec;
9886 for (i = 0; i <= HDA_SIDE; i++) {
9887 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9888 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9890 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9895 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9897 struct alc_spec *spec = codec->spec;
9900 pin = spec->autocfg.hp_pins[0];
9901 if (pin) /* connect to front */
9903 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9904 pin = spec->autocfg.speaker_pins[0];
9906 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9909 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9911 struct alc_spec *spec = codec->spec;
9914 for (i = 0; i < AUTO_PIN_LAST; i++) {
9915 hda_nid_t nid = spec->autocfg.input_pins[i];
9918 alc_set_input_pin(codec, nid, i);
9919 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9920 snd_hda_codec_write(codec, nid, 0,
9921 AC_VERB_SET_AMP_GAIN_MUTE,
9926 static void alc882_auto_init_input_src(struct hda_codec *codec)
9928 struct alc_spec *spec = codec->spec;
9931 for (c = 0; c < spec->num_adc_nids; c++) {
9932 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9933 hda_nid_t nid = spec->capsrc_nids[c];
9934 unsigned int mux_idx;
9935 const struct hda_input_mux *imux;
9936 int conns, mute, idx, item;
9938 conns = snd_hda_get_connections(codec, nid, conn_list,
9939 ARRAY_SIZE(conn_list));
9942 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9943 imux = &spec->input_mux[mux_idx];
9944 for (idx = 0; idx < conns; idx++) {
9945 /* if the current connection is the selected one,
9946 * unmute it as default - otherwise mute it
9948 mute = AMP_IN_MUTE(idx);
9949 for (item = 0; item < imux->num_items; item++) {
9950 if (imux->items[item].index == idx) {
9951 if (spec->cur_mux[c] == item)
9952 mute = AMP_IN_UNMUTE(idx);
9956 /* check if we have a selector or mixer
9957 * we could check for the widget type instead, but
9958 * just check for Amp-In presence (in case of mixer
9959 * without amp-in there is something wrong, this
9960 * function shouldn't be used or capsrc nid is wrong)
9962 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9963 snd_hda_codec_write(codec, nid, 0,
9964 AC_VERB_SET_AMP_GAIN_MUTE,
9966 else if (mute != AMP_IN_MUTE(idx))
9967 snd_hda_codec_write(codec, nid, 0,
9968 AC_VERB_SET_CONNECT_SEL,
9974 /* add mic boosts if needed */
9975 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9977 struct alc_spec *spec = codec->spec;
9981 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9982 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9983 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9985 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9989 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9990 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9991 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9993 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10000 /* almost identical with ALC880 parser... */
10001 static int alc882_parse_auto_config(struct hda_codec *codec)
10003 struct alc_spec *spec = codec->spec;
10004 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10007 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10011 if (!spec->autocfg.line_outs)
10012 return 0; /* can't find valid BIOS pin config */
10014 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10017 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10020 err = alc880_auto_create_extra_out(spec,
10021 spec->autocfg.speaker_pins[0],
10025 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10029 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10033 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10035 /* check multiple SPDIF-out (for recent codecs) */
10036 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10038 err = snd_hda_get_connections(codec,
10039 spec->autocfg.dig_out_pins[i],
10044 spec->multiout.dig_out_nid = dig_nid;
10046 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10047 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10049 spec->slave_dig_outs[i - 1] = dig_nid;
10052 if (spec->autocfg.dig_in_pin)
10053 spec->dig_in_nid = ALC880_DIGIN_NID;
10055 if (spec->kctls.list)
10056 add_mixer(spec, spec->kctls.list);
10058 add_verb(spec, alc883_auto_init_verbs);
10059 /* if ADC 0x07 is available, initialize it, too */
10060 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10061 add_verb(spec, alc882_adc1_init_verbs);
10063 spec->num_mux_defs = 1;
10064 spec->input_mux = &spec->private_imux[0];
10066 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10068 err = alc_auto_add_mic_boost(codec);
10072 return 1; /* config found */
10075 /* additional initialization for auto-configuration model */
10076 static void alc882_auto_init(struct hda_codec *codec)
10078 struct alc_spec *spec = codec->spec;
10079 alc882_auto_init_multi_out(codec);
10080 alc882_auto_init_hp_out(codec);
10081 alc882_auto_init_analog_input(codec);
10082 alc882_auto_init_input_src(codec);
10083 if (spec->unsol_event)
10084 alc_inithook(codec);
10087 static int patch_alc882(struct hda_codec *codec)
10089 struct alc_spec *spec;
10090 int err, board_config;
10092 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10096 codec->spec = spec;
10098 switch (codec->vendor_id) {
10103 /* ALC883 and variants */
10104 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10108 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10112 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10113 board_config = snd_hda_check_board_codec_sid_config(codec,
10114 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10116 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10117 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10119 board_config = ALC882_AUTO;
10122 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10124 if (board_config == ALC882_AUTO) {
10125 /* automatic parse from the BIOS config */
10126 err = alc882_parse_auto_config(codec);
10132 "hda_codec: Cannot set up configuration "
10133 "from BIOS. Using base mode...\n");
10134 board_config = ALC882_3ST_DIG;
10138 err = snd_hda_attach_beep_device(codec, 0x1);
10144 if (board_config != ALC882_AUTO)
10145 setup_preset(codec, &alc882_presets[board_config]);
10147 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10148 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10149 /* FIXME: setup DAC5 */
10150 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10151 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10153 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10154 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10156 if (codec->vendor_id == 0x10ec0888)
10157 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10159 if (!spec->adc_nids && spec->input_mux) {
10161 spec->num_adc_nids = 0;
10162 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10163 const struct hda_input_mux *imux = spec->input_mux;
10165 hda_nid_t items[16];
10166 hda_nid_t nid = alc882_adc_nids[i];
10167 unsigned int wcap = get_wcaps(codec, nid);
10169 wcap = get_wcaps_type(wcap);
10170 if (wcap != AC_WID_AUD_IN)
10172 spec->private_adc_nids[spec->num_adc_nids] = nid;
10173 err = snd_hda_get_connections(codec, nid, &cap, 1);
10176 err = snd_hda_get_connections(codec, cap, items,
10177 ARRAY_SIZE(items));
10180 for (j = 0; j < imux->num_items; j++)
10181 if (imux->items[j].index >= err)
10183 if (j < imux->num_items)
10185 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10186 spec->num_adc_nids++;
10188 spec->adc_nids = spec->private_adc_nids;
10189 spec->capsrc_nids = spec->private_capsrc_nids;
10192 set_capture_mixer(codec);
10193 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10195 spec->vmaster_nid = 0x0c;
10197 codec->patch_ops = alc_patch_ops;
10198 if (board_config == ALC882_AUTO)
10199 spec->init_hook = alc882_auto_init;
10200 #ifdef CONFIG_SND_HDA_POWER_SAVE
10201 if (!spec->loopback.amplist)
10202 spec->loopback.amplist = alc882_loopbacks;
10204 codec->proc_widget_hook = print_realtek_coef;
10214 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10215 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10217 #define alc262_dac_nids alc260_dac_nids
10218 #define alc262_adc_nids alc882_adc_nids
10219 #define alc262_adc_nids_alt alc882_adc_nids_alt
10220 #define alc262_capsrc_nids alc882_capsrc_nids
10221 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10223 #define alc262_modes alc260_modes
10224 #define alc262_capture_source alc882_capture_source
10226 static hda_nid_t alc262_dmic_adc_nids[1] = {
10231 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10233 static struct snd_kcontrol_new alc262_base_mixer[] = {
10234 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10235 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10236 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10237 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10238 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10239 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10241 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10242 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10243 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10244 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10245 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10246 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10248 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10249 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10253 /* update HP, line and mono-out pins according to the master switch */
10254 static void alc262_hp_master_update(struct hda_codec *codec)
10256 struct alc_spec *spec = codec->spec;
10257 int val = spec->master_sw;
10259 /* HP & line-out */
10260 snd_hda_codec_write_cache(codec, 0x1b, 0,
10261 AC_VERB_SET_PIN_WIDGET_CONTROL,
10263 snd_hda_codec_write_cache(codec, 0x15, 0,
10264 AC_VERB_SET_PIN_WIDGET_CONTROL,
10266 /* mono (speaker) depending on the HP jack sense */
10267 val = val && !spec->jack_present;
10268 snd_hda_codec_write_cache(codec, 0x16, 0,
10269 AC_VERB_SET_PIN_WIDGET_CONTROL,
10270 val ? PIN_OUT : 0);
10273 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10275 struct alc_spec *spec = codec->spec;
10277 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10278 alc262_hp_master_update(codec);
10281 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10283 if ((res >> 26) != ALC880_HP_EVENT)
10285 alc262_hp_bpc_automute(codec);
10288 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10290 struct alc_spec *spec = codec->spec;
10292 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10293 alc262_hp_master_update(codec);
10296 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10299 if ((res >> 26) != ALC880_HP_EVENT)
10301 alc262_hp_wildwest_automute(codec);
10304 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10306 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10307 struct snd_ctl_elem_value *ucontrol)
10309 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10310 struct alc_spec *spec = codec->spec;
10311 int val = !!*ucontrol->value.integer.value;
10313 if (val == spec->master_sw)
10315 spec->master_sw = val;
10316 alc262_hp_master_update(codec);
10320 #define ALC262_HP_MASTER_SWITCH \
10322 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10323 .name = "Master Playback Switch", \
10324 .info = snd_ctl_boolean_mono_info, \
10325 .get = alc262_hp_master_sw_get, \
10326 .put = alc262_hp_master_sw_put, \
10329 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10330 ALC262_HP_MASTER_SWITCH,
10331 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10332 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10333 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10334 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10336 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10339 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10340 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10341 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10342 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10343 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10344 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10345 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10346 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10347 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10348 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10349 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10353 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10354 ALC262_HP_MASTER_SWITCH,
10355 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10356 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10357 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10358 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10359 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10361 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10363 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10364 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10365 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10366 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10367 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10368 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10369 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10373 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10374 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10375 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10376 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10380 /* mute/unmute internal speaker according to the hp jack and mute state */
10381 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10383 struct alc_spec *spec = codec->spec;
10385 spec->autocfg.hp_pins[0] = 0x15;
10386 spec->autocfg.speaker_pins[0] = 0x14;
10389 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10390 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10391 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10392 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10396 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10400 static struct hda_verb alc262_hp_t5735_verbs[] = {
10401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10402 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10404 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10408 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10409 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10411 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10412 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10414 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10418 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10419 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10420 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10421 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10422 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10423 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10424 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10427 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10428 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10432 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10439 /* bind hp and internal speaker mute (with plug check) as master switch */
10440 static void alc262_hippo_master_update(struct hda_codec *codec)
10442 struct alc_spec *spec = codec->spec;
10443 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10444 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10445 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10449 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10450 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10451 HDA_AMP_MUTE, mute);
10452 /* mute internal speaker per jack sense */
10453 if (spec->jack_present)
10454 mute = HDA_AMP_MUTE;
10456 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10457 HDA_AMP_MUTE, mute);
10458 if (speaker_nid && speaker_nid != line_nid)
10459 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10460 HDA_AMP_MUTE, mute);
10463 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10465 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10466 struct snd_ctl_elem_value *ucontrol)
10468 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10469 struct alc_spec *spec = codec->spec;
10470 int val = !!*ucontrol->value.integer.value;
10472 if (val == spec->master_sw)
10474 spec->master_sw = val;
10475 alc262_hippo_master_update(codec);
10479 #define ALC262_HIPPO_MASTER_SWITCH \
10481 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10482 .name = "Master Playback Switch", \
10483 .info = snd_ctl_boolean_mono_info, \
10484 .get = alc262_hippo_master_sw_get, \
10485 .put = alc262_hippo_master_sw_put, \
10488 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10489 ALC262_HIPPO_MASTER_SWITCH,
10490 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10491 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10492 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10494 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10496 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10497 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10498 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10499 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10500 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10501 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10505 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10506 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10507 ALC262_HIPPO_MASTER_SWITCH,
10508 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10509 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10510 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10511 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10514 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10515 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10516 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10517 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10521 /* mute/unmute internal speaker according to the hp jack and mute state */
10522 static void alc262_hippo_automute(struct hda_codec *codec)
10524 struct alc_spec *spec = codec->spec;
10525 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10527 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10528 alc262_hippo_master_update(codec);
10531 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10533 if ((res >> 26) != ALC880_HP_EVENT)
10535 alc262_hippo_automute(codec);
10538 static void alc262_hippo_setup(struct hda_codec *codec)
10540 struct alc_spec *spec = codec->spec;
10542 spec->autocfg.hp_pins[0] = 0x15;
10543 spec->autocfg.speaker_pins[0] = 0x14;
10546 static void alc262_hippo1_setup(struct hda_codec *codec)
10548 struct alc_spec *spec = codec->spec;
10550 spec->autocfg.hp_pins[0] = 0x1b;
10551 spec->autocfg.speaker_pins[0] = 0x14;
10555 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10556 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10557 ALC262_HIPPO_MASTER_SWITCH,
10558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10559 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10560 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10561 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10565 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10566 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10567 ALC262_HIPPO_MASTER_SWITCH,
10568 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10569 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10570 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10571 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10572 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10576 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10577 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10578 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10579 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10580 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10581 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10582 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10585 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10586 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10587 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10588 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10592 static struct hda_verb alc262_tyan_verbs[] = {
10593 /* Headphone automute */
10594 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10596 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10598 /* P11 AUX_IN, white 4-pin connector */
10599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10600 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10601 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10602 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10607 /* unsolicited event for HP jack sensing */
10608 static void alc262_tyan_setup(struct hda_codec *codec)
10610 struct alc_spec *spec = codec->spec;
10612 spec->autocfg.hp_pins[0] = 0x1b;
10613 spec->autocfg.speaker_pins[0] = 0x15;
10617 #define alc262_capture_mixer alc882_capture_mixer
10618 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10621 * generic initialization of ADC, input mixers and output mixers
10623 static struct hda_verb alc262_init_verbs[] = {
10625 * Unmute ADC0-2 and set the default input to mic-in
10627 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10629 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10631 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10634 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10636 * Note: PASD motherboards uses the Line In 2 as the input for
10637 * front panel mic (mic 2)
10639 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10647 * Set up output mixers (0x0c - 0x0e)
10649 /* set vol=0 to output mixers */
10650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10652 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10653 /* set up input amps for analog loopback */
10654 /* Amp Indices: DAC = 0, mixer = 1 */
10655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10659 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10662 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10663 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10665 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10666 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10667 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10672 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10673 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10675 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10678 /* FIXME: use matrix-type input source selection */
10679 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10680 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10681 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10682 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10683 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10684 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10686 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10687 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10688 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10689 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10691 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10692 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10693 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10694 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10699 static struct hda_verb alc262_eapd_verbs[] = {
10700 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10701 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10705 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10706 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10707 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10708 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10710 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10711 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10715 static struct hda_verb alc262_sony_unsol_verbs[] = {
10716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10718 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10720 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10725 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10726 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10727 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10728 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10734 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10735 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10738 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10739 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10741 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10742 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10746 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10748 struct alc_spec *spec = codec->spec;
10750 spec->autocfg.hp_pins[0] = 0x15;
10751 spec->autocfg.speaker_pins[0] = 0x14;
10752 spec->ext_mic.pin = 0x18;
10753 spec->ext_mic.mux_idx = 0;
10754 spec->int_mic.pin = 0x12;
10755 spec->int_mic.mux_idx = 9;
10756 spec->auto_mic = 1;
10762 * 0x16 = internal speaker
10763 * 0x18 = external mic
10766 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10767 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10768 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10771 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10772 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10774 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10775 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10779 static struct hda_verb alc262_nec_verbs[] = {
10780 /* Unmute Speaker */
10781 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10784 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10787 /* External mic to headphone */
10788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10789 /* External mic to speaker */
10790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10796 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10797 * 0x1b = port replicator headphone out
10800 #define ALC_HP_EVENT 0x37
10802 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10803 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10805 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10810 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10811 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10812 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10816 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10817 /* Front Mic pin: input vref at 50% */
10818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10823 static struct hda_input_mux alc262_fujitsu_capture_source = {
10827 { "Int Mic", 0x1 },
10832 static struct hda_input_mux alc262_HP_capture_source = {
10836 { "Front Mic", 0x1 },
10843 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10847 { "Front Mic", 0x2 },
10853 /* mute/unmute internal speaker according to the hp jacks and mute state */
10854 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10856 struct alc_spec *spec = codec->spec;
10859 if (force || !spec->sense_updated) {
10860 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10861 snd_hda_jack_detect(codec, 0x1b);
10862 spec->sense_updated = 1;
10864 /* unmute internal speaker only if both HPs are unplugged and
10865 * master switch is on
10867 if (spec->jack_present)
10868 mute = HDA_AMP_MUTE;
10870 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10871 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10872 HDA_AMP_MUTE, mute);
10875 /* unsolicited event for HP jack sensing */
10876 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10879 if ((res >> 26) != ALC_HP_EVENT)
10881 alc262_fujitsu_automute(codec, 1);
10884 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10886 alc262_fujitsu_automute(codec, 1);
10889 /* bind volumes of both NID 0x0c and 0x0d */
10890 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10891 .ops = &snd_hda_bind_vol,
10893 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10894 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10899 /* mute/unmute internal speaker according to the hp jack and mute state */
10900 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10902 struct alc_spec *spec = codec->spec;
10905 if (force || !spec->sense_updated) {
10906 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10907 spec->sense_updated = 1;
10909 if (spec->jack_present) {
10910 /* mute internal speaker */
10911 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10912 HDA_AMP_MUTE, HDA_AMP_MUTE);
10913 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10914 HDA_AMP_MUTE, HDA_AMP_MUTE);
10916 /* unmute internal speaker if necessary */
10917 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10918 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10919 HDA_AMP_MUTE, mute);
10920 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10921 HDA_AMP_MUTE, mute);
10925 /* unsolicited event for HP jack sensing */
10926 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10929 if ((res >> 26) != ALC_HP_EVENT)
10931 alc262_lenovo_3000_automute(codec, 1);
10934 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10935 int dir, int idx, long *valp)
10939 for (i = 0; i < 2; i++, valp++)
10940 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10942 *valp ? 0 : HDA_AMP_MUTE);
10946 /* bind hp and internal speaker mute (with plug check) */
10947 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10948 struct snd_ctl_elem_value *ucontrol)
10950 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10951 long *valp = ucontrol->value.integer.value;
10954 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10955 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10957 alc262_fujitsu_automute(codec, 0);
10961 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10962 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10964 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10965 .name = "Master Playback Switch",
10966 .info = snd_hda_mixer_amp_switch_info,
10967 .get = snd_hda_mixer_amp_switch_get,
10968 .put = alc262_fujitsu_master_sw_put,
10969 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10973 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10976 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10977 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10978 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10982 /* bind hp and internal speaker mute (with plug check) */
10983 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10984 struct snd_ctl_elem_value *ucontrol)
10986 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10987 long *valp = ucontrol->value.integer.value;
10990 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10992 alc262_lenovo_3000_automute(codec, 0);
10996 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10997 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11000 .name = "Master Playback Switch",
11001 .info = snd_hda_mixer_amp_switch_info,
11002 .get = snd_hda_mixer_amp_switch_get,
11003 .put = alc262_lenovo_3000_master_sw_put,
11004 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11006 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11007 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11008 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11011 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11012 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11013 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11017 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11018 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11019 ALC262_HIPPO_MASTER_SWITCH,
11020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11022 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11023 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11024 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11025 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11029 /* additional init verbs for Benq laptops */
11030 static struct hda_verb alc262_EAPD_verbs[] = {
11031 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11032 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11036 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11037 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11038 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11040 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11041 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11045 /* Samsung Q1 Ultra Vista model setup */
11046 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11047 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11048 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11051 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11052 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11056 static struct hda_verb alc262_ultra_verbs[] = {
11058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11063 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11064 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11065 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11067 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11070 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11073 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11074 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11075 /* ADC, choose mic */
11076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11077 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11089 /* mute/unmute internal speaker according to the hp jack and mute state */
11090 static void alc262_ultra_automute(struct hda_codec *codec)
11092 struct alc_spec *spec = codec->spec;
11096 /* auto-mute only when HP is used as HP */
11097 if (!spec->cur_mux[0]) {
11098 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11099 if (spec->jack_present)
11100 mute = HDA_AMP_MUTE;
11102 /* mute/unmute internal speaker */
11103 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11104 HDA_AMP_MUTE, mute);
11105 /* mute/unmute HP */
11106 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11107 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11110 /* unsolicited event for HP jack sensing */
11111 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11114 if ((res >> 26) != ALC880_HP_EVENT)
11116 alc262_ultra_automute(codec);
11119 static struct hda_input_mux alc262_ultra_capture_source = {
11123 { "Headphone", 0x7 },
11127 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11128 struct snd_ctl_elem_value *ucontrol)
11130 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11131 struct alc_spec *spec = codec->spec;
11134 ret = alc_mux_enum_put(kcontrol, ucontrol);
11137 /* reprogram the HP pin as mic or HP according to the input source */
11138 snd_hda_codec_write_cache(codec, 0x15, 0,
11139 AC_VERB_SET_PIN_WIDGET_CONTROL,
11140 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11141 alc262_ultra_automute(codec); /* mute/unmute HP */
11145 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11146 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11147 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11150 .name = "Capture Source",
11151 .info = alc_mux_enum_info,
11152 .get = alc_mux_enum_get,
11153 .put = alc262_ultra_mux_enum_put,
11158 /* We use two mixers depending on the output pin; 0x16 is a mono output
11159 * and thus it's bound with a different mixer.
11160 * This function returns which mixer amp should be used.
11162 static int alc262_check_volbit(hda_nid_t nid)
11166 else if (nid == 0x16)
11172 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11173 const char *pfx, int *vbits)
11178 vbit = alc262_check_volbit(nid);
11181 if (*vbits & vbit) /* a volume control for this mixer already there */
11185 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11187 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11188 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11191 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11199 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11201 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11202 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11205 /* add playback controls from the parsed DAC table */
11206 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11207 const struct auto_pin_cfg *cfg)
11213 spec->multiout.num_dacs = 1; /* only use one dac */
11214 spec->multiout.dac_nids = spec->private_dac_nids;
11215 spec->multiout.dac_nids[0] = 2;
11217 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11219 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11223 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11226 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11229 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11233 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11234 alc262_check_volbit(cfg->speaker_pins[0]) |
11235 alc262_check_volbit(cfg->hp_pins[0]);
11236 if (vbits == 1 || vbits == 2)
11237 pfx = "Master"; /* only one mixer is used */
11238 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11243 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11246 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11250 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11257 #define alc262_auto_create_input_ctls \
11258 alc882_auto_create_input_ctls
11261 * generic initialization of ADC, input mixers and output mixers
11263 static struct hda_verb alc262_volume_init_verbs[] = {
11265 * Unmute ADC0-2 and set the default input to mic-in
11267 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11268 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11269 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11270 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11271 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11274 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11276 * Note: PASD motherboards uses the Line In 2 as the input for
11277 * front panel mic (mic 2)
11279 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11280 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11287 * Set up output mixers (0x0c - 0x0f)
11289 /* set vol=0 to output mixers */
11290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11291 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11294 /* set up input amps for analog loopback */
11295 /* Amp Indices: DAC = 0, mixer = 1 */
11296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11297 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11299 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11301 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11303 /* FIXME: use matrix-type input source selection */
11304 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11305 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11307 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11308 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11309 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11312 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11313 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11314 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11324 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11326 * Unmute ADC0-2 and set the default input to mic-in
11328 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11330 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11331 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11332 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11333 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11335 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11337 * Note: PASD motherboards uses the Line In 2 as the input for
11338 * front panel mic (mic 2)
11340 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11347 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11350 * Set up output mixers (0x0c - 0x0e)
11352 /* set vol=0 to output mixers */
11353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11357 /* set up input amps for analog loopback */
11358 /* Amp Indices: DAC = 0, mixer = 1 */
11359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11362 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11363 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11364 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11366 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11367 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11368 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11370 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11371 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11373 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11374 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11377 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11378 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11379 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11380 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11382 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11383 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11384 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11385 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11386 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11387 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11390 /* FIXME: use matrix-type input source selection */
11391 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11392 /* Input mixer1: only unmute Mic */
11393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11410 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11418 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11423 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11428 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11430 * Unmute ADC0-2 and set the default input to mic-in
11432 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11434 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11435 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11436 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11437 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11439 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11441 * Note: PASD motherboards uses the Line In 2 as the input for front
11442 * panel mic (mic 2)
11444 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11454 * Set up output mixers (0x0c - 0x0e)
11456 /* set vol=0 to output mixers */
11457 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11458 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11461 /* set up input amps for analog loopback */
11462 /* Amp Indices: DAC = 0, mixer = 1 */
11463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11471 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11472 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11473 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11474 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11475 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11476 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11477 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11479 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11480 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11482 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11483 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11485 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11486 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11487 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11488 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11489 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11490 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11492 /* FIXME: use matrix-type input source selection */
11493 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11494 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11495 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11497 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11500 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11501 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11505 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11506 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11507 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11508 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11516 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11517 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11519 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11524 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11528 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11530 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11531 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11532 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11533 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11535 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11536 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11537 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11542 #ifdef CONFIG_SND_HDA_POWER_SAVE
11543 #define alc262_loopbacks alc880_loopbacks
11546 /* pcm configuration: identical with ALC880 */
11547 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11548 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11549 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11550 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11553 * BIOS auto configuration
11555 static int alc262_parse_auto_config(struct hda_codec *codec)
11557 struct alc_spec *spec = codec->spec;
11559 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11561 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11565 if (!spec->autocfg.line_outs) {
11566 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11567 spec->multiout.max_channels = 2;
11568 spec->no_analog = 1;
11571 return 0; /* can't find valid BIOS pin config */
11573 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11576 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11580 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11583 if (spec->autocfg.dig_outs) {
11584 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11585 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11587 if (spec->autocfg.dig_in_pin)
11588 spec->dig_in_nid = ALC262_DIGIN_NID;
11590 if (spec->kctls.list)
11591 add_mixer(spec, spec->kctls.list);
11593 add_verb(spec, alc262_volume_init_verbs);
11594 spec->num_mux_defs = 1;
11595 spec->input_mux = &spec->private_imux[0];
11597 err = alc_auto_add_mic_boost(codec);
11601 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11606 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11607 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11608 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11609 #define alc262_auto_init_input_src alc882_auto_init_input_src
11612 /* init callback for auto-configuration model -- overriding the default init */
11613 static void alc262_auto_init(struct hda_codec *codec)
11615 struct alc_spec *spec = codec->spec;
11616 alc262_auto_init_multi_out(codec);
11617 alc262_auto_init_hp_out(codec);
11618 alc262_auto_init_analog_input(codec);
11619 alc262_auto_init_input_src(codec);
11620 if (spec->unsol_event)
11621 alc_inithook(codec);
11625 * configuration and preset
11627 static const char *alc262_models[ALC262_MODEL_LAST] = {
11628 [ALC262_BASIC] = "basic",
11629 [ALC262_HIPPO] = "hippo",
11630 [ALC262_HIPPO_1] = "hippo_1",
11631 [ALC262_FUJITSU] = "fujitsu",
11632 [ALC262_HP_BPC] = "hp-bpc",
11633 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11634 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11635 [ALC262_HP_RP5700] = "hp-rp5700",
11636 [ALC262_BENQ_ED8] = "benq",
11637 [ALC262_BENQ_T31] = "benq-t31",
11638 [ALC262_SONY_ASSAMD] = "sony-assamd",
11639 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11640 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11641 [ALC262_ULTRA] = "ultra",
11642 [ALC262_LENOVO_3000] = "lenovo-3000",
11643 [ALC262_NEC] = "nec",
11644 [ALC262_TYAN] = "tyan",
11645 [ALC262_AUTO] = "auto",
11648 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11649 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11650 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11651 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11653 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11655 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11657 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11658 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11659 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11660 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11661 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11662 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11663 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11664 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11665 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11666 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11667 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11668 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11669 ALC262_HP_TC_T5735),
11670 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11671 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11672 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11673 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11674 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11675 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11676 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11677 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11678 #if 0 /* disable the quirk since model=auto works better in recent versions */
11679 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11680 ALC262_SONY_ASSAMD),
11682 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11683 ALC262_TOSHIBA_RX1),
11684 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11685 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11686 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11687 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11688 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11690 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11691 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11692 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11693 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11694 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11698 static struct alc_config_preset alc262_presets[] = {
11700 .mixers = { alc262_base_mixer },
11701 .init_verbs = { alc262_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_capture_source,
11710 .mixers = { alc262_hippo_mixer },
11711 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11712 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11713 .dac_nids = alc262_dac_nids,
11715 .dig_out_nid = ALC262_DIGOUT_NID,
11716 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11717 .channel_mode = alc262_modes,
11718 .input_mux = &alc262_capture_source,
11719 .unsol_event = alc262_hippo_unsol_event,
11720 .setup = alc262_hippo_setup,
11721 .init_hook = alc262_hippo_automute,
11723 [ALC262_HIPPO_1] = {
11724 .mixers = { alc262_hippo1_mixer },
11725 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11726 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11727 .dac_nids = alc262_dac_nids,
11729 .dig_out_nid = ALC262_DIGOUT_NID,
11730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11731 .channel_mode = alc262_modes,
11732 .input_mux = &alc262_capture_source,
11733 .unsol_event = alc262_hippo_unsol_event,
11734 .setup = alc262_hippo1_setup,
11735 .init_hook = alc262_hippo_automute,
11737 [ALC262_FUJITSU] = {
11738 .mixers = { alc262_fujitsu_mixer },
11739 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11740 alc262_fujitsu_unsol_verbs },
11741 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11742 .dac_nids = alc262_dac_nids,
11744 .dig_out_nid = ALC262_DIGOUT_NID,
11745 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11746 .channel_mode = alc262_modes,
11747 .input_mux = &alc262_fujitsu_capture_source,
11748 .unsol_event = alc262_fujitsu_unsol_event,
11749 .init_hook = alc262_fujitsu_init_hook,
11751 [ALC262_HP_BPC] = {
11752 .mixers = { alc262_HP_BPC_mixer },
11753 .init_verbs = { alc262_HP_BPC_init_verbs },
11754 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11755 .dac_nids = alc262_dac_nids,
11757 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11758 .channel_mode = alc262_modes,
11759 .input_mux = &alc262_HP_capture_source,
11760 .unsol_event = alc262_hp_bpc_unsol_event,
11761 .init_hook = alc262_hp_bpc_automute,
11763 [ALC262_HP_BPC_D7000_WF] = {
11764 .mixers = { alc262_HP_BPC_WildWest_mixer },
11765 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11766 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11767 .dac_nids = alc262_dac_nids,
11769 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11770 .channel_mode = alc262_modes,
11771 .input_mux = &alc262_HP_D7000_capture_source,
11772 .unsol_event = alc262_hp_wildwest_unsol_event,
11773 .init_hook = alc262_hp_wildwest_automute,
11775 [ALC262_HP_BPC_D7000_WL] = {
11776 .mixers = { alc262_HP_BPC_WildWest_mixer,
11777 alc262_HP_BPC_WildWest_option_mixer },
11778 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11779 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11780 .dac_nids = alc262_dac_nids,
11782 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11783 .channel_mode = alc262_modes,
11784 .input_mux = &alc262_HP_D7000_capture_source,
11785 .unsol_event = alc262_hp_wildwest_unsol_event,
11786 .init_hook = alc262_hp_wildwest_automute,
11788 [ALC262_HP_TC_T5735] = {
11789 .mixers = { alc262_hp_t5735_mixer },
11790 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11792 .dac_nids = alc262_dac_nids,
11794 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11795 .channel_mode = alc262_modes,
11796 .input_mux = &alc262_capture_source,
11797 .unsol_event = alc_sku_unsol_event,
11798 .setup = alc262_hp_t5735_setup,
11799 .init_hook = alc_inithook,
11801 [ALC262_HP_RP5700] = {
11802 .mixers = { alc262_hp_rp5700_mixer },
11803 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11804 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11805 .dac_nids = alc262_dac_nids,
11806 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11807 .channel_mode = alc262_modes,
11808 .input_mux = &alc262_hp_rp5700_capture_source,
11810 [ALC262_BENQ_ED8] = {
11811 .mixers = { alc262_base_mixer },
11812 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11813 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11814 .dac_nids = alc262_dac_nids,
11816 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11817 .channel_mode = alc262_modes,
11818 .input_mux = &alc262_capture_source,
11820 [ALC262_SONY_ASSAMD] = {
11821 .mixers = { alc262_sony_mixer },
11822 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11823 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11824 .dac_nids = alc262_dac_nids,
11826 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11827 .channel_mode = alc262_modes,
11828 .input_mux = &alc262_capture_source,
11829 .unsol_event = alc262_hippo_unsol_event,
11830 .setup = alc262_hippo_setup,
11831 .init_hook = alc262_hippo_automute,
11833 [ALC262_BENQ_T31] = {
11834 .mixers = { alc262_benq_t31_mixer },
11835 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11836 alc_hp15_unsol_verbs },
11837 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11838 .dac_nids = alc262_dac_nids,
11840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11841 .channel_mode = alc262_modes,
11842 .input_mux = &alc262_capture_source,
11843 .unsol_event = alc262_hippo_unsol_event,
11844 .setup = alc262_hippo_setup,
11845 .init_hook = alc262_hippo_automute,
11848 .mixers = { alc262_ultra_mixer },
11849 .cap_mixer = alc262_ultra_capture_mixer,
11850 .init_verbs = { alc262_ultra_verbs },
11851 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11852 .dac_nids = alc262_dac_nids,
11853 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11854 .channel_mode = alc262_modes,
11855 .input_mux = &alc262_ultra_capture_source,
11856 .adc_nids = alc262_adc_nids, /* ADC0 */
11857 .capsrc_nids = alc262_capsrc_nids,
11858 .num_adc_nids = 1, /* single ADC */
11859 .unsol_event = alc262_ultra_unsol_event,
11860 .init_hook = alc262_ultra_automute,
11862 [ALC262_LENOVO_3000] = {
11863 .mixers = { alc262_lenovo_3000_mixer },
11864 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11865 alc262_lenovo_3000_unsol_verbs,
11866 alc262_lenovo_3000_init_verbs },
11867 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11868 .dac_nids = alc262_dac_nids,
11870 .dig_out_nid = ALC262_DIGOUT_NID,
11871 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11872 .channel_mode = alc262_modes,
11873 .input_mux = &alc262_fujitsu_capture_source,
11874 .unsol_event = alc262_lenovo_3000_unsol_event,
11877 .mixers = { alc262_nec_mixer },
11878 .init_verbs = { alc262_nec_verbs },
11879 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11880 .dac_nids = alc262_dac_nids,
11882 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11883 .channel_mode = alc262_modes,
11884 .input_mux = &alc262_capture_source,
11886 [ALC262_TOSHIBA_S06] = {
11887 .mixers = { alc262_toshiba_s06_mixer },
11888 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11889 alc262_eapd_verbs },
11890 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11891 .capsrc_nids = alc262_dmic_capsrc_nids,
11892 .dac_nids = alc262_dac_nids,
11893 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11894 .num_adc_nids = 1, /* single ADC */
11895 .dig_out_nid = ALC262_DIGOUT_NID,
11896 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11897 .channel_mode = alc262_modes,
11898 .unsol_event = alc_sku_unsol_event,
11899 .setup = alc262_toshiba_s06_setup,
11900 .init_hook = alc_inithook,
11902 [ALC262_TOSHIBA_RX1] = {
11903 .mixers = { alc262_toshiba_rx1_mixer },
11904 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11905 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11906 .dac_nids = alc262_dac_nids,
11908 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11909 .channel_mode = alc262_modes,
11910 .input_mux = &alc262_capture_source,
11911 .unsol_event = alc262_hippo_unsol_event,
11912 .setup = alc262_hippo_setup,
11913 .init_hook = alc262_hippo_automute,
11916 .mixers = { alc262_tyan_mixer },
11917 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11918 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11919 .dac_nids = alc262_dac_nids,
11921 .dig_out_nid = ALC262_DIGOUT_NID,
11922 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11923 .channel_mode = alc262_modes,
11924 .input_mux = &alc262_capture_source,
11925 .unsol_event = alc_automute_amp_unsol_event,
11926 .setup = alc262_tyan_setup,
11927 .init_hook = alc_automute_amp,
11931 static int patch_alc262(struct hda_codec *codec)
11933 struct alc_spec *spec;
11937 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11941 codec->spec = spec;
11943 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11948 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11949 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11950 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11951 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11955 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11957 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11961 if (board_config < 0) {
11962 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11964 board_config = ALC262_AUTO;
11967 if (board_config == ALC262_AUTO) {
11968 /* automatic parse from the BIOS config */
11969 err = alc262_parse_auto_config(codec);
11975 "hda_codec: Cannot set up configuration "
11976 "from BIOS. Using base mode...\n");
11977 board_config = ALC262_BASIC;
11981 if (!spec->no_analog) {
11982 err = snd_hda_attach_beep_device(codec, 0x1);
11989 if (board_config != ALC262_AUTO)
11990 setup_preset(codec, &alc262_presets[board_config]);
11992 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11993 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11995 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11996 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11998 if (!spec->adc_nids && spec->input_mux) {
12000 /* check whether the digital-mic has to be supported */
12001 for (i = 0; i < spec->input_mux->num_items; i++) {
12002 if (spec->input_mux->items[i].index >= 9)
12005 if (i < spec->input_mux->num_items) {
12006 /* use only ADC0 */
12007 spec->adc_nids = alc262_dmic_adc_nids;
12008 spec->num_adc_nids = 1;
12009 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12011 /* all analog inputs */
12012 /* check whether NID 0x07 is valid */
12013 unsigned int wcap = get_wcaps(codec, 0x07);
12016 wcap = get_wcaps_type(wcap);
12017 if (wcap != AC_WID_AUD_IN) {
12018 spec->adc_nids = alc262_adc_nids_alt;
12019 spec->num_adc_nids =
12020 ARRAY_SIZE(alc262_adc_nids_alt);
12021 spec->capsrc_nids = alc262_capsrc_nids_alt;
12023 spec->adc_nids = alc262_adc_nids;
12024 spec->num_adc_nids =
12025 ARRAY_SIZE(alc262_adc_nids);
12026 spec->capsrc_nids = alc262_capsrc_nids;
12030 if (!spec->cap_mixer && !spec->no_analog)
12031 set_capture_mixer(codec);
12032 if (!spec->no_analog)
12033 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12035 spec->vmaster_nid = 0x0c;
12037 codec->patch_ops = alc_patch_ops;
12038 if (board_config == ALC262_AUTO)
12039 spec->init_hook = alc262_auto_init;
12040 #ifdef CONFIG_SND_HDA_POWER_SAVE
12041 if (!spec->loopback.amplist)
12042 spec->loopback.amplist = alc262_loopbacks;
12044 codec->proc_widget_hook = print_realtek_coef;
12050 * ALC268 channel source setting (2 channel)
12052 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12053 #define alc268_modes alc260_modes
12055 static hda_nid_t alc268_dac_nids[2] = {
12060 static hda_nid_t alc268_adc_nids[2] = {
12065 static hda_nid_t alc268_adc_nids_alt[1] = {
12070 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12072 static struct snd_kcontrol_new alc268_base_mixer[] = {
12073 /* output mixer control */
12074 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12075 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12076 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12077 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12078 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12079 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12080 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12084 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12085 /* output mixer control */
12086 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12087 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12088 ALC262_HIPPO_MASTER_SWITCH,
12089 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12090 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12091 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12095 /* bind Beep switches of both NID 0x0f and 0x10 */
12096 static struct hda_bind_ctls alc268_bind_beep_sw = {
12097 .ops = &snd_hda_bind_sw,
12099 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12100 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12105 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12106 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12107 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12111 static struct hda_verb alc268_eapd_verbs[] = {
12112 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12113 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12117 /* Toshiba specific */
12118 static struct hda_verb alc268_toshiba_verbs[] = {
12119 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12123 /* Acer specific */
12124 /* bind volumes of both NID 0x02 and 0x03 */
12125 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12126 .ops = &snd_hda_bind_vol,
12128 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12129 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12134 /* mute/unmute internal speaker according to the hp jack and mute state */
12135 static void alc268_acer_automute(struct hda_codec *codec, int force)
12137 struct alc_spec *spec = codec->spec;
12140 if (force || !spec->sense_updated) {
12141 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12142 spec->sense_updated = 1;
12144 if (spec->jack_present)
12145 mute = HDA_AMP_MUTE; /* mute internal speaker */
12146 else /* unmute internal speaker if necessary */
12147 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12148 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12149 HDA_AMP_MUTE, mute);
12153 /* bind hp and internal speaker mute (with plug check) */
12154 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12155 struct snd_ctl_elem_value *ucontrol)
12157 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12158 long *valp = ucontrol->value.integer.value;
12161 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12163 alc268_acer_automute(codec, 0);
12167 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12168 /* output mixer control */
12169 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12171 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12172 .name = "Master Playback Switch",
12173 .info = snd_hda_mixer_amp_switch_info,
12174 .get = snd_hda_mixer_amp_switch_get,
12175 .put = alc268_acer_master_sw_put,
12176 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12178 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12182 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12183 /* output mixer control */
12184 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12186 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12187 .name = "Master Playback Switch",
12188 .info = snd_hda_mixer_amp_switch_info,
12189 .get = snd_hda_mixer_amp_switch_get,
12190 .put = alc268_acer_master_sw_put,
12191 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12193 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12194 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12195 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12199 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12200 /* output mixer control */
12201 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12203 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12204 .name = "Master Playback Switch",
12205 .info = snd_hda_mixer_amp_switch_info,
12206 .get = snd_hda_mixer_amp_switch_get,
12207 .put = alc268_acer_master_sw_put,
12208 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12210 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12211 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12215 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12216 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12218 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12219 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12220 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12221 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12225 static struct hda_verb alc268_acer_verbs[] = {
12226 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12227 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12228 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12229 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12230 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12231 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12232 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12236 /* unsolicited event for HP jack sensing */
12237 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12238 #define alc268_toshiba_setup alc262_hippo_setup
12239 #define alc268_toshiba_automute alc262_hippo_automute
12241 static void alc268_acer_unsol_event(struct hda_codec *codec,
12244 if ((res >> 26) != ALC880_HP_EVENT)
12246 alc268_acer_automute(codec, 1);
12249 static void alc268_acer_init_hook(struct hda_codec *codec)
12251 alc268_acer_automute(codec, 1);
12254 /* toggle speaker-output according to the hp-jack state */
12255 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12257 unsigned int present;
12258 unsigned char bits;
12260 present = snd_hda_jack_detect(codec, 0x15);
12261 bits = present ? AMP_IN_MUTE(0) : 0;
12262 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12263 AMP_IN_MUTE(0), bits);
12264 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12265 AMP_IN_MUTE(0), bits);
12268 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12271 switch (res >> 26) {
12272 case ALC880_HP_EVENT:
12273 alc268_aspire_one_speaker_automute(codec);
12275 case ALC880_MIC_EVENT:
12276 alc_mic_automute(codec);
12281 static void alc268_acer_lc_setup(struct hda_codec *codec)
12283 struct alc_spec *spec = codec->spec;
12284 spec->ext_mic.pin = 0x18;
12285 spec->ext_mic.mux_idx = 0;
12286 spec->int_mic.pin = 0x12;
12287 spec->int_mic.mux_idx = 6;
12288 spec->auto_mic = 1;
12291 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12293 alc268_aspire_one_speaker_automute(codec);
12294 alc_mic_automute(codec);
12297 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12298 /* output mixer control */
12299 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12300 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12301 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12302 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12303 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12304 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12308 static struct hda_verb alc268_dell_verbs[] = {
12309 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12311 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12312 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12316 /* mute/unmute internal speaker according to the hp jack and mute state */
12317 static void alc268_dell_setup(struct hda_codec *codec)
12319 struct alc_spec *spec = codec->spec;
12321 spec->autocfg.hp_pins[0] = 0x15;
12322 spec->autocfg.speaker_pins[0] = 0x14;
12323 spec->ext_mic.pin = 0x18;
12324 spec->ext_mic.mux_idx = 0;
12325 spec->int_mic.pin = 0x19;
12326 spec->int_mic.mux_idx = 1;
12327 spec->auto_mic = 1;
12330 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12331 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12332 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12333 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12335 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12336 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12337 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12338 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12342 static struct hda_verb alc267_quanta_il1_verbs[] = {
12343 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12344 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12348 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12350 struct alc_spec *spec = codec->spec;
12351 spec->autocfg.hp_pins[0] = 0x15;
12352 spec->autocfg.speaker_pins[0] = 0x14;
12353 spec->ext_mic.pin = 0x18;
12354 spec->ext_mic.mux_idx = 0;
12355 spec->int_mic.pin = 0x19;
12356 spec->int_mic.mux_idx = 1;
12357 spec->auto_mic = 1;
12361 * generic initialization of ADC, input mixers and output mixers
12363 static struct hda_verb alc268_base_init_verbs[] = {
12364 /* Unmute DAC0-1 and set vol = 0 */
12365 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12366 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12369 * Set up output mixers (0x0c - 0x0e)
12371 /* set vol=0 to output mixers */
12372 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12373 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12375 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12376 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12378 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12380 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12382 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12383 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12384 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12385 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12389 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12390 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12391 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12393 /* set PCBEEP vol = 0, mute connections */
12394 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12395 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12396 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12398 /* Unmute Selector 23h,24h and set the default input to mic-in */
12400 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12402 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12409 * generic initialization of ADC, input mixers and output mixers
12411 static struct hda_verb alc268_volume_init_verbs[] = {
12412 /* set output DAC */
12413 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12414 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12416 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12417 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12418 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12419 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12420 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12423 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12424 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12426 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12427 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12429 /* set PCBEEP vol = 0, mute connections */
12430 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12431 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12432 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12437 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12438 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12439 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12443 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12444 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12445 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12450 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12451 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12452 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12453 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12454 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12459 static struct hda_input_mux alc268_capture_source = {
12463 { "Front Mic", 0x1 },
12469 static struct hda_input_mux alc268_acer_capture_source = {
12473 { "Internal Mic", 0x1 },
12478 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12482 { "Internal Mic", 0x6 },
12487 #ifdef CONFIG_SND_DEBUG
12488 static struct snd_kcontrol_new alc268_test_mixer[] = {
12489 /* Volume widgets */
12490 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12491 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12492 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12493 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12494 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12495 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12496 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12497 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12498 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12499 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12500 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12501 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12502 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12503 /* The below appears problematic on some hardwares */
12504 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12505 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12506 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12507 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12508 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12510 /* Modes for retasking pin widgets */
12511 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12512 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12513 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12514 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12516 /* Controls for GPIO pins, assuming they are configured as outputs */
12517 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12518 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12519 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12520 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12522 /* Switches to allow the digital SPDIF output pin to be enabled.
12523 * The ALC268 does not have an SPDIF input.
12525 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12527 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12528 * this output to turn on an external amplifier.
12530 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12531 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12537 /* create input playback/capture controls for the given pin */
12538 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12539 const char *ctlname, int idx)
12556 if (spec->multiout.dac_nids[0] != dac &&
12557 spec->multiout.dac_nids[1] != dac) {
12558 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12559 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12563 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12567 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12568 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12570 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12571 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12577 /* add playback controls from the parsed DAC table */
12578 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12579 const struct auto_pin_cfg *cfg)
12584 spec->multiout.dac_nids = spec->private_dac_nids;
12586 nid = cfg->line_out_pins[0];
12589 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12593 err = alc268_new_analog_output(spec, nid, name, 0);
12598 nid = cfg->speaker_pins[0];
12600 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12601 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12605 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12609 nid = cfg->hp_pins[0];
12611 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12616 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12618 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12619 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12626 /* create playback/capture controls for input pins */
12627 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12628 const struct auto_pin_cfg *cfg)
12630 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12633 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12634 hda_nid_t nid, int pin_type)
12638 alc_set_pin_output(codec, nid, pin_type);
12639 if (nid == 0x14 || nid == 0x16)
12643 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12646 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12648 struct alc_spec *spec = codec->spec;
12649 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12651 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12652 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12656 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12658 struct alc_spec *spec = codec->spec;
12661 pin = spec->autocfg.hp_pins[0];
12663 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12664 pin = spec->autocfg.speaker_pins[0];
12666 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12669 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12671 struct alc_spec *spec = codec->spec;
12672 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12673 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12674 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12675 unsigned int dac_vol1, dac_vol2;
12677 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12678 snd_hda_codec_write(codec, speaker_nid, 0,
12679 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12680 /* mute mixer inputs from 0x1d */
12681 snd_hda_codec_write(codec, 0x0f, 0,
12682 AC_VERB_SET_AMP_GAIN_MUTE,
12684 snd_hda_codec_write(codec, 0x10, 0,
12685 AC_VERB_SET_AMP_GAIN_MUTE,
12688 /* unmute mixer inputs from 0x1d */
12689 snd_hda_codec_write(codec, 0x0f, 0,
12690 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12691 snd_hda_codec_write(codec, 0x10, 0,
12692 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12695 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12696 if (line_nid == 0x14)
12697 dac_vol2 = AMP_OUT_ZERO;
12698 else if (line_nid == 0x15)
12699 dac_vol1 = AMP_OUT_ZERO;
12700 if (hp_nid == 0x14)
12701 dac_vol2 = AMP_OUT_ZERO;
12702 else if (hp_nid == 0x15)
12703 dac_vol1 = AMP_OUT_ZERO;
12704 if (line_nid != 0x16 || hp_nid != 0x16 ||
12705 spec->autocfg.line_out_pins[1] != 0x16 ||
12706 spec->autocfg.line_out_pins[2] != 0x16)
12707 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12709 snd_hda_codec_write(codec, 0x02, 0,
12710 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12711 snd_hda_codec_write(codec, 0x03, 0,
12712 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12715 /* pcm configuration: identical with ALC880 */
12716 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12717 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12718 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12719 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12722 * BIOS auto configuration
12724 static int alc268_parse_auto_config(struct hda_codec *codec)
12726 struct alc_spec *spec = codec->spec;
12728 static hda_nid_t alc268_ignore[] = { 0 };
12730 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12734 if (!spec->autocfg.line_outs) {
12735 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12736 spec->multiout.max_channels = 2;
12737 spec->no_analog = 1;
12740 return 0; /* can't find valid BIOS pin config */
12742 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12745 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12749 spec->multiout.max_channels = 2;
12752 /* digital only support output */
12753 if (spec->autocfg.dig_outs) {
12754 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12755 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12757 if (spec->kctls.list)
12758 add_mixer(spec, spec->kctls.list);
12760 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12761 add_mixer(spec, alc268_beep_mixer);
12763 add_verb(spec, alc268_volume_init_verbs);
12764 spec->num_mux_defs = 2;
12765 spec->input_mux = &spec->private_imux[0];
12767 err = alc_auto_add_mic_boost(codec);
12771 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12776 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12778 /* init callback for auto-configuration model -- overriding the default init */
12779 static void alc268_auto_init(struct hda_codec *codec)
12781 struct alc_spec *spec = codec->spec;
12782 alc268_auto_init_multi_out(codec);
12783 alc268_auto_init_hp_out(codec);
12784 alc268_auto_init_mono_speaker_out(codec);
12785 alc268_auto_init_analog_input(codec);
12786 if (spec->unsol_event)
12787 alc_inithook(codec);
12791 * configuration and preset
12793 static const char *alc268_models[ALC268_MODEL_LAST] = {
12794 [ALC267_QUANTA_IL1] = "quanta-il1",
12795 [ALC268_3ST] = "3stack",
12796 [ALC268_TOSHIBA] = "toshiba",
12797 [ALC268_ACER] = "acer",
12798 [ALC268_ACER_DMIC] = "acer-dmic",
12799 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12800 [ALC268_DELL] = "dell",
12801 [ALC268_ZEPTO] = "zepto",
12802 #ifdef CONFIG_SND_DEBUG
12803 [ALC268_TEST] = "test",
12805 [ALC268_AUTO] = "auto",
12808 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12809 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12810 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12811 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12812 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12813 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12814 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12815 ALC268_ACER_ASPIRE_ONE),
12816 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12817 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12818 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12819 /* almost compatible with toshiba but with optional digital outs;
12820 * auto-probing seems working fine
12822 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12824 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12825 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12826 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12827 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12828 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12829 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12833 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12834 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12835 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12836 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12837 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12842 static struct alc_config_preset alc268_presets[] = {
12843 [ALC267_QUANTA_IL1] = {
12844 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12845 alc268_capture_nosrc_mixer },
12846 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12847 alc267_quanta_il1_verbs },
12848 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12849 .dac_nids = alc268_dac_nids,
12850 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12851 .adc_nids = alc268_adc_nids_alt,
12853 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12854 .channel_mode = alc268_modes,
12855 .unsol_event = alc_sku_unsol_event,
12856 .setup = alc267_quanta_il1_setup,
12857 .init_hook = alc_inithook,
12860 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12861 alc268_beep_mixer },
12862 .init_verbs = { alc268_base_init_verbs },
12863 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12864 .dac_nids = alc268_dac_nids,
12865 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12866 .adc_nids = alc268_adc_nids_alt,
12867 .capsrc_nids = alc268_capsrc_nids,
12869 .dig_out_nid = ALC268_DIGOUT_NID,
12870 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12871 .channel_mode = alc268_modes,
12872 .input_mux = &alc268_capture_source,
12874 [ALC268_TOSHIBA] = {
12875 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12876 alc268_beep_mixer },
12877 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12878 alc268_toshiba_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 .input_mux = &alc268_capture_source,
12888 .unsol_event = alc268_toshiba_unsol_event,
12889 .setup = alc268_toshiba_setup,
12890 .init_hook = alc268_toshiba_automute,
12893 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12894 alc268_beep_mixer },
12895 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12896 alc268_acer_verbs },
12897 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12898 .dac_nids = alc268_dac_nids,
12899 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12900 .adc_nids = alc268_adc_nids_alt,
12901 .capsrc_nids = alc268_capsrc_nids,
12903 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12904 .channel_mode = alc268_modes,
12905 .input_mux = &alc268_acer_capture_source,
12906 .unsol_event = alc268_acer_unsol_event,
12907 .init_hook = alc268_acer_init_hook,
12909 [ALC268_ACER_DMIC] = {
12910 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12911 alc268_beep_mixer },
12912 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12913 alc268_acer_verbs },
12914 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12915 .dac_nids = alc268_dac_nids,
12916 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12917 .adc_nids = alc268_adc_nids_alt,
12918 .capsrc_nids = alc268_capsrc_nids,
12920 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12921 .channel_mode = alc268_modes,
12922 .input_mux = &alc268_acer_dmic_capture_source,
12923 .unsol_event = alc268_acer_unsol_event,
12924 .init_hook = alc268_acer_init_hook,
12926 [ALC268_ACER_ASPIRE_ONE] = {
12927 .mixers = { alc268_acer_aspire_one_mixer,
12929 alc268_capture_nosrc_mixer },
12930 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12931 alc268_acer_aspire_one_verbs },
12932 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12933 .dac_nids = alc268_dac_nids,
12934 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12935 .adc_nids = alc268_adc_nids_alt,
12936 .capsrc_nids = alc268_capsrc_nids,
12938 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12939 .channel_mode = alc268_modes,
12940 .unsol_event = alc268_acer_lc_unsol_event,
12941 .setup = alc268_acer_lc_setup,
12942 .init_hook = alc268_acer_lc_init_hook,
12945 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12946 alc268_capture_nosrc_mixer },
12947 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12948 alc268_dell_verbs },
12949 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12950 .dac_nids = alc268_dac_nids,
12951 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12952 .adc_nids = alc268_adc_nids_alt,
12953 .capsrc_nids = alc268_capsrc_nids,
12955 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12956 .channel_mode = alc268_modes,
12957 .unsol_event = alc_sku_unsol_event,
12958 .setup = alc268_dell_setup,
12959 .init_hook = alc_inithook,
12962 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12963 alc268_beep_mixer },
12964 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12965 alc268_toshiba_verbs },
12966 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12967 .dac_nids = alc268_dac_nids,
12968 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12969 .adc_nids = alc268_adc_nids_alt,
12970 .capsrc_nids = alc268_capsrc_nids,
12972 .dig_out_nid = ALC268_DIGOUT_NID,
12973 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12974 .channel_mode = alc268_modes,
12975 .input_mux = &alc268_capture_source,
12976 .setup = alc268_toshiba_setup,
12977 .init_hook = alc268_toshiba_automute,
12979 #ifdef CONFIG_SND_DEBUG
12981 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12982 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12983 alc268_volume_init_verbs },
12984 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12985 .dac_nids = alc268_dac_nids,
12986 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12987 .adc_nids = alc268_adc_nids_alt,
12988 .capsrc_nids = alc268_capsrc_nids,
12990 .dig_out_nid = ALC268_DIGOUT_NID,
12991 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12992 .channel_mode = alc268_modes,
12993 .input_mux = &alc268_capture_source,
12998 static int patch_alc268(struct hda_codec *codec)
13000 struct alc_spec *spec;
13002 int i, has_beep, err;
13004 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13008 codec->spec = spec;
13010 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13014 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13015 board_config = snd_hda_check_board_codec_sid_config(codec,
13016 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13018 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13019 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13021 board_config = ALC268_AUTO;
13024 if (board_config == ALC268_AUTO) {
13025 /* automatic parse from the BIOS config */
13026 err = alc268_parse_auto_config(codec);
13032 "hda_codec: Cannot set up configuration "
13033 "from BIOS. Using base mode...\n");
13034 board_config = ALC268_3ST;
13038 if (board_config != ALC268_AUTO)
13039 setup_preset(codec, &alc268_presets[board_config]);
13041 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13042 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13043 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13045 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13048 for (i = 0; i < spec->num_mixers; i++) {
13049 if (spec->mixers[i] == alc268_beep_mixer) {
13056 err = snd_hda_attach_beep_device(codec, 0x1);
13061 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13062 /* override the amp caps for beep generator */
13063 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13064 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13065 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13066 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13067 (0 << AC_AMPCAP_MUTE_SHIFT));
13070 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13071 /* check whether NID 0x07 is valid */
13072 unsigned int wcap = get_wcaps(codec, 0x07);
13075 spec->capsrc_nids = alc268_capsrc_nids;
13077 wcap = get_wcaps_type(wcap);
13078 if (spec->auto_mic ||
13079 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13080 spec->adc_nids = alc268_adc_nids_alt;
13081 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13082 if (spec->auto_mic)
13083 fixup_automic_adc(codec);
13084 if (spec->auto_mic || spec->input_mux->num_items == 1)
13085 add_mixer(spec, alc268_capture_nosrc_mixer);
13087 add_mixer(spec, alc268_capture_alt_mixer);
13089 spec->adc_nids = alc268_adc_nids;
13090 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13091 add_mixer(spec, alc268_capture_mixer);
13093 /* set default input source */
13094 for (i = 0; i < spec->num_adc_nids; i++)
13095 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13096 0, AC_VERB_SET_CONNECT_SEL,
13097 i < spec->num_mux_defs ?
13098 spec->input_mux[i].items[0].index :
13099 spec->input_mux->items[0].index);
13102 spec->vmaster_nid = 0x02;
13104 codec->patch_ops = alc_patch_ops;
13105 if (board_config == ALC268_AUTO)
13106 spec->init_hook = alc268_auto_init;
13108 codec->proc_widget_hook = print_realtek_coef;
13114 * ALC269 channel source setting (2 channel)
13116 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13118 #define alc269_dac_nids alc260_dac_nids
13120 static hda_nid_t alc269_adc_nids[1] = {
13125 static hda_nid_t alc269_capsrc_nids[1] = {
13129 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13133 #define alc269_modes alc260_modes
13134 #define alc269_capture_source alc880_lg_lw_capture_source
13136 static struct snd_kcontrol_new alc269_base_mixer[] = {
13137 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13138 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13144 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13145 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13146 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13148 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13152 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13153 /* output mixer control */
13154 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13156 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13157 .name = "Master Playback Switch",
13158 .info = snd_hda_mixer_amp_switch_info,
13159 .get = snd_hda_mixer_amp_switch_get,
13160 .put = alc268_acer_master_sw_put,
13161 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13165 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13166 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13167 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13168 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13172 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13173 /* output mixer control */
13174 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13176 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13177 .name = "Master Playback Switch",
13178 .info = snd_hda_mixer_amp_switch_info,
13179 .get = snd_hda_mixer_amp_switch_get,
13180 .put = alc268_acer_master_sw_put,
13181 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13185 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13186 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13187 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13188 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13189 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13190 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13191 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13195 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13196 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13197 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13199 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13203 /* capture mixer elements */
13204 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13205 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13206 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13207 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13212 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13214 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13216 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13218 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13219 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13220 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13224 static struct hda_verb alc269_lifebook_verbs[] = {
13225 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13226 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13227 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13228 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13229 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13230 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13231 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13232 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13233 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13234 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13238 /* toggle speaker-output according to the hp-jack state */
13239 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13241 unsigned int present;
13242 unsigned char bits;
13244 present = snd_hda_jack_detect(codec, 0x15);
13245 bits = present ? AMP_IN_MUTE(0) : 0;
13246 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13247 AMP_IN_MUTE(0), bits);
13248 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13249 AMP_IN_MUTE(0), bits);
13251 snd_hda_codec_write(codec, 0x20, 0,
13252 AC_VERB_SET_COEF_INDEX, 0x0c);
13253 snd_hda_codec_write(codec, 0x20, 0,
13254 AC_VERB_SET_PROC_COEF, 0x680);
13256 snd_hda_codec_write(codec, 0x20, 0,
13257 AC_VERB_SET_COEF_INDEX, 0x0c);
13258 snd_hda_codec_write(codec, 0x20, 0,
13259 AC_VERB_SET_PROC_COEF, 0x480);
13262 /* toggle speaker-output according to the hp-jacks state */
13263 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13265 unsigned int present;
13266 unsigned char bits;
13268 /* Check laptop headphone socket */
13269 present = snd_hda_jack_detect(codec, 0x15);
13271 /* Check port replicator headphone socket */
13272 present |= snd_hda_jack_detect(codec, 0x1a);
13274 bits = present ? AMP_IN_MUTE(0) : 0;
13275 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13276 AMP_IN_MUTE(0), bits);
13277 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13278 AMP_IN_MUTE(0), bits);
13280 snd_hda_codec_write(codec, 0x20, 0,
13281 AC_VERB_SET_COEF_INDEX, 0x0c);
13282 snd_hda_codec_write(codec, 0x20, 0,
13283 AC_VERB_SET_PROC_COEF, 0x680);
13285 snd_hda_codec_write(codec, 0x20, 0,
13286 AC_VERB_SET_COEF_INDEX, 0x0c);
13287 snd_hda_codec_write(codec, 0x20, 0,
13288 AC_VERB_SET_PROC_COEF, 0x480);
13291 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13293 unsigned int present_laptop;
13294 unsigned int present_dock;
13296 present_laptop = snd_hda_jack_detect(codec, 0x18);
13297 present_dock = snd_hda_jack_detect(codec, 0x1b);
13299 /* Laptop mic port overrides dock mic port, design decision */
13301 snd_hda_codec_write(codec, 0x23, 0,
13302 AC_VERB_SET_CONNECT_SEL, 0x3);
13303 if (present_laptop)
13304 snd_hda_codec_write(codec, 0x23, 0,
13305 AC_VERB_SET_CONNECT_SEL, 0x0);
13306 if (!present_dock && !present_laptop)
13307 snd_hda_codec_write(codec, 0x23, 0,
13308 AC_VERB_SET_CONNECT_SEL, 0x1);
13311 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13314 switch (res >> 26) {
13315 case ALC880_HP_EVENT:
13316 alc269_quanta_fl1_speaker_automute(codec);
13318 case ALC880_MIC_EVENT:
13319 alc_mic_automute(codec);
13324 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13327 if ((res >> 26) == ALC880_HP_EVENT)
13328 alc269_lifebook_speaker_automute(codec);
13329 if ((res >> 26) == ALC880_MIC_EVENT)
13330 alc269_lifebook_mic_autoswitch(codec);
13333 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13335 struct alc_spec *spec = codec->spec;
13336 spec->ext_mic.pin = 0x18;
13337 spec->ext_mic.mux_idx = 0;
13338 spec->int_mic.pin = 0x19;
13339 spec->int_mic.mux_idx = 1;
13340 spec->auto_mic = 1;
13343 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13345 alc269_quanta_fl1_speaker_automute(codec);
13346 alc_mic_automute(codec);
13349 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13351 alc269_lifebook_speaker_automute(codec);
13352 alc269_lifebook_mic_autoswitch(codec);
13355 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13356 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13357 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13358 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13359 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13360 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13361 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13362 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13366 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13367 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13368 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13369 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13371 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13372 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13376 /* toggle speaker-output according to the hp-jack state */
13377 static void alc269_speaker_automute(struct hda_codec *codec)
13379 struct alc_spec *spec = codec->spec;
13380 unsigned int nid = spec->autocfg.hp_pins[0];
13381 unsigned int present;
13382 unsigned char bits;
13384 present = snd_hda_jack_detect(codec, nid);
13385 bits = present ? AMP_IN_MUTE(0) : 0;
13386 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13387 AMP_IN_MUTE(0), bits);
13388 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13389 AMP_IN_MUTE(0), bits);
13392 /* unsolicited event for HP jack sensing */
13393 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13396 switch (res >> 26) {
13397 case ALC880_HP_EVENT:
13398 alc269_speaker_automute(codec);
13400 case ALC880_MIC_EVENT:
13401 alc_mic_automute(codec);
13406 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13408 struct alc_spec *spec = codec->spec;
13409 spec->ext_mic.pin = 0x18;
13410 spec->ext_mic.mux_idx = 0;
13411 spec->int_mic.pin = 0x12;
13412 spec->int_mic.mux_idx = 5;
13413 spec->auto_mic = 1;
13416 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13418 struct alc_spec *spec = codec->spec;
13419 spec->ext_mic.pin = 0x18;
13420 spec->ext_mic.mux_idx = 0;
13421 spec->int_mic.pin = 0x19;
13422 spec->int_mic.mux_idx = 1;
13423 spec->auto_mic = 1;
13426 static void alc269_eeepc_inithook(struct hda_codec *codec)
13428 alc269_speaker_automute(codec);
13429 alc_mic_automute(codec);
13433 * generic initialization of ADC, input mixers and output mixers
13435 static struct hda_verb alc269_init_verbs[] = {
13437 * Unmute ADC0 and set the default input to mic-in
13439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13441 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13442 * analog-loopback mixer widget
13443 * Note: PASD motherboards uses the Line In 2 as the input for
13444 * front panel mic (mic 2)
13446 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13454 * Set up output mixers (0x0c - 0x0e)
13456 /* set vol=0 to output mixers */
13457 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13458 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13460 /* set up input amps for analog loopback */
13461 /* Amp Indices: DAC = 0, mixer = 1 */
13462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13471 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13472 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13473 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13474 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13479 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13481 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13483 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13485 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13486 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13488 /* FIXME: use matrix-type input source selection */
13489 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13490 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13497 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13498 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13502 #define alc269_auto_create_multi_out_ctls \
13503 alc268_auto_create_multi_out_ctls
13504 #define alc269_auto_create_input_ctls \
13505 alc268_auto_create_input_ctls
13507 #ifdef CONFIG_SND_HDA_POWER_SAVE
13508 #define alc269_loopbacks alc880_loopbacks
13511 /* pcm configuration: identical with ALC880 */
13512 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13513 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13514 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13515 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13517 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13521 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13522 /* NID is set in alc_build_pcms */
13524 .open = alc880_playback_pcm_open,
13525 .prepare = alc880_playback_pcm_prepare,
13526 .cleanup = alc880_playback_pcm_cleanup
13530 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13534 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13535 /* NID is set in alc_build_pcms */
13539 * BIOS auto configuration
13541 static int alc269_parse_auto_config(struct hda_codec *codec)
13543 struct alc_spec *spec = codec->spec;
13545 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13547 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13552 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13555 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13559 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13561 if (spec->autocfg.dig_outs)
13562 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13564 if (spec->kctls.list)
13565 add_mixer(spec, spec->kctls.list);
13567 add_verb(spec, alc269_init_verbs);
13568 spec->num_mux_defs = 1;
13569 spec->input_mux = &spec->private_imux[0];
13570 /* set default input source */
13571 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13572 0, AC_VERB_SET_CONNECT_SEL,
13573 spec->input_mux->items[0].index);
13575 err = alc_auto_add_mic_boost(codec);
13579 if (!spec->cap_mixer && !spec->no_analog)
13580 set_capture_mixer(codec);
13582 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13587 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13588 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13589 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13592 /* init callback for auto-configuration model -- overriding the default init */
13593 static void alc269_auto_init(struct hda_codec *codec)
13595 struct alc_spec *spec = codec->spec;
13596 alc269_auto_init_multi_out(codec);
13597 alc269_auto_init_hp_out(codec);
13598 alc269_auto_init_analog_input(codec);
13599 if (spec->unsol_event)
13600 alc_inithook(codec);
13604 * configuration and preset
13606 static const char *alc269_models[ALC269_MODEL_LAST] = {
13607 [ALC269_BASIC] = "basic",
13608 [ALC269_QUANTA_FL1] = "quanta",
13609 [ALC269_ASUS_AMIC] = "asus-amic",
13610 [ALC269_ASUS_DMIC] = "asus-dmic",
13611 [ALC269_FUJITSU] = "fujitsu",
13612 [ALC269_LIFEBOOK] = "lifebook",
13613 [ALC269_AUTO] = "auto",
13616 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13617 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13618 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13620 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13621 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13622 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13623 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13624 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13625 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13626 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13627 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13628 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13629 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13630 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13631 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13632 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13633 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13634 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13635 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13636 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13637 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13638 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13639 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13640 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13641 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13642 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13643 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13644 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13645 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13646 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13647 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13648 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13650 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13652 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13653 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13654 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13655 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13659 static struct alc_config_preset alc269_presets[] = {
13661 .mixers = { alc269_base_mixer },
13662 .init_verbs = { alc269_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 .input_mux = &alc269_capture_source,
13670 [ALC269_QUANTA_FL1] = {
13671 .mixers = { alc269_quanta_fl1_mixer },
13672 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13673 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13674 .dac_nids = alc269_dac_nids,
13676 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13677 .channel_mode = alc269_modes,
13678 .input_mux = &alc269_capture_source,
13679 .unsol_event = alc269_quanta_fl1_unsol_event,
13680 .setup = alc269_quanta_fl1_setup,
13681 .init_hook = alc269_quanta_fl1_init_hook,
13683 [ALC269_ASUS_AMIC] = {
13684 .mixers = { alc269_eeepc_mixer },
13685 .cap_mixer = alc269_epc_capture_mixer,
13686 .init_verbs = { alc269_init_verbs,
13687 alc269_eeepc_amic_init_verbs },
13688 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13689 .dac_nids = alc269_dac_nids,
13691 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13692 .channel_mode = alc269_modes,
13693 .unsol_event = alc269_eeepc_unsol_event,
13694 .setup = alc269_eeepc_amic_setup,
13695 .init_hook = alc269_eeepc_inithook,
13697 [ALC269_ASUS_DMIC] = {
13698 .mixers = { alc269_eeepc_mixer },
13699 .cap_mixer = alc269_epc_capture_mixer,
13700 .init_verbs = { alc269_init_verbs,
13701 alc269_eeepc_dmic_init_verbs },
13702 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13703 .dac_nids = alc269_dac_nids,
13705 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13706 .channel_mode = alc269_modes,
13707 .unsol_event = alc269_eeepc_unsol_event,
13708 .setup = alc269_eeepc_dmic_setup,
13709 .init_hook = alc269_eeepc_inithook,
13711 [ALC269_FUJITSU] = {
13712 .mixers = { alc269_fujitsu_mixer },
13713 .cap_mixer = alc269_epc_capture_mixer,
13714 .init_verbs = { alc269_init_verbs,
13715 alc269_eeepc_dmic_init_verbs },
13716 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13717 .dac_nids = alc269_dac_nids,
13719 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13720 .channel_mode = alc269_modes,
13721 .unsol_event = alc269_eeepc_unsol_event,
13722 .setup = alc269_eeepc_dmic_setup,
13723 .init_hook = alc269_eeepc_inithook,
13725 [ALC269_LIFEBOOK] = {
13726 .mixers = { alc269_lifebook_mixer },
13727 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13728 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13729 .dac_nids = alc269_dac_nids,
13731 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13732 .channel_mode = alc269_modes,
13733 .input_mux = &alc269_capture_source,
13734 .unsol_event = alc269_lifebook_unsol_event,
13735 .init_hook = alc269_lifebook_init_hook,
13739 static int patch_alc269(struct hda_codec *codec)
13741 struct alc_spec *spec;
13745 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13749 codec->spec = spec;
13751 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13753 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13754 kfree(codec->chip_name);
13755 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13756 if (!codec->chip_name) {
13762 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13766 if (board_config < 0) {
13767 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13769 board_config = ALC269_AUTO;
13772 if (board_config == ALC269_AUTO) {
13773 /* automatic parse from the BIOS config */
13774 err = alc269_parse_auto_config(codec);
13780 "hda_codec: Cannot set up configuration "
13781 "from BIOS. Using base mode...\n");
13782 board_config = ALC269_BASIC;
13786 err = snd_hda_attach_beep_device(codec, 0x1);
13792 if (board_config != ALC269_AUTO)
13793 setup_preset(codec, &alc269_presets[board_config]);
13795 if (codec->subsystem_id == 0x17aa3bf8) {
13796 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13797 * fix the sample rate of analog I/O to 44.1kHz
13799 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13800 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13802 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13803 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13805 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13806 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13808 spec->adc_nids = alc269_adc_nids;
13809 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13810 spec->capsrc_nids = alc269_capsrc_nids;
13811 if (!spec->cap_mixer)
13812 set_capture_mixer(codec);
13813 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13815 spec->vmaster_nid = 0x02;
13817 codec->patch_ops = alc_patch_ops;
13818 if (board_config == ALC269_AUTO)
13819 spec->init_hook = alc269_auto_init;
13820 #ifdef CONFIG_SND_HDA_POWER_SAVE
13821 if (!spec->loopback.amplist)
13822 spec->loopback.amplist = alc269_loopbacks;
13824 codec->proc_widget_hook = print_realtek_coef;
13830 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13834 * set the path ways for 2 channel output
13835 * need to set the codec line out and mic 1 pin widgets to inputs
13837 static struct hda_verb alc861_threestack_ch2_init[] = {
13838 /* set pin widget 1Ah (line in) for input */
13839 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13840 /* set pin widget 18h (mic1/2) for input, for mic also enable
13843 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13845 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13847 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13848 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13854 * need to set the codec line out and mic 1 pin widgets to outputs
13856 static struct hda_verb alc861_threestack_ch6_init[] = {
13857 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13858 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13859 /* set pin widget 18h (mic1) for output (CLFE)*/
13860 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13862 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13863 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13865 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13867 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13868 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13873 static struct hda_channel_mode alc861_threestack_modes[2] = {
13874 { 2, alc861_threestack_ch2_init },
13875 { 6, alc861_threestack_ch6_init },
13877 /* Set mic1 as input and unmute the mixer */
13878 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13879 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13880 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13883 /* Set mic1 as output and mute mixer */
13884 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13885 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13886 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13890 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13891 { 2, alc861_uniwill_m31_ch2_init },
13892 { 4, alc861_uniwill_m31_ch4_init },
13895 /* Set mic1 and line-in as input and unmute the mixer */
13896 static struct hda_verb alc861_asus_ch2_init[] = {
13897 /* set pin widget 1Ah (line in) for input */
13898 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13899 /* set pin widget 18h (mic1/2) for input, for mic also enable
13902 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13904 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13906 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13907 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13911 /* Set mic1 nad line-in as output and mute mixer */
13912 static struct hda_verb alc861_asus_ch6_init[] = {
13913 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13914 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13915 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13916 /* set pin widget 18h (mic1) for output (CLFE)*/
13917 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13918 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13919 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13920 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13922 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13924 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13925 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13930 static struct hda_channel_mode alc861_asus_modes[2] = {
13931 { 2, alc861_asus_ch2_init },
13932 { 6, alc861_asus_ch6_init },
13937 static struct snd_kcontrol_new alc861_base_mixer[] = {
13938 /* output mixer control */
13939 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13940 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13941 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13942 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13943 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13945 /*Input mixer control */
13946 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13947 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13948 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13949 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13950 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13951 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13953 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13954 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13960 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13961 /* output mixer control */
13962 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13963 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13964 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13965 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13966 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13968 /* Input mixer control */
13969 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13970 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13971 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13972 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13973 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13974 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13976 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13977 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13978 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13981 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13982 .name = "Channel Mode",
13983 .info = alc_ch_mode_info,
13984 .get = alc_ch_mode_get,
13985 .put = alc_ch_mode_put,
13986 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13991 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13992 /* output mixer control */
13993 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13995 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14000 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14001 /* output mixer control */
14002 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14003 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14004 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14005 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14006 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14008 /* Input mixer control */
14009 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14010 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14011 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14012 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14013 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14014 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14016 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14018 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14021 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14022 .name = "Channel Mode",
14023 .info = alc_ch_mode_info,
14024 .get = alc_ch_mode_get,
14025 .put = alc_ch_mode_put,
14026 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14031 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14032 /* output mixer control */
14033 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14034 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14035 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14036 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14037 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14039 /* Input mixer control */
14040 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14041 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14042 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14043 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14044 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14045 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14046 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14047 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14048 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14052 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14053 .name = "Channel Mode",
14054 .info = alc_ch_mode_info,
14055 .get = alc_ch_mode_get,
14056 .put = alc_ch_mode_put,
14057 .private_value = ARRAY_SIZE(alc861_asus_modes),
14062 /* additional mixer */
14063 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14064 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14065 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14070 * generic initialization of ADC, input mixers and output mixers
14072 static struct hda_verb alc861_base_init_verbs[] = {
14074 * Unmute ADC0 and set the default input to mic-in
14076 /* port-A for surround (rear panel) */
14077 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14078 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14079 /* port-B for mic-in (rear panel) with vref */
14080 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14081 /* port-C for line-in (rear panel) */
14082 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14083 /* port-D for Front */
14084 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14085 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14086 /* port-E for HP out (front panel) */
14087 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14088 /* route front PCM to HP */
14089 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14090 /* port-F for mic-in (front panel) with vref */
14091 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14092 /* port-G for CLFE (rear panel) */
14093 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14094 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14095 /* port-H for side (rear panel) */
14096 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14097 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14099 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14100 /* route front mic to ADC1*/
14101 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14102 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14104 /* Unmute DAC0~3 & spdif out*/
14105 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14106 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14107 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14108 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14111 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14112 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14113 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14114 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14115 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14117 /* Unmute Stereo Mixer 15 */
14118 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14119 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14120 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14123 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14124 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14125 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14126 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14127 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14128 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14129 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14130 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14131 /* hp used DAC 3 (Front) */
14132 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14133 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14138 static struct hda_verb alc861_threestack_init_verbs[] = {
14140 * Unmute ADC0 and set the default input to mic-in
14142 /* port-A for surround (rear panel) */
14143 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14144 /* port-B for mic-in (rear panel) with vref */
14145 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14146 /* port-C for line-in (rear panel) */
14147 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14148 /* port-D for Front */
14149 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14150 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14151 /* port-E for HP out (front panel) */
14152 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14153 /* route front PCM to HP */
14154 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14155 /* port-F for mic-in (front panel) with vref */
14156 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14157 /* port-G for CLFE (rear panel) */
14158 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14159 /* port-H for side (rear panel) */
14160 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14162 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14163 /* route front mic to ADC1*/
14164 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14165 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14166 /* Unmute DAC0~3 & spdif out*/
14167 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14168 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14169 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14170 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14173 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14174 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14175 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14176 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14177 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14179 /* Unmute Stereo Mixer 15 */
14180 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14181 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14183 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14185 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14186 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14187 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14188 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14189 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14190 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14192 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14193 /* hp used DAC 3 (Front) */
14194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14195 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14199 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14201 * Unmute ADC0 and set the default input to mic-in
14203 /* port-A for surround (rear panel) */
14204 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14205 /* port-B for mic-in (rear panel) with vref */
14206 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14207 /* port-C for line-in (rear panel) */
14208 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14209 /* port-D for Front */
14210 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14211 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14212 /* port-E for HP out (front panel) */
14213 /* this has to be set to VREF80 */
14214 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14215 /* route front PCM to HP */
14216 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14217 /* port-F for mic-in (front panel) with vref */
14218 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14219 /* port-G for CLFE (rear panel) */
14220 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14221 /* port-H for side (rear panel) */
14222 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14224 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14225 /* route front mic to ADC1*/
14226 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14227 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14228 /* Unmute DAC0~3 & spdif out*/
14229 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14230 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14231 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14232 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14235 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14236 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14237 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14238 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14239 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14241 /* Unmute Stereo Mixer 15 */
14242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14244 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14245 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14247 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14248 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14249 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14250 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14252 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14254 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14255 /* hp used DAC 3 (Front) */
14256 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14257 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14261 static struct hda_verb alc861_asus_init_verbs[] = {
14263 * Unmute ADC0 and set the default input to mic-in
14265 /* port-A for surround (rear panel)
14266 * according to codec#0 this is the HP jack
14268 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14269 /* route front PCM to HP */
14270 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14271 /* port-B for mic-in (rear panel) with vref */
14272 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14273 /* port-C for line-in (rear panel) */
14274 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14275 /* port-D for Front */
14276 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14277 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14278 /* port-E for HP out (front panel) */
14279 /* this has to be set to VREF80 */
14280 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14281 /* route front PCM to HP */
14282 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14283 /* port-F for mic-in (front panel) with vref */
14284 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14285 /* port-G for CLFE (rear panel) */
14286 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14287 /* port-H for side (rear panel) */
14288 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14290 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14291 /* route front mic to ADC1*/
14292 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14293 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14294 /* Unmute DAC0~3 & spdif out*/
14295 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14296 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14297 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14298 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14299 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14300 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14301 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14302 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14303 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14304 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14306 /* Unmute Stereo Mixer 15 */
14307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14308 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14309 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14312 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14313 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14314 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14315 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14316 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14317 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14319 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14320 /* hp used DAC 3 (Front) */
14321 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14322 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14326 /* additional init verbs for ASUS laptops */
14327 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14328 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14329 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14334 * generic initialization of ADC, input mixers and output mixers
14336 static struct hda_verb alc861_auto_init_verbs[] = {
14338 * Unmute ADC0 and set the default input to mic-in
14340 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14343 /* Unmute DAC0~3 & spdif out*/
14344 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14345 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14346 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14347 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14348 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14350 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14351 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14352 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14353 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14354 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14356 /* Unmute Stereo Mixer 15 */
14357 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14358 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14359 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14360 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14362 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14363 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14364 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14365 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14366 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14367 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14368 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14369 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14371 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14372 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14373 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14374 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14375 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14376 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14377 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14378 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14380 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14385 static struct hda_verb alc861_toshiba_init_verbs[] = {
14386 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14391 /* toggle speaker-output according to the hp-jack state */
14392 static void alc861_toshiba_automute(struct hda_codec *codec)
14394 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14396 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14397 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14398 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14399 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14402 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14405 if ((res >> 26) == ALC880_HP_EVENT)
14406 alc861_toshiba_automute(codec);
14409 /* pcm configuration: identical with ALC880 */
14410 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14411 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14412 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14413 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14416 #define ALC861_DIGOUT_NID 0x07
14418 static struct hda_channel_mode alc861_8ch_modes[1] = {
14422 static hda_nid_t alc861_dac_nids[4] = {
14423 /* front, surround, clfe, side */
14424 0x03, 0x06, 0x05, 0x04
14427 static hda_nid_t alc660_dac_nids[3] = {
14428 /* front, clfe, surround */
14432 static hda_nid_t alc861_adc_nids[1] = {
14437 static struct hda_input_mux alc861_capture_source = {
14441 { "Front Mic", 0x3 },
14448 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14450 struct alc_spec *spec = codec->spec;
14451 hda_nid_t mix, srcs[5];
14454 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14456 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14459 for (i = 0; i < num; i++) {
14461 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14462 if (type != AC_WID_AUD_OUT)
14464 for (j = 0; j < spec->multiout.num_dacs; j++)
14465 if (spec->multiout.dac_nids[j] == srcs[i])
14467 if (j >= spec->multiout.num_dacs)
14473 /* fill in the dac_nids table from the parsed pin configuration */
14474 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14475 const struct auto_pin_cfg *cfg)
14477 struct alc_spec *spec = codec->spec;
14479 hda_nid_t nid, dac;
14481 spec->multiout.dac_nids = spec->private_dac_nids;
14482 for (i = 0; i < cfg->line_outs; i++) {
14483 nid = cfg->line_out_pins[i];
14484 dac = alc861_look_for_dac(codec, nid);
14487 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14492 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14493 hda_nid_t nid, unsigned int chs)
14495 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14496 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14499 /* add playback controls from the parsed DAC table */
14500 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14501 const struct auto_pin_cfg *cfg)
14503 struct alc_spec *spec = codec->spec;
14504 static const char *chname[4] = {
14505 "Front", "Surround", NULL /*CLFE*/, "Side"
14510 if (cfg->line_outs == 1) {
14511 const char *pfx = NULL;
14514 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14517 nid = spec->multiout.dac_nids[0];
14518 return alc861_create_out_sw(codec, pfx, nid, 3);
14522 for (i = 0; i < cfg->line_outs; i++) {
14523 nid = spec->multiout.dac_nids[i];
14528 err = alc861_create_out_sw(codec, "Center", nid, 1);
14531 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14535 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14543 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14545 struct alc_spec *spec = codec->spec;
14552 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14553 nid = alc861_look_for_dac(codec, pin);
14555 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14558 spec->multiout.hp_nid = nid;
14564 /* create playback/capture controls for input pins */
14565 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14566 const struct auto_pin_cfg *cfg)
14568 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14571 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14573 int pin_type, hda_nid_t dac)
14575 hda_nid_t mix, srcs[5];
14578 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14580 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14582 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14584 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14587 for (i = 0; i < num; i++) {
14589 if (srcs[i] == dac || srcs[i] == 0x15)
14590 mute = AMP_IN_UNMUTE(i);
14592 mute = AMP_IN_MUTE(i);
14593 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14598 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14600 struct alc_spec *spec = codec->spec;
14603 for (i = 0; i < spec->autocfg.line_outs; i++) {
14604 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14605 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14607 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14608 spec->multiout.dac_nids[i]);
14612 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14614 struct alc_spec *spec = codec->spec;
14616 if (spec->autocfg.hp_outs)
14617 alc861_auto_set_output_and_unmute(codec,
14618 spec->autocfg.hp_pins[0],
14620 spec->multiout.hp_nid);
14621 if (spec->autocfg.speaker_outs)
14622 alc861_auto_set_output_and_unmute(codec,
14623 spec->autocfg.speaker_pins[0],
14625 spec->multiout.dac_nids[0]);
14628 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14630 struct alc_spec *spec = codec->spec;
14633 for (i = 0; i < AUTO_PIN_LAST; i++) {
14634 hda_nid_t nid = spec->autocfg.input_pins[i];
14635 if (nid >= 0x0c && nid <= 0x11)
14636 alc_set_input_pin(codec, nid, i);
14640 /* parse the BIOS configuration and set up the alc_spec */
14641 /* return 1 if successful, 0 if the proper config is not found,
14642 * or a negative error code
14644 static int alc861_parse_auto_config(struct hda_codec *codec)
14646 struct alc_spec *spec = codec->spec;
14648 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14650 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14654 if (!spec->autocfg.line_outs)
14655 return 0; /* can't find valid BIOS pin config */
14657 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14660 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14663 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14666 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14670 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14672 if (spec->autocfg.dig_outs)
14673 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14675 if (spec->kctls.list)
14676 add_mixer(spec, spec->kctls.list);
14678 add_verb(spec, alc861_auto_init_verbs);
14680 spec->num_mux_defs = 1;
14681 spec->input_mux = &spec->private_imux[0];
14683 spec->adc_nids = alc861_adc_nids;
14684 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14685 set_capture_mixer(codec);
14687 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14692 /* additional initialization for auto-configuration model */
14693 static void alc861_auto_init(struct hda_codec *codec)
14695 struct alc_spec *spec = codec->spec;
14696 alc861_auto_init_multi_out(codec);
14697 alc861_auto_init_hp_out(codec);
14698 alc861_auto_init_analog_input(codec);
14699 if (spec->unsol_event)
14700 alc_inithook(codec);
14703 #ifdef CONFIG_SND_HDA_POWER_SAVE
14704 static struct hda_amp_list alc861_loopbacks[] = {
14705 { 0x15, HDA_INPUT, 0 },
14706 { 0x15, HDA_INPUT, 1 },
14707 { 0x15, HDA_INPUT, 2 },
14708 { 0x15, HDA_INPUT, 3 },
14715 * configuration and preset
14717 static const char *alc861_models[ALC861_MODEL_LAST] = {
14718 [ALC861_3ST] = "3stack",
14719 [ALC660_3ST] = "3stack-660",
14720 [ALC861_3ST_DIG] = "3stack-dig",
14721 [ALC861_6ST_DIG] = "6stack-dig",
14722 [ALC861_UNIWILL_M31] = "uniwill-m31",
14723 [ALC861_TOSHIBA] = "toshiba",
14724 [ALC861_ASUS] = "asus",
14725 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14726 [ALC861_AUTO] = "auto",
14729 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14730 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14731 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14732 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14733 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14734 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14735 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14736 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14737 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14738 * Any other models that need this preset?
14740 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14741 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14742 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14743 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14744 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14745 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14746 /* FIXME: the below seems conflict */
14747 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14748 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14749 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14753 static struct alc_config_preset alc861_presets[] = {
14755 .mixers = { alc861_3ST_mixer },
14756 .init_verbs = { alc861_threestack_init_verbs },
14757 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14758 .dac_nids = alc861_dac_nids,
14759 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14760 .channel_mode = alc861_threestack_modes,
14762 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14763 .adc_nids = alc861_adc_nids,
14764 .input_mux = &alc861_capture_source,
14766 [ALC861_3ST_DIG] = {
14767 .mixers = { alc861_base_mixer },
14768 .init_verbs = { alc861_threestack_init_verbs },
14769 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14770 .dac_nids = alc861_dac_nids,
14771 .dig_out_nid = ALC861_DIGOUT_NID,
14772 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14773 .channel_mode = alc861_threestack_modes,
14775 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14776 .adc_nids = alc861_adc_nids,
14777 .input_mux = &alc861_capture_source,
14779 [ALC861_6ST_DIG] = {
14780 .mixers = { alc861_base_mixer },
14781 .init_verbs = { alc861_base_init_verbs },
14782 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14783 .dac_nids = alc861_dac_nids,
14784 .dig_out_nid = ALC861_DIGOUT_NID,
14785 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14786 .channel_mode = alc861_8ch_modes,
14787 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14788 .adc_nids = alc861_adc_nids,
14789 .input_mux = &alc861_capture_source,
14792 .mixers = { alc861_3ST_mixer },
14793 .init_verbs = { alc861_threestack_init_verbs },
14794 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14795 .dac_nids = alc660_dac_nids,
14796 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14797 .channel_mode = alc861_threestack_modes,
14799 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14800 .adc_nids = alc861_adc_nids,
14801 .input_mux = &alc861_capture_source,
14803 [ALC861_UNIWILL_M31] = {
14804 .mixers = { alc861_uniwill_m31_mixer },
14805 .init_verbs = { alc861_uniwill_m31_init_verbs },
14806 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14807 .dac_nids = alc861_dac_nids,
14808 .dig_out_nid = ALC861_DIGOUT_NID,
14809 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14810 .channel_mode = alc861_uniwill_m31_modes,
14812 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14813 .adc_nids = alc861_adc_nids,
14814 .input_mux = &alc861_capture_source,
14816 [ALC861_TOSHIBA] = {
14817 .mixers = { alc861_toshiba_mixer },
14818 .init_verbs = { alc861_base_init_verbs,
14819 alc861_toshiba_init_verbs },
14820 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14821 .dac_nids = alc861_dac_nids,
14822 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14823 .channel_mode = alc883_3ST_2ch_modes,
14824 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14825 .adc_nids = alc861_adc_nids,
14826 .input_mux = &alc861_capture_source,
14827 .unsol_event = alc861_toshiba_unsol_event,
14828 .init_hook = alc861_toshiba_automute,
14831 .mixers = { alc861_asus_mixer },
14832 .init_verbs = { alc861_asus_init_verbs },
14833 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14834 .dac_nids = alc861_dac_nids,
14835 .dig_out_nid = ALC861_DIGOUT_NID,
14836 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14837 .channel_mode = alc861_asus_modes,
14840 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14841 .adc_nids = alc861_adc_nids,
14842 .input_mux = &alc861_capture_source,
14844 [ALC861_ASUS_LAPTOP] = {
14845 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14846 .init_verbs = { alc861_asus_init_verbs,
14847 alc861_asus_laptop_init_verbs },
14848 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14849 .dac_nids = alc861_dac_nids,
14850 .dig_out_nid = ALC861_DIGOUT_NID,
14851 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14852 .channel_mode = alc883_3ST_2ch_modes,
14854 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14855 .adc_nids = alc861_adc_nids,
14856 .input_mux = &alc861_capture_source,
14860 /* Pin config fixes */
14862 PINFIX_FSC_AMILO_PI1505,
14865 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14866 { 0x0b, 0x0221101f }, /* HP */
14867 { 0x0f, 0x90170310 }, /* speaker */
14871 static const struct alc_fixup alc861_fixups[] = {
14872 [PINFIX_FSC_AMILO_PI1505] = {
14873 .pins = alc861_fsc_amilo_pi1505_pinfix
14877 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14878 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14882 static int patch_alc861(struct hda_codec *codec)
14884 struct alc_spec *spec;
14888 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14892 codec->spec = spec;
14894 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14898 if (board_config < 0) {
14899 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14901 board_config = ALC861_AUTO;
14904 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14906 if (board_config == ALC861_AUTO) {
14907 /* automatic parse from the BIOS config */
14908 err = alc861_parse_auto_config(codec);
14914 "hda_codec: Cannot set up configuration "
14915 "from BIOS. Using base mode...\n");
14916 board_config = ALC861_3ST_DIG;
14920 err = snd_hda_attach_beep_device(codec, 0x23);
14926 if (board_config != ALC861_AUTO)
14927 setup_preset(codec, &alc861_presets[board_config]);
14929 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14930 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14932 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14933 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14935 if (!spec->cap_mixer)
14936 set_capture_mixer(codec);
14937 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14939 spec->vmaster_nid = 0x03;
14941 codec->patch_ops = alc_patch_ops;
14942 if (board_config == ALC861_AUTO)
14943 spec->init_hook = alc861_auto_init;
14944 #ifdef CONFIG_SND_HDA_POWER_SAVE
14945 if (!spec->loopback.amplist)
14946 spec->loopback.amplist = alc861_loopbacks;
14948 codec->proc_widget_hook = print_realtek_coef;
14954 * ALC861-VD support
14958 * In addition, an independent DAC
14960 #define ALC861VD_DIGOUT_NID 0x06
14962 static hda_nid_t alc861vd_dac_nids[4] = {
14963 /* front, surr, clfe, side surr */
14964 0x02, 0x03, 0x04, 0x05
14967 /* dac_nids for ALC660vd are in a different order - according to
14968 * Realtek's driver.
14969 * This should probably result in a different mixer for 6stack models
14970 * of ALC660vd codecs, but for now there is only 3stack mixer
14971 * - and it is the same as in 861vd.
14972 * adc_nids in ALC660vd are (is) the same as in 861vd
14974 static hda_nid_t alc660vd_dac_nids[3] = {
14975 /* front, rear, clfe, rear_surr */
14979 static hda_nid_t alc861vd_adc_nids[1] = {
14984 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14987 /* FIXME: should be a matrix-type input source selection */
14988 static struct hda_input_mux alc861vd_capture_source = {
14992 { "Front Mic", 0x1 },
14998 static struct hda_input_mux alc861vd_dallas_capture_source = {
15001 { "Ext Mic", 0x0 },
15002 { "Int Mic", 0x1 },
15006 static struct hda_input_mux alc861vd_hp_capture_source = {
15009 { "Front Mic", 0x0 },
15010 { "ATAPI Mic", 0x1 },
15017 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15024 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15025 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15026 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15027 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15028 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15035 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15036 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15037 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15038 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15039 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15043 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15044 { 6, alc861vd_6stack_ch6_init },
15045 { 8, alc861vd_6stack_ch8_init },
15048 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15050 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15051 .name = "Channel Mode",
15052 .info = alc_ch_mode_info,
15053 .get = alc_ch_mode_get,
15054 .put = alc_ch_mode_put,
15059 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15060 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15062 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15063 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15064 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15066 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15067 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15069 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15071 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15073 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15074 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15076 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15077 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15085 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15086 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15087 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15098 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15099 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15100 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15104 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15108 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15109 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15110 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15112 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15113 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15115 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15116 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15121 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15122 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15123 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15124 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15132 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15133 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15134 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15142 /* Pin assignment: Speaker=0x14, HP = 0x15,
15143 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15145 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15146 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15147 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15149 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15150 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15151 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15152 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15153 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15154 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15155 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15159 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15160 * Front Mic=0x18, ATAPI Mic = 0x19,
15162 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15163 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15164 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15165 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15166 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15167 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15168 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15169 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15170 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15176 * generic initialization of ADC, input mixers and output mixers
15178 static struct hda_verb alc861vd_volume_init_verbs[] = {
15180 * Unmute ADC0 and set the default input to mic-in
15182 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15183 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15185 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15186 * the analog-loopback mixer widget
15188 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15190 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15191 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15192 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15193 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15195 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15202 * Set up output mixers (0x02 - 0x05)
15204 /* set vol=0 to output mixers */
15205 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15206 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15207 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15208 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15210 /* set up input amps for analog loopback */
15211 /* Amp Indices: DAC = 0, mixer = 1 */
15212 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15214 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15215 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15216 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15217 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15218 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15219 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15225 * 3-stack pin configuration:
15226 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15228 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15230 * Set pin mode and muting
15232 /* set front pin widgets 0x14 for output */
15233 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15234 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15235 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15237 /* Mic (rear) pin: input vref at 80% */
15238 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15239 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15240 /* Front Mic pin: input vref at 80% */
15241 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15242 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15243 /* Line In pin: input */
15244 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15245 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15246 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15247 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15248 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15249 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15250 /* CD pin widget for input */
15251 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15257 * 6-stack pin configuration:
15259 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15261 * Set pin mode and muting
15263 /* set front pin widgets 0x14 for output */
15264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15265 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15266 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15268 /* Rear Pin: output 1 (0x0d) */
15269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15270 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15271 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15272 /* CLFE Pin: output 2 (0x0e) */
15273 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15274 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15275 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15276 /* Side Pin: output 3 (0x0f) */
15277 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15278 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15279 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15281 /* Mic (rear) pin: input vref at 80% */
15282 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15283 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15284 /* Front Mic pin: input vref at 80% */
15285 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15286 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15287 /* Line In pin: input */
15288 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15289 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15290 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15291 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15292 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15293 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15294 /* CD pin widget for input */
15295 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15300 static struct hda_verb alc861vd_eapd_verbs[] = {
15301 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15305 static struct hda_verb alc660vd_eapd_verbs[] = {
15306 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15307 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15311 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15315 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15316 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15320 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15322 unsigned int present;
15323 unsigned char bits;
15325 present = snd_hda_jack_detect(codec, 0x18);
15326 bits = present ? HDA_AMP_MUTE : 0;
15328 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15329 HDA_AMP_MUTE, bits);
15332 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15334 struct alc_spec *spec = codec->spec;
15335 spec->autocfg.hp_pins[0] = 0x1b;
15336 spec->autocfg.speaker_pins[0] = 0x14;
15339 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15341 alc_automute_amp(codec);
15342 alc861vd_lenovo_mic_automute(codec);
15345 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15348 switch (res >> 26) {
15349 case ALC880_MIC_EVENT:
15350 alc861vd_lenovo_mic_automute(codec);
15353 alc_automute_amp_unsol_event(codec, res);
15358 static struct hda_verb alc861vd_dallas_verbs[] = {
15359 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15360 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15361 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15362 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15364 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15370 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15371 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15373 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15374 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15376 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15377 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15378 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15379 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15380 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15382 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15383 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15384 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15385 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15386 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15387 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15388 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15389 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15391 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15392 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15396 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15397 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15398 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15403 /* toggle speaker-output according to the hp-jack state */
15404 static void alc861vd_dallas_setup(struct hda_codec *codec)
15406 struct alc_spec *spec = codec->spec;
15408 spec->autocfg.hp_pins[0] = 0x15;
15409 spec->autocfg.speaker_pins[0] = 0x14;
15412 #ifdef CONFIG_SND_HDA_POWER_SAVE
15413 #define alc861vd_loopbacks alc880_loopbacks
15416 /* pcm configuration: identical with ALC880 */
15417 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15418 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15419 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15420 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15423 * configuration and preset
15425 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15426 [ALC660VD_3ST] = "3stack-660",
15427 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15428 [ALC660VD_ASUS_V1S] = "asus-v1s",
15429 [ALC861VD_3ST] = "3stack",
15430 [ALC861VD_3ST_DIG] = "3stack-digout",
15431 [ALC861VD_6ST_DIG] = "6stack-digout",
15432 [ALC861VD_LENOVO] = "lenovo",
15433 [ALC861VD_DALLAS] = "dallas",
15434 [ALC861VD_HP] = "hp",
15435 [ALC861VD_AUTO] = "auto",
15438 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15439 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15440 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15441 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15442 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15443 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15444 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15445 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15446 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15447 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15448 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15449 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15450 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15451 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15452 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15453 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15457 static struct alc_config_preset alc861vd_presets[] = {
15459 .mixers = { alc861vd_3st_mixer },
15460 .init_verbs = { alc861vd_volume_init_verbs,
15461 alc861vd_3stack_init_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,
15468 [ALC660VD_3ST_DIG] = {
15469 .mixers = { alc861vd_3st_mixer },
15470 .init_verbs = { alc861vd_volume_init_verbs,
15471 alc861vd_3stack_init_verbs },
15472 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15473 .dac_nids = alc660vd_dac_nids,
15474 .dig_out_nid = ALC861VD_DIGOUT_NID,
15475 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15476 .channel_mode = alc861vd_3stack_2ch_modes,
15477 .input_mux = &alc861vd_capture_source,
15480 .mixers = { alc861vd_3st_mixer },
15481 .init_verbs = { alc861vd_volume_init_verbs,
15482 alc861vd_3stack_init_verbs },
15483 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15484 .dac_nids = alc861vd_dac_nids,
15485 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15486 .channel_mode = alc861vd_3stack_2ch_modes,
15487 .input_mux = &alc861vd_capture_source,
15489 [ALC861VD_3ST_DIG] = {
15490 .mixers = { alc861vd_3st_mixer },
15491 .init_verbs = { alc861vd_volume_init_verbs,
15492 alc861vd_3stack_init_verbs },
15493 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15494 .dac_nids = alc861vd_dac_nids,
15495 .dig_out_nid = ALC861VD_DIGOUT_NID,
15496 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15497 .channel_mode = alc861vd_3stack_2ch_modes,
15498 .input_mux = &alc861vd_capture_source,
15500 [ALC861VD_6ST_DIG] = {
15501 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15502 .init_verbs = { alc861vd_volume_init_verbs,
15503 alc861vd_6stack_init_verbs },
15504 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15505 .dac_nids = alc861vd_dac_nids,
15506 .dig_out_nid = ALC861VD_DIGOUT_NID,
15507 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15508 .channel_mode = alc861vd_6stack_modes,
15509 .input_mux = &alc861vd_capture_source,
15511 [ALC861VD_LENOVO] = {
15512 .mixers = { alc861vd_lenovo_mixer },
15513 .init_verbs = { alc861vd_volume_init_verbs,
15514 alc861vd_3stack_init_verbs,
15515 alc861vd_eapd_verbs,
15516 alc861vd_lenovo_unsol_verbs },
15517 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15518 .dac_nids = alc660vd_dac_nids,
15519 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15520 .channel_mode = alc861vd_3stack_2ch_modes,
15521 .input_mux = &alc861vd_capture_source,
15522 .unsol_event = alc861vd_lenovo_unsol_event,
15523 .setup = alc861vd_lenovo_setup,
15524 .init_hook = alc861vd_lenovo_init_hook,
15526 [ALC861VD_DALLAS] = {
15527 .mixers = { alc861vd_dallas_mixer },
15528 .init_verbs = { alc861vd_dallas_verbs },
15529 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15530 .dac_nids = alc861vd_dac_nids,
15531 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15532 .channel_mode = alc861vd_3stack_2ch_modes,
15533 .input_mux = &alc861vd_dallas_capture_source,
15534 .unsol_event = alc_automute_amp_unsol_event,
15535 .setup = alc861vd_dallas_setup,
15536 .init_hook = alc_automute_amp,
15539 .mixers = { alc861vd_hp_mixer },
15540 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15541 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15542 .dac_nids = alc861vd_dac_nids,
15543 .dig_out_nid = ALC861VD_DIGOUT_NID,
15544 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15545 .channel_mode = alc861vd_3stack_2ch_modes,
15546 .input_mux = &alc861vd_hp_capture_source,
15547 .unsol_event = alc_automute_amp_unsol_event,
15548 .setup = alc861vd_dallas_setup,
15549 .init_hook = alc_automute_amp,
15551 [ALC660VD_ASUS_V1S] = {
15552 .mixers = { alc861vd_lenovo_mixer },
15553 .init_verbs = { alc861vd_volume_init_verbs,
15554 alc861vd_3stack_init_verbs,
15555 alc861vd_eapd_verbs,
15556 alc861vd_lenovo_unsol_verbs },
15557 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15558 .dac_nids = alc660vd_dac_nids,
15559 .dig_out_nid = ALC861VD_DIGOUT_NID,
15560 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15561 .channel_mode = alc861vd_3stack_2ch_modes,
15562 .input_mux = &alc861vd_capture_source,
15563 .unsol_event = alc861vd_lenovo_unsol_event,
15564 .setup = alc861vd_lenovo_setup,
15565 .init_hook = alc861vd_lenovo_init_hook,
15570 * BIOS auto configuration
15572 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15573 const struct auto_pin_cfg *cfg)
15575 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15579 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15580 hda_nid_t nid, int pin_type, int dac_idx)
15582 alc_set_pin_output(codec, nid, pin_type);
15585 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15587 struct alc_spec *spec = codec->spec;
15590 for (i = 0; i <= HDA_SIDE; i++) {
15591 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15592 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15594 alc861vd_auto_set_output_and_unmute(codec, nid,
15600 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15602 struct alc_spec *spec = codec->spec;
15605 pin = spec->autocfg.hp_pins[0];
15606 if (pin) /* connect to front and use dac 0 */
15607 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15608 pin = spec->autocfg.speaker_pins[0];
15610 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15613 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15615 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15617 struct alc_spec *spec = codec->spec;
15620 for (i = 0; i < AUTO_PIN_LAST; i++) {
15621 hda_nid_t nid = spec->autocfg.input_pins[i];
15622 if (alc_is_input_pin(codec, nid)) {
15623 alc_set_input_pin(codec, nid, i);
15624 if (nid != ALC861VD_PIN_CD_NID &&
15625 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15626 snd_hda_codec_write(codec, nid, 0,
15627 AC_VERB_SET_AMP_GAIN_MUTE,
15633 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15635 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15636 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15638 /* add playback controls from the parsed DAC table */
15639 /* Based on ALC880 version. But ALC861VD has separate,
15640 * different NIDs for mute/unmute switch and volume control */
15641 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15642 const struct auto_pin_cfg *cfg)
15644 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15645 hda_nid_t nid_v, nid_s;
15648 for (i = 0; i < cfg->line_outs; i++) {
15649 if (!spec->multiout.dac_nids[i])
15651 nid_v = alc861vd_idx_to_mixer_vol(
15653 spec->multiout.dac_nids[i]));
15654 nid_s = alc861vd_idx_to_mixer_switch(
15656 spec->multiout.dac_nids[i]));
15660 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15662 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15666 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15668 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15672 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15674 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15678 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15680 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15686 if (cfg->line_outs == 1 &&
15687 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15694 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15695 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15699 if (cfg->line_outs == 1 &&
15700 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15702 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15703 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15712 /* add playback controls for speaker and HP outputs */
15713 /* Based on ALC880 version. But ALC861VD has separate,
15714 * different NIDs for mute/unmute switch and volume control */
15715 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15716 hda_nid_t pin, const char *pfx)
15718 hda_nid_t nid_v, nid_s;
15724 if (alc880_is_fixed_pin(pin)) {
15725 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15726 /* specify the DAC as the extra output */
15727 if (!spec->multiout.hp_nid)
15728 spec->multiout.hp_nid = nid_v;
15730 spec->multiout.extra_out_nid[0] = nid_v;
15731 /* control HP volume/switch on the output mixer amp */
15732 nid_v = alc861vd_idx_to_mixer_vol(
15733 alc880_fixed_pin_idx(pin));
15734 nid_s = alc861vd_idx_to_mixer_switch(
15735 alc880_fixed_pin_idx(pin));
15737 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15738 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15741 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15742 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15745 } else if (alc880_is_multi_pin(pin)) {
15746 /* set manual connection */
15747 /* we have only a switch on HP-out PIN */
15748 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15749 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15756 /* parse the BIOS configuration and set up the alc_spec
15757 * return 1 if successful, 0 if the proper config is not found,
15758 * or a negative error code
15759 * Based on ALC880 version - had to change it to override
15760 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15761 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15763 struct alc_spec *spec = codec->spec;
15765 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15767 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15771 if (!spec->autocfg.line_outs)
15772 return 0; /* can't find valid BIOS pin config */
15774 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15777 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15780 err = alc861vd_auto_create_extra_out(spec,
15781 spec->autocfg.speaker_pins[0],
15785 err = alc861vd_auto_create_extra_out(spec,
15786 spec->autocfg.hp_pins[0],
15790 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15794 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15796 if (spec->autocfg.dig_outs)
15797 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15799 if (spec->kctls.list)
15800 add_mixer(spec, spec->kctls.list);
15802 add_verb(spec, alc861vd_volume_init_verbs);
15804 spec->num_mux_defs = 1;
15805 spec->input_mux = &spec->private_imux[0];
15807 err = alc_auto_add_mic_boost(codec);
15811 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15816 /* additional initialization for auto-configuration model */
15817 static void alc861vd_auto_init(struct hda_codec *codec)
15819 struct alc_spec *spec = codec->spec;
15820 alc861vd_auto_init_multi_out(codec);
15821 alc861vd_auto_init_hp_out(codec);
15822 alc861vd_auto_init_analog_input(codec);
15823 alc861vd_auto_init_input_src(codec);
15824 if (spec->unsol_event)
15825 alc_inithook(codec);
15829 ALC660VD_FIX_ASUS_GPIO1
15833 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15834 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15835 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15836 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15840 static const struct alc_fixup alc861vd_fixups[] = {
15841 [ALC660VD_FIX_ASUS_GPIO1] = {
15842 .verbs = alc660vd_fix_asus_gpio1_verbs,
15846 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15847 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15851 static int patch_alc861vd(struct hda_codec *codec)
15853 struct alc_spec *spec;
15854 int err, board_config;
15856 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15860 codec->spec = spec;
15862 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15866 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15867 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15869 board_config = ALC861VD_AUTO;
15872 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15874 if (board_config == ALC861VD_AUTO) {
15875 /* automatic parse from the BIOS config */
15876 err = alc861vd_parse_auto_config(codec);
15882 "hda_codec: Cannot set up configuration "
15883 "from BIOS. Using base mode...\n");
15884 board_config = ALC861VD_3ST;
15888 err = snd_hda_attach_beep_device(codec, 0x23);
15894 if (board_config != ALC861VD_AUTO)
15895 setup_preset(codec, &alc861vd_presets[board_config]);
15897 if (codec->vendor_id == 0x10ec0660) {
15898 /* always turn on EAPD */
15899 add_verb(spec, alc660vd_eapd_verbs);
15902 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15903 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15905 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15906 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15908 if (!spec->adc_nids) {
15909 spec->adc_nids = alc861vd_adc_nids;
15910 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15912 if (!spec->capsrc_nids)
15913 spec->capsrc_nids = alc861vd_capsrc_nids;
15915 set_capture_mixer(codec);
15916 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15918 spec->vmaster_nid = 0x02;
15920 codec->patch_ops = alc_patch_ops;
15922 if (board_config == ALC861VD_AUTO)
15923 spec->init_hook = alc861vd_auto_init;
15924 #ifdef CONFIG_SND_HDA_POWER_SAVE
15925 if (!spec->loopback.amplist)
15926 spec->loopback.amplist = alc861vd_loopbacks;
15928 codec->proc_widget_hook = print_realtek_coef;
15936 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15937 * configuration. Each pin widget can choose any input DACs and a mixer.
15938 * Each ADC is connected from a mixer of all inputs. This makes possible
15939 * 6-channel independent captures.
15941 * In addition, an independent DAC for the multi-playback (not used in this
15944 #define ALC662_DIGOUT_NID 0x06
15945 #define ALC662_DIGIN_NID 0x0a
15947 static hda_nid_t alc662_dac_nids[4] = {
15948 /* front, rear, clfe, rear_surr */
15952 static hda_nid_t alc272_dac_nids[2] = {
15956 static hda_nid_t alc662_adc_nids[2] = {
15961 static hda_nid_t alc272_adc_nids[1] = {
15966 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15967 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15971 /* FIXME: should be a matrix-type input source selection */
15972 static struct hda_input_mux alc662_capture_source = {
15976 { "Front Mic", 0x1 },
15982 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15990 static struct hda_input_mux alc663_capture_source = {
15994 { "Front Mic", 0x1 },
15999 #if 0 /* set to 1 for testing other input sources below */
16000 static struct hda_input_mux alc272_nc10_capture_source = {
16003 { "Autoselect Mic", 0x0 },
16004 { "Internal Mic", 0x1 },
16005 { "In-0x02", 0x2 },
16006 { "In-0x03", 0x3 },
16007 { "In-0x04", 0x4 },
16008 { "In-0x05", 0x5 },
16009 { "In-0x06", 0x6 },
16010 { "In-0x07", 0x7 },
16011 { "In-0x08", 0x8 },
16012 { "In-0x09", 0x9 },
16013 { "In-0x0a", 0x0a },
16014 { "In-0x0b", 0x0b },
16015 { "In-0x0c", 0x0c },
16016 { "In-0x0d", 0x0d },
16017 { "In-0x0e", 0x0e },
16018 { "In-0x0f", 0x0f },
16026 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16033 static struct hda_verb alc662_3ST_ch2_init[] = {
16034 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16035 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16036 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16037 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16044 static struct hda_verb alc662_3ST_ch6_init[] = {
16045 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16046 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16047 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16048 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16049 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16050 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16054 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16055 { 2, alc662_3ST_ch2_init },
16056 { 6, alc662_3ST_ch6_init },
16062 static struct hda_verb alc662_sixstack_ch6_init[] = {
16063 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16064 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16065 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16072 static struct hda_verb alc662_sixstack_ch8_init[] = {
16073 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16074 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16075 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16079 static struct hda_channel_mode alc662_5stack_modes[2] = {
16080 { 2, alc662_sixstack_ch6_init },
16081 { 6, alc662_sixstack_ch8_init },
16084 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16085 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16088 static struct snd_kcontrol_new alc662_base_mixer[] = {
16089 /* output mixer control */
16090 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16091 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16092 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16093 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16094 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16095 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16096 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16097 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16100 /*Input mixer control */
16101 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16102 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16103 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16104 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16105 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16106 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16107 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16108 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16112 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16113 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16114 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16116 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16117 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16118 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16119 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16122 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16123 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16127 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16128 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16129 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16130 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16131 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16132 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16133 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16134 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16135 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16136 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16137 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16138 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16143 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16144 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16148 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16149 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16150 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16151 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16152 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16153 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16154 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16155 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16161 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16162 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16163 ALC262_HIPPO_MASTER_SWITCH,
16165 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16166 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16167 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16169 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16170 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16171 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16175 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16176 ALC262_HIPPO_MASTER_SWITCH,
16177 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16178 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16179 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16180 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16181 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16189 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16190 .ops = &snd_hda_bind_vol,
16192 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16193 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16198 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16199 .ops = &snd_hda_bind_sw,
16201 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16202 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16207 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16208 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16209 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16211 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16215 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16216 .ops = &snd_hda_bind_sw,
16218 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16219 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16220 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16225 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16226 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16227 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16230 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16231 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16236 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16237 .ops = &snd_hda_bind_sw,
16239 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16240 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16241 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16246 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16247 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16248 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16251 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16252 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16256 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16257 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16258 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16260 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16261 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16262 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16263 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16267 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16268 .ops = &snd_hda_bind_vol,
16270 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16271 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16276 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16277 .ops = &snd_hda_bind_sw,
16279 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16280 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16285 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16286 HDA_BIND_VOL("Master Playback Volume",
16287 &alc663_asus_two_bind_master_vol),
16288 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16289 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16291 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16292 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16296 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16297 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16298 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16299 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16300 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16302 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16306 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16307 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16308 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16309 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16310 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16315 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16316 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16320 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16321 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16322 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16323 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16326 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16327 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16328 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16329 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16330 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16334 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16335 .ops = &snd_hda_bind_sw,
16337 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16338 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16339 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16340 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16341 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16346 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16347 .ops = &snd_hda_bind_sw,
16349 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16350 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16355 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16356 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16357 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16358 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16359 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16360 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16361 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16362 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16368 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16369 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16370 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16371 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16372 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16373 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16380 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16382 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16383 .name = "Channel Mode",
16384 .info = alc_ch_mode_info,
16385 .get = alc_ch_mode_get,
16386 .put = alc_ch_mode_put,
16391 static struct hda_verb alc662_init_verbs[] = {
16392 /* ADC: mute amp left and right */
16393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16394 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16395 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16406 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16410 /* Front Pin: output 0 (0x0c) */
16411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16412 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16414 /* Rear Pin: output 1 (0x0d) */
16415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16418 /* CLFE Pin: output 2 (0x0e) */
16419 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16420 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16422 /* Mic (rear) pin: input vref at 80% */
16423 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16424 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16425 /* Front Mic pin: input vref at 80% */
16426 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16427 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16428 /* Line In pin: input */
16429 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16430 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16431 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16432 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16433 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16434 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16435 /* CD pin widget for input */
16436 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16438 /* FIXME: use matrix-type input source selection */
16439 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16441 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16444 /* always trun on EAPD */
16445 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16446 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16451 static struct hda_verb alc662_sue_init_verbs[] = {
16452 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16453 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16457 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16458 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16459 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16463 /* Set Unsolicited Event*/
16464 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16465 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16466 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16471 * generic initialization of ADC, input mixers and output mixers
16473 static struct hda_verb alc662_auto_init_verbs[] = {
16475 * Unmute ADC and set the default input to mic-in
16477 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16478 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16480 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16482 * Note: PASD motherboards uses the Line In 2 as the input for front
16483 * panel mic (mic 2)
16485 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16493 * Set up output mixers (0x0c - 0x0f)
16495 /* set vol=0 to output mixers */
16496 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16497 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16498 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16500 /* set up input amps for analog loopback */
16501 /* Amp Indices: DAC = 0, mixer = 1 */
16502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16510 /* FIXME: use matrix-type input source selection */
16511 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16518 /* additional verbs for ALC663 */
16519 static struct hda_verb alc663_auto_init_verbs[] = {
16520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16525 static struct hda_verb alc663_m51va_init_verbs[] = {
16526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16528 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16529 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16530 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16533 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16534 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16538 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16539 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16540 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16541 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16542 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16544 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16545 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16549 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16550 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16551 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16552 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16553 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16556 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16557 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16561 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16562 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16564 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16565 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16567 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16568 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16572 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16573 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16574 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16575 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16576 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16577 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16578 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16579 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16582 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16583 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16584 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16588 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16589 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16591 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16592 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16593 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16594 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16598 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16599 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16600 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16604 static struct hda_verb alc663_g71v_init_verbs[] = {
16605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16606 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16607 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16609 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16610 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16611 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16613 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16614 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16615 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16619 static struct hda_verb alc663_g50v_init_verbs[] = {
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, 0x00}, /* Headphone */
16624 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16625 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16629 static struct hda_verb alc662_ecs_init_verbs[] = {
16630 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16631 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16632 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16633 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16637 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16638 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16639 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16640 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16641 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16642 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16643 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16644 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16645 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16647 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16648 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16652 static struct hda_verb alc272_dell_init_verbs[] = {
16653 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16654 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16656 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16657 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16658 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16659 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16662 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16663 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16667 static struct hda_verb alc663_mode7_init_verbs[] = {
16668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16669 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16670 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16671 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16672 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16673 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16674 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16675 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16676 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16677 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16678 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16680 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16681 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16682 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16686 static struct hda_verb alc663_mode8_init_verbs[] = {
16687 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16690 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16691 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16692 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16694 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16695 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16696 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16697 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16699 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16700 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16701 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16702 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16706 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16707 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16708 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16712 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16713 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16714 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16718 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16720 unsigned int present;
16721 unsigned char bits;
16723 present = snd_hda_jack_detect(codec, 0x14);
16724 bits = present ? HDA_AMP_MUTE : 0;
16726 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16727 HDA_AMP_MUTE, bits);
16730 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16732 unsigned int present;
16733 unsigned char bits;
16735 present = snd_hda_jack_detect(codec, 0x1b);
16736 bits = present ? HDA_AMP_MUTE : 0;
16738 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16739 HDA_AMP_MUTE, bits);
16740 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16741 HDA_AMP_MUTE, bits);
16744 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16747 if ((res >> 26) == ALC880_HP_EVENT)
16748 alc662_lenovo_101e_all_automute(codec);
16749 if ((res >> 26) == ALC880_FRONT_EVENT)
16750 alc662_lenovo_101e_ispeaker_automute(codec);
16753 /* unsolicited event for HP jack sensing */
16754 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16757 if ((res >> 26) == ALC880_MIC_EVENT)
16758 alc_mic_automute(codec);
16760 alc262_hippo_unsol_event(codec, res);
16763 static void alc662_eeepc_setup(struct hda_codec *codec)
16765 struct alc_spec *spec = codec->spec;
16767 alc262_hippo1_setup(codec);
16768 spec->ext_mic.pin = 0x18;
16769 spec->ext_mic.mux_idx = 0;
16770 spec->int_mic.pin = 0x19;
16771 spec->int_mic.mux_idx = 1;
16772 spec->auto_mic = 1;
16775 static void alc662_eeepc_inithook(struct hda_codec *codec)
16777 alc262_hippo_automute(codec);
16778 alc_mic_automute(codec);
16781 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16783 struct alc_spec *spec = codec->spec;
16785 spec->autocfg.hp_pins[0] = 0x14;
16786 spec->autocfg.speaker_pins[0] = 0x1b;
16789 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16791 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16793 unsigned int present;
16794 unsigned char bits;
16796 present = snd_hda_jack_detect(codec, 0x21);
16797 bits = present ? HDA_AMP_MUTE : 0;
16798 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16799 AMP_IN_MUTE(0), bits);
16800 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16801 AMP_IN_MUTE(0), bits);
16804 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16806 unsigned int present;
16807 unsigned char bits;
16809 present = snd_hda_jack_detect(codec, 0x21);
16810 bits = present ? HDA_AMP_MUTE : 0;
16811 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16812 AMP_IN_MUTE(0), bits);
16813 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16814 AMP_IN_MUTE(0), bits);
16815 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16816 AMP_IN_MUTE(0), bits);
16817 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16818 AMP_IN_MUTE(0), bits);
16821 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16823 unsigned int present;
16824 unsigned char bits;
16826 present = snd_hda_jack_detect(codec, 0x15);
16827 bits = present ? HDA_AMP_MUTE : 0;
16828 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16829 AMP_IN_MUTE(0), bits);
16830 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16831 AMP_IN_MUTE(0), bits);
16832 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16833 AMP_IN_MUTE(0), bits);
16834 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16835 AMP_IN_MUTE(0), bits);
16838 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16840 unsigned int present;
16841 unsigned char bits;
16843 present = snd_hda_jack_detect(codec, 0x1b);
16844 bits = present ? 0 : PIN_OUT;
16845 snd_hda_codec_write(codec, 0x14, 0,
16846 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16849 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16851 unsigned int present1, present2;
16853 present1 = snd_hda_jack_detect(codec, 0x21);
16854 present2 = snd_hda_jack_detect(codec, 0x15);
16856 if (present1 || present2) {
16857 snd_hda_codec_write_cache(codec, 0x14, 0,
16858 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16860 snd_hda_codec_write_cache(codec, 0x14, 0,
16861 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16865 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16867 unsigned int present1, present2;
16869 present1 = snd_hda_jack_detect(codec, 0x1b);
16870 present2 = snd_hda_jack_detect(codec, 0x15);
16872 if (present1 || present2) {
16873 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16874 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16875 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16876 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16878 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16879 AMP_IN_MUTE(0), 0);
16880 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16881 AMP_IN_MUTE(0), 0);
16885 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16887 unsigned int present1, present2;
16889 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16890 AC_VERB_GET_PIN_SENSE, 0)
16891 & AC_PINSENSE_PRESENCE;
16892 present2 = snd_hda_codec_read(codec, 0x21, 0,
16893 AC_VERB_GET_PIN_SENSE, 0)
16894 & AC_PINSENSE_PRESENCE;
16896 if (present1 || present2) {
16897 snd_hda_codec_write_cache(codec, 0x14, 0,
16898 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16899 snd_hda_codec_write_cache(codec, 0x17, 0,
16900 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16902 snd_hda_codec_write_cache(codec, 0x14, 0,
16903 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16904 snd_hda_codec_write_cache(codec, 0x17, 0,
16905 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16909 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16911 unsigned int present1, present2;
16913 present1 = snd_hda_codec_read(codec, 0x21, 0,
16914 AC_VERB_GET_PIN_SENSE, 0)
16915 & AC_PINSENSE_PRESENCE;
16916 present2 = snd_hda_codec_read(codec, 0x15, 0,
16917 AC_VERB_GET_PIN_SENSE, 0)
16918 & AC_PINSENSE_PRESENCE;
16920 if (present1 || present2) {
16921 snd_hda_codec_write_cache(codec, 0x14, 0,
16922 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16923 snd_hda_codec_write_cache(codec, 0x17, 0,
16924 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16926 snd_hda_codec_write_cache(codec, 0x14, 0,
16927 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16928 snd_hda_codec_write_cache(codec, 0x17, 0,
16929 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16933 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16936 switch (res >> 26) {
16937 case ALC880_HP_EVENT:
16938 alc663_m51va_speaker_automute(codec);
16940 case ALC880_MIC_EVENT:
16941 alc_mic_automute(codec);
16946 static void alc663_m51va_setup(struct hda_codec *codec)
16948 struct alc_spec *spec = codec->spec;
16949 spec->ext_mic.pin = 0x18;
16950 spec->ext_mic.mux_idx = 0;
16951 spec->int_mic.pin = 0x12;
16952 spec->int_mic.mux_idx = 9;
16953 spec->auto_mic = 1;
16956 static void alc663_m51va_inithook(struct hda_codec *codec)
16958 alc663_m51va_speaker_automute(codec);
16959 alc_mic_automute(codec);
16962 /* ***************** Mode1 ******************************/
16963 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16965 static void alc663_mode1_setup(struct hda_codec *codec)
16967 struct alc_spec *spec = codec->spec;
16968 spec->ext_mic.pin = 0x18;
16969 spec->ext_mic.mux_idx = 0;
16970 spec->int_mic.pin = 0x19;
16971 spec->int_mic.mux_idx = 1;
16972 spec->auto_mic = 1;
16975 #define alc663_mode1_inithook alc663_m51va_inithook
16977 /* ***************** Mode2 ******************************/
16978 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16981 switch (res >> 26) {
16982 case ALC880_HP_EVENT:
16983 alc662_f5z_speaker_automute(codec);
16985 case ALC880_MIC_EVENT:
16986 alc_mic_automute(codec);
16991 #define alc662_mode2_setup alc663_mode1_setup
16993 static void alc662_mode2_inithook(struct hda_codec *codec)
16995 alc662_f5z_speaker_automute(codec);
16996 alc_mic_automute(codec);
16998 /* ***************** Mode3 ******************************/
16999 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17002 switch (res >> 26) {
17003 case ALC880_HP_EVENT:
17004 alc663_two_hp_m1_speaker_automute(codec);
17006 case ALC880_MIC_EVENT:
17007 alc_mic_automute(codec);
17012 #define alc663_mode3_setup alc663_mode1_setup
17014 static void alc663_mode3_inithook(struct hda_codec *codec)
17016 alc663_two_hp_m1_speaker_automute(codec);
17017 alc_mic_automute(codec);
17019 /* ***************** Mode4 ******************************/
17020 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17023 switch (res >> 26) {
17024 case ALC880_HP_EVENT:
17025 alc663_21jd_two_speaker_automute(codec);
17027 case ALC880_MIC_EVENT:
17028 alc_mic_automute(codec);
17033 #define alc663_mode4_setup alc663_mode1_setup
17035 static void alc663_mode4_inithook(struct hda_codec *codec)
17037 alc663_21jd_two_speaker_automute(codec);
17038 alc_mic_automute(codec);
17040 /* ***************** Mode5 ******************************/
17041 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17044 switch (res >> 26) {
17045 case ALC880_HP_EVENT:
17046 alc663_15jd_two_speaker_automute(codec);
17048 case ALC880_MIC_EVENT:
17049 alc_mic_automute(codec);
17054 #define alc663_mode5_setup alc663_mode1_setup
17056 static void alc663_mode5_inithook(struct hda_codec *codec)
17058 alc663_15jd_two_speaker_automute(codec);
17059 alc_mic_automute(codec);
17061 /* ***************** Mode6 ******************************/
17062 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17065 switch (res >> 26) {
17066 case ALC880_HP_EVENT:
17067 alc663_two_hp_m2_speaker_automute(codec);
17069 case ALC880_MIC_EVENT:
17070 alc_mic_automute(codec);
17075 #define alc663_mode6_setup alc663_mode1_setup
17077 static void alc663_mode6_inithook(struct hda_codec *codec)
17079 alc663_two_hp_m2_speaker_automute(codec);
17080 alc_mic_automute(codec);
17083 /* ***************** Mode7 ******************************/
17084 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17087 switch (res >> 26) {
17088 case ALC880_HP_EVENT:
17089 alc663_two_hp_m7_speaker_automute(codec);
17091 case ALC880_MIC_EVENT:
17092 alc_mic_automute(codec);
17097 #define alc663_mode7_setup alc663_mode1_setup
17099 static void alc663_mode7_inithook(struct hda_codec *codec)
17101 alc663_two_hp_m7_speaker_automute(codec);
17102 alc_mic_automute(codec);
17105 /* ***************** Mode8 ******************************/
17106 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17109 switch (res >> 26) {
17110 case ALC880_HP_EVENT:
17111 alc663_two_hp_m8_speaker_automute(codec);
17113 case ALC880_MIC_EVENT:
17114 alc_mic_automute(codec);
17119 #define alc663_mode8_setup alc663_m51va_setup
17121 static void alc663_mode8_inithook(struct hda_codec *codec)
17123 alc663_two_hp_m8_speaker_automute(codec);
17124 alc_mic_automute(codec);
17127 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17129 unsigned int present;
17130 unsigned char bits;
17132 present = snd_hda_jack_detect(codec, 0x21);
17133 bits = present ? HDA_AMP_MUTE : 0;
17134 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17135 HDA_AMP_MUTE, bits);
17136 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17137 HDA_AMP_MUTE, bits);
17140 static void alc663_g71v_front_automute(struct hda_codec *codec)
17142 unsigned int present;
17143 unsigned char bits;
17145 present = snd_hda_jack_detect(codec, 0x15);
17146 bits = present ? HDA_AMP_MUTE : 0;
17147 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17148 HDA_AMP_MUTE, bits);
17151 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17154 switch (res >> 26) {
17155 case ALC880_HP_EVENT:
17156 alc663_g71v_hp_automute(codec);
17158 case ALC880_FRONT_EVENT:
17159 alc663_g71v_front_automute(codec);
17161 case ALC880_MIC_EVENT:
17162 alc_mic_automute(codec);
17167 #define alc663_g71v_setup alc663_m51va_setup
17169 static void alc663_g71v_inithook(struct hda_codec *codec)
17171 alc663_g71v_front_automute(codec);
17172 alc663_g71v_hp_automute(codec);
17173 alc_mic_automute(codec);
17176 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17179 switch (res >> 26) {
17180 case ALC880_HP_EVENT:
17181 alc663_m51va_speaker_automute(codec);
17183 case ALC880_MIC_EVENT:
17184 alc_mic_automute(codec);
17189 #define alc663_g50v_setup alc663_m51va_setup
17191 static void alc663_g50v_inithook(struct hda_codec *codec)
17193 alc663_m51va_speaker_automute(codec);
17194 alc_mic_automute(codec);
17197 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17198 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17199 ALC262_HIPPO_MASTER_SWITCH,
17201 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17202 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17203 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17205 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17206 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17207 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17211 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17212 /* Master Playback automatically created from Speaker and Headphone */
17213 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17214 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17216 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17218 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17219 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17220 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17222 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17223 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17224 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17228 #ifdef CONFIG_SND_HDA_POWER_SAVE
17229 #define alc662_loopbacks alc880_loopbacks
17233 /* pcm configuration: identical with ALC880 */
17234 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17235 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17236 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17237 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17240 * configuration and preset
17242 static const char *alc662_models[ALC662_MODEL_LAST] = {
17243 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17244 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17245 [ALC662_3ST_6ch] = "3stack-6ch",
17246 [ALC662_5ST_DIG] = "6stack-dig",
17247 [ALC662_LENOVO_101E] = "lenovo-101e",
17248 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17249 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17250 [ALC662_ECS] = "ecs",
17251 [ALC663_ASUS_M51VA] = "m51va",
17252 [ALC663_ASUS_G71V] = "g71v",
17253 [ALC663_ASUS_H13] = "h13",
17254 [ALC663_ASUS_G50V] = "g50v",
17255 [ALC663_ASUS_MODE1] = "asus-mode1",
17256 [ALC662_ASUS_MODE2] = "asus-mode2",
17257 [ALC663_ASUS_MODE3] = "asus-mode3",
17258 [ALC663_ASUS_MODE4] = "asus-mode4",
17259 [ALC663_ASUS_MODE5] = "asus-mode5",
17260 [ALC663_ASUS_MODE6] = "asus-mode6",
17261 [ALC663_ASUS_MODE7] = "asus-mode7",
17262 [ALC663_ASUS_MODE8] = "asus-mode8",
17263 [ALC272_DELL] = "dell",
17264 [ALC272_DELL_ZM1] = "dell-zm1",
17265 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17266 [ALC662_AUTO] = "auto",
17269 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17270 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17271 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17272 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17273 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17274 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17275 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17276 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17277 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17278 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17279 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17280 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17281 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17282 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17283 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17284 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17285 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17286 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17287 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17288 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17289 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17290 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17291 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17292 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17293 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17294 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17295 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17296 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17297 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17298 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17299 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17300 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17301 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17302 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17303 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17304 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17305 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17306 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17307 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17308 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17309 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17310 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17311 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17312 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17313 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17314 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17315 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17316 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17317 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17318 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17319 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17320 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17321 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17322 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17323 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17324 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17325 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17326 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17327 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17328 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17329 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17330 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17331 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17332 ALC662_3ST_6ch_DIG),
17333 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17334 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17335 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17336 ALC662_3ST_6ch_DIG),
17337 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17338 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17339 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17340 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17341 ALC662_3ST_6ch_DIG),
17342 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17344 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17348 static struct alc_config_preset alc662_presets[] = {
17349 [ALC662_3ST_2ch_DIG] = {
17350 .mixers = { alc662_3ST_2ch_mixer },
17351 .init_verbs = { alc662_init_verbs },
17352 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17353 .dac_nids = alc662_dac_nids,
17354 .dig_out_nid = ALC662_DIGOUT_NID,
17355 .dig_in_nid = ALC662_DIGIN_NID,
17356 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17357 .channel_mode = alc662_3ST_2ch_modes,
17358 .input_mux = &alc662_capture_source,
17360 [ALC662_3ST_6ch_DIG] = {
17361 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17362 .init_verbs = { alc662_init_verbs },
17363 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17364 .dac_nids = alc662_dac_nids,
17365 .dig_out_nid = ALC662_DIGOUT_NID,
17366 .dig_in_nid = ALC662_DIGIN_NID,
17367 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17368 .channel_mode = alc662_3ST_6ch_modes,
17370 .input_mux = &alc662_capture_source,
17372 [ALC662_3ST_6ch] = {
17373 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17374 .init_verbs = { alc662_init_verbs },
17375 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17376 .dac_nids = alc662_dac_nids,
17377 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17378 .channel_mode = alc662_3ST_6ch_modes,
17380 .input_mux = &alc662_capture_source,
17382 [ALC662_5ST_DIG] = {
17383 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17384 .init_verbs = { alc662_init_verbs },
17385 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17386 .dac_nids = alc662_dac_nids,
17387 .dig_out_nid = ALC662_DIGOUT_NID,
17388 .dig_in_nid = ALC662_DIGIN_NID,
17389 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17390 .channel_mode = alc662_5stack_modes,
17391 .input_mux = &alc662_capture_source,
17393 [ALC662_LENOVO_101E] = {
17394 .mixers = { alc662_lenovo_101e_mixer },
17395 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17396 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17397 .dac_nids = alc662_dac_nids,
17398 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17399 .channel_mode = alc662_3ST_2ch_modes,
17400 .input_mux = &alc662_lenovo_101e_capture_source,
17401 .unsol_event = alc662_lenovo_101e_unsol_event,
17402 .init_hook = alc662_lenovo_101e_all_automute,
17404 [ALC662_ASUS_EEEPC_P701] = {
17405 .mixers = { alc662_eeepc_p701_mixer },
17406 .init_verbs = { alc662_init_verbs,
17407 alc662_eeepc_sue_init_verbs },
17408 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17409 .dac_nids = alc662_dac_nids,
17410 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17411 .channel_mode = alc662_3ST_2ch_modes,
17412 .unsol_event = alc662_eeepc_unsol_event,
17413 .setup = alc662_eeepc_setup,
17414 .init_hook = alc662_eeepc_inithook,
17416 [ALC662_ASUS_EEEPC_EP20] = {
17417 .mixers = { alc662_eeepc_ep20_mixer,
17418 alc662_chmode_mixer },
17419 .init_verbs = { alc662_init_verbs,
17420 alc662_eeepc_ep20_sue_init_verbs },
17421 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17422 .dac_nids = alc662_dac_nids,
17423 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17424 .channel_mode = alc662_3ST_6ch_modes,
17425 .input_mux = &alc662_lenovo_101e_capture_source,
17426 .unsol_event = alc662_eeepc_unsol_event,
17427 .setup = alc662_eeepc_ep20_setup,
17428 .init_hook = alc662_eeepc_ep20_inithook,
17431 .mixers = { alc662_ecs_mixer },
17432 .init_verbs = { alc662_init_verbs,
17433 alc662_ecs_init_verbs },
17434 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17435 .dac_nids = alc662_dac_nids,
17436 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17437 .channel_mode = alc662_3ST_2ch_modes,
17438 .unsol_event = alc662_eeepc_unsol_event,
17439 .setup = alc662_eeepc_setup,
17440 .init_hook = alc662_eeepc_inithook,
17442 [ALC663_ASUS_M51VA] = {
17443 .mixers = { alc663_m51va_mixer },
17444 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17445 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17446 .dac_nids = alc662_dac_nids,
17447 .dig_out_nid = ALC662_DIGOUT_NID,
17448 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17449 .channel_mode = alc662_3ST_2ch_modes,
17450 .unsol_event = alc663_m51va_unsol_event,
17451 .setup = alc663_m51va_setup,
17452 .init_hook = alc663_m51va_inithook,
17454 [ALC663_ASUS_G71V] = {
17455 .mixers = { alc663_g71v_mixer },
17456 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17457 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17458 .dac_nids = alc662_dac_nids,
17459 .dig_out_nid = ALC662_DIGOUT_NID,
17460 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17461 .channel_mode = alc662_3ST_2ch_modes,
17462 .unsol_event = alc663_g71v_unsol_event,
17463 .setup = alc663_g71v_setup,
17464 .init_hook = alc663_g71v_inithook,
17466 [ALC663_ASUS_H13] = {
17467 .mixers = { alc663_m51va_mixer },
17468 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17469 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17470 .dac_nids = alc662_dac_nids,
17471 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17472 .channel_mode = alc662_3ST_2ch_modes,
17473 .unsol_event = alc663_m51va_unsol_event,
17474 .init_hook = alc663_m51va_inithook,
17476 [ALC663_ASUS_G50V] = {
17477 .mixers = { alc663_g50v_mixer },
17478 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17479 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17480 .dac_nids = alc662_dac_nids,
17481 .dig_out_nid = ALC662_DIGOUT_NID,
17482 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17483 .channel_mode = alc662_3ST_6ch_modes,
17484 .input_mux = &alc663_capture_source,
17485 .unsol_event = alc663_g50v_unsol_event,
17486 .setup = alc663_g50v_setup,
17487 .init_hook = alc663_g50v_inithook,
17489 [ALC663_ASUS_MODE1] = {
17490 .mixers = { alc663_m51va_mixer },
17491 .cap_mixer = alc662_auto_capture_mixer,
17492 .init_verbs = { alc662_init_verbs,
17493 alc663_21jd_amic_init_verbs },
17494 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17496 .dac_nids = alc662_dac_nids,
17497 .dig_out_nid = ALC662_DIGOUT_NID,
17498 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17499 .channel_mode = alc662_3ST_2ch_modes,
17500 .unsol_event = alc663_mode1_unsol_event,
17501 .setup = alc663_mode1_setup,
17502 .init_hook = alc663_mode1_inithook,
17504 [ALC662_ASUS_MODE2] = {
17505 .mixers = { alc662_1bjd_mixer },
17506 .cap_mixer = alc662_auto_capture_mixer,
17507 .init_verbs = { alc662_init_verbs,
17508 alc662_1bjd_amic_init_verbs },
17509 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17510 .dac_nids = alc662_dac_nids,
17511 .dig_out_nid = ALC662_DIGOUT_NID,
17512 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17513 .channel_mode = alc662_3ST_2ch_modes,
17514 .unsol_event = alc662_mode2_unsol_event,
17515 .setup = alc662_mode2_setup,
17516 .init_hook = alc662_mode2_inithook,
17518 [ALC663_ASUS_MODE3] = {
17519 .mixers = { alc663_two_hp_m1_mixer },
17520 .cap_mixer = alc662_auto_capture_mixer,
17521 .init_verbs = { alc662_init_verbs,
17522 alc663_two_hp_amic_m1_init_verbs },
17523 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17525 .dac_nids = alc662_dac_nids,
17526 .dig_out_nid = ALC662_DIGOUT_NID,
17527 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17528 .channel_mode = alc662_3ST_2ch_modes,
17529 .unsol_event = alc663_mode3_unsol_event,
17530 .setup = alc663_mode3_setup,
17531 .init_hook = alc663_mode3_inithook,
17533 [ALC663_ASUS_MODE4] = {
17534 .mixers = { alc663_asus_21jd_clfe_mixer },
17535 .cap_mixer = alc662_auto_capture_mixer,
17536 .init_verbs = { alc662_init_verbs,
17537 alc663_21jd_amic_init_verbs},
17538 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17540 .dac_nids = alc662_dac_nids,
17541 .dig_out_nid = ALC662_DIGOUT_NID,
17542 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17543 .channel_mode = alc662_3ST_2ch_modes,
17544 .unsol_event = alc663_mode4_unsol_event,
17545 .setup = alc663_mode4_setup,
17546 .init_hook = alc663_mode4_inithook,
17548 [ALC663_ASUS_MODE5] = {
17549 .mixers = { alc663_asus_15jd_clfe_mixer },
17550 .cap_mixer = alc662_auto_capture_mixer,
17551 .init_verbs = { alc662_init_verbs,
17552 alc663_15jd_amic_init_verbs },
17553 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17555 .dac_nids = alc662_dac_nids,
17556 .dig_out_nid = ALC662_DIGOUT_NID,
17557 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17558 .channel_mode = alc662_3ST_2ch_modes,
17559 .unsol_event = alc663_mode5_unsol_event,
17560 .setup = alc663_mode5_setup,
17561 .init_hook = alc663_mode5_inithook,
17563 [ALC663_ASUS_MODE6] = {
17564 .mixers = { alc663_two_hp_m2_mixer },
17565 .cap_mixer = alc662_auto_capture_mixer,
17566 .init_verbs = { alc662_init_verbs,
17567 alc663_two_hp_amic_m2_init_verbs },
17568 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17570 .dac_nids = alc662_dac_nids,
17571 .dig_out_nid = ALC662_DIGOUT_NID,
17572 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17573 .channel_mode = alc662_3ST_2ch_modes,
17574 .unsol_event = alc663_mode6_unsol_event,
17575 .setup = alc663_mode6_setup,
17576 .init_hook = alc663_mode6_inithook,
17578 [ALC663_ASUS_MODE7] = {
17579 .mixers = { alc663_mode7_mixer },
17580 .cap_mixer = alc662_auto_capture_mixer,
17581 .init_verbs = { alc662_init_verbs,
17582 alc663_mode7_init_verbs },
17583 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17585 .dac_nids = alc662_dac_nids,
17586 .dig_out_nid = ALC662_DIGOUT_NID,
17587 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17588 .channel_mode = alc662_3ST_2ch_modes,
17589 .unsol_event = alc663_mode7_unsol_event,
17590 .setup = alc663_mode7_setup,
17591 .init_hook = alc663_mode7_inithook,
17593 [ALC663_ASUS_MODE8] = {
17594 .mixers = { alc663_mode8_mixer },
17595 .cap_mixer = alc662_auto_capture_mixer,
17596 .init_verbs = { alc662_init_verbs,
17597 alc663_mode8_init_verbs },
17598 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17600 .dac_nids = alc662_dac_nids,
17601 .dig_out_nid = ALC662_DIGOUT_NID,
17602 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17603 .channel_mode = alc662_3ST_2ch_modes,
17604 .unsol_event = alc663_mode8_unsol_event,
17605 .setup = alc663_mode8_setup,
17606 .init_hook = alc663_mode8_inithook,
17609 .mixers = { alc663_m51va_mixer },
17610 .cap_mixer = alc272_auto_capture_mixer,
17611 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17612 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17613 .dac_nids = alc662_dac_nids,
17614 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17615 .adc_nids = alc272_adc_nids,
17616 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17617 .capsrc_nids = alc272_capsrc_nids,
17618 .channel_mode = alc662_3ST_2ch_modes,
17619 .unsol_event = alc663_m51va_unsol_event,
17620 .setup = alc663_m51va_setup,
17621 .init_hook = alc663_m51va_inithook,
17623 [ALC272_DELL_ZM1] = {
17624 .mixers = { alc663_m51va_mixer },
17625 .cap_mixer = alc662_auto_capture_mixer,
17626 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17627 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17628 .dac_nids = alc662_dac_nids,
17629 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17630 .adc_nids = alc662_adc_nids,
17632 .capsrc_nids = alc662_capsrc_nids,
17633 .channel_mode = alc662_3ST_2ch_modes,
17634 .unsol_event = alc663_m51va_unsol_event,
17635 .setup = alc663_m51va_setup,
17636 .init_hook = alc663_m51va_inithook,
17638 [ALC272_SAMSUNG_NC10] = {
17639 .mixers = { alc272_nc10_mixer },
17640 .init_verbs = { alc662_init_verbs,
17641 alc663_21jd_amic_init_verbs },
17642 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17643 .dac_nids = alc272_dac_nids,
17644 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17645 .channel_mode = alc662_3ST_2ch_modes,
17646 /*.input_mux = &alc272_nc10_capture_source,*/
17647 .unsol_event = alc663_mode4_unsol_event,
17648 .setup = alc663_mode4_setup,
17649 .init_hook = alc663_mode4_inithook,
17655 * BIOS auto configuration
17658 /* convert from MIX nid to DAC */
17659 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17663 else if (nid >= 0x0c && nid <= 0x0e)
17664 return nid - 0x0c + 0x02;
17669 /* get MIX nid connected to the given pin targeted to DAC */
17670 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17676 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17677 for (i = 0; i < num; i++) {
17678 if (alc662_mix_to_dac(mix[i]) == dac)
17684 /* look for an empty DAC slot */
17685 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17687 struct alc_spec *spec = codec->spec;
17691 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17694 for (i = 0; i < num; i++) {
17695 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17698 for (j = 0; j < spec->multiout.num_dacs; j++)
17699 if (spec->multiout.dac_nids[j] == nid)
17701 if (j >= spec->multiout.num_dacs)
17707 /* fill in the dac_nids table from the parsed pin configuration */
17708 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17709 const struct auto_pin_cfg *cfg)
17711 struct alc_spec *spec = codec->spec;
17715 spec->multiout.dac_nids = spec->private_dac_nids;
17716 for (i = 0; i < cfg->line_outs; i++) {
17717 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17720 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17725 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17726 hda_nid_t nid, unsigned int chs)
17728 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17729 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17732 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17733 hda_nid_t nid, unsigned int chs)
17735 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17736 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17739 #define alc662_add_stereo_vol(spec, pfx, nid) \
17740 alc662_add_vol_ctl(spec, pfx, nid, 3)
17741 #define alc662_add_stereo_sw(spec, pfx, nid) \
17742 alc662_add_sw_ctl(spec, pfx, nid, 3)
17744 /* add playback controls from the parsed DAC table */
17745 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17746 const struct auto_pin_cfg *cfg)
17748 struct alc_spec *spec = codec->spec;
17749 static const char *chname[4] = {
17750 "Front", "Surround", NULL /*CLFE*/, "Side"
17752 hda_nid_t nid, mix;
17755 for (i = 0; i < cfg->line_outs; i++) {
17756 nid = spec->multiout.dac_nids[i];
17759 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17764 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17767 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17770 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17773 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17778 if (cfg->line_outs == 1 &&
17779 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17786 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17789 if (cfg->line_outs == 1 &&
17790 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17792 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17800 /* add playback controls for speaker and HP outputs */
17801 /* return DAC nid if any new DAC is assigned */
17802 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17805 struct alc_spec *spec = codec->spec;
17806 hda_nid_t nid, mix;
17811 nid = alc662_look_for_dac(codec, pin);
17813 /* the corresponding DAC is already occupied */
17814 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17815 return 0; /* no way */
17816 /* create a switch only */
17817 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17818 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17821 mix = alc662_dac_to_mix(codec, pin, nid);
17824 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17827 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17833 /* create playback/capture controls for input pins */
17834 #define alc662_auto_create_input_ctls \
17835 alc882_auto_create_input_ctls
17837 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17838 hda_nid_t nid, int pin_type,
17844 alc_set_pin_output(codec, nid, pin_type);
17845 /* need the manual connection? */
17846 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17849 for (i = 0; i < num; i++) {
17850 if (alc662_mix_to_dac(srcs[i]) != dac)
17852 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17857 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17859 struct alc_spec *spec = codec->spec;
17860 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17863 for (i = 0; i <= HDA_SIDE; i++) {
17864 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17866 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17867 spec->multiout.dac_nids[i]);
17871 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17873 struct alc_spec *spec = codec->spec;
17876 pin = spec->autocfg.hp_pins[0];
17878 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17879 spec->multiout.hp_nid);
17880 pin = spec->autocfg.speaker_pins[0];
17882 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17883 spec->multiout.extra_out_nid[0]);
17886 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17888 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17890 struct alc_spec *spec = codec->spec;
17893 for (i = 0; i < AUTO_PIN_LAST; i++) {
17894 hda_nid_t nid = spec->autocfg.input_pins[i];
17895 if (alc_is_input_pin(codec, nid)) {
17896 alc_set_input_pin(codec, nid, i);
17897 if (nid != ALC662_PIN_CD_NID &&
17898 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17899 snd_hda_codec_write(codec, nid, 0,
17900 AC_VERB_SET_AMP_GAIN_MUTE,
17906 #define alc662_auto_init_input_src alc882_auto_init_input_src
17908 static int alc662_parse_auto_config(struct hda_codec *codec)
17910 struct alc_spec *spec = codec->spec;
17912 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17914 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17918 if (!spec->autocfg.line_outs)
17919 return 0; /* can't find valid BIOS pin config */
17921 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17924 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17927 err = alc662_auto_create_extra_out(codec,
17928 spec->autocfg.speaker_pins[0],
17933 spec->multiout.extra_out_nid[0] = err;
17934 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17939 spec->multiout.hp_nid = err;
17940 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17944 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17946 if (spec->autocfg.dig_outs)
17947 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17949 if (spec->kctls.list)
17950 add_mixer(spec, spec->kctls.list);
17952 spec->num_mux_defs = 1;
17953 spec->input_mux = &spec->private_imux[0];
17955 add_verb(spec, alc662_auto_init_verbs);
17956 if (codec->vendor_id == 0x10ec0663)
17957 add_verb(spec, alc663_auto_init_verbs);
17959 err = alc_auto_add_mic_boost(codec);
17963 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17968 /* additional initialization for auto-configuration model */
17969 static void alc662_auto_init(struct hda_codec *codec)
17971 struct alc_spec *spec = codec->spec;
17972 alc662_auto_init_multi_out(codec);
17973 alc662_auto_init_hp_out(codec);
17974 alc662_auto_init_analog_input(codec);
17975 alc662_auto_init_input_src(codec);
17976 if (spec->unsol_event)
17977 alc_inithook(codec);
17980 static int patch_alc662(struct hda_codec *codec)
17982 struct alc_spec *spec;
17983 int err, board_config;
17985 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17989 codec->spec = spec;
17991 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17993 if (alc_read_coef_idx(codec, 0)==0x8020){
17994 kfree(codec->chip_name);
17995 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17996 if (!codec->chip_name) {
18002 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18005 if (board_config < 0) {
18006 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18008 board_config = ALC662_AUTO;
18011 if (board_config == ALC662_AUTO) {
18012 /* automatic parse from the BIOS config */
18013 err = alc662_parse_auto_config(codec);
18019 "hda_codec: Cannot set up configuration "
18020 "from BIOS. Using base mode...\n");
18021 board_config = ALC662_3ST_2ch_DIG;
18025 err = snd_hda_attach_beep_device(codec, 0x1);
18031 if (board_config != ALC662_AUTO)
18032 setup_preset(codec, &alc662_presets[board_config]);
18034 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18035 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18037 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18038 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18040 if (!spec->adc_nids) {
18041 spec->adc_nids = alc662_adc_nids;
18042 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18044 if (!spec->capsrc_nids)
18045 spec->capsrc_nids = alc662_capsrc_nids;
18047 if (!spec->cap_mixer)
18048 set_capture_mixer(codec);
18049 if (codec->vendor_id == 0x10ec0662)
18050 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18052 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18054 spec->vmaster_nid = 0x02;
18056 codec->patch_ops = alc_patch_ops;
18057 if (board_config == ALC662_AUTO)
18058 spec->init_hook = alc662_auto_init;
18059 #ifdef CONFIG_SND_HDA_POWER_SAVE
18060 if (!spec->loopback.amplist)
18061 spec->loopback.amplist = alc662_loopbacks;
18063 codec->proc_widget_hook = print_realtek_coef;
18068 static int patch_alc888(struct hda_codec *codec)
18070 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18071 kfree(codec->chip_name);
18072 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18073 if (!codec->chip_name) {
18077 return patch_alc662(codec);
18079 return patch_alc882(codec);
18085 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18086 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18087 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18088 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18089 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18090 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18091 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18092 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18093 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18094 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18095 .patch = patch_alc861 },
18096 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18097 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18098 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18099 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18100 .patch = patch_alc882 },
18101 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18102 .patch = patch_alc662 },
18103 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18104 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18105 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18106 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18107 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18108 .patch = patch_alc882 },
18109 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18110 .patch = patch_alc882 },
18111 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18112 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18113 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18114 .patch = patch_alc882 },
18115 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18116 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18117 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18118 {} /* terminator */
18121 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18123 MODULE_LICENSE("GPL");
18124 MODULE_DESCRIPTION("Realtek HD-audio codec");
18126 static struct hda_codec_preset_list realtek_list = {
18127 .preset = snd_hda_preset_realtek,
18128 .owner = THIS_MODULE,
18131 static int __init patch_realtek_init(void)
18133 return snd_hda_add_codec_preset(&realtek_list);
18136 static void __exit patch_realtek_exit(void)
18138 snd_hda_delete_codec_preset(&realtek_list);
18141 module_init(patch_realtek_init)
18142 module_exit(patch_realtek_exit)