2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
219 ALC883_TARGA_2ch_DIG,
220 ALC883_TARGA_8ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
224 ALC888_ACER_ASPIRE_6530G,
225 ALC888_ACER_ASPIRE_8930G,
226 ALC888_ACER_ASPIRE_7730G,
230 ALC883_LENOVO_101E_2ch,
231 ALC883_LENOVO_NB0763,
232 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
266 struct alc_mic_route {
268 unsigned char mux_idx;
269 unsigned char amix_idx;
272 #define MUX_IDX_UNDEF ((unsigned char)-1)
275 /* codec parameterization */
276 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
277 unsigned int num_mixers;
278 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
279 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
281 const struct hda_verb *init_verbs[10]; /* initialization verbs
285 unsigned int num_init_verbs;
287 char stream_name_analog[32]; /* analog PCM stream */
288 struct hda_pcm_stream *stream_analog_playback;
289 struct hda_pcm_stream *stream_analog_capture;
290 struct hda_pcm_stream *stream_analog_alt_playback;
291 struct hda_pcm_stream *stream_analog_alt_capture;
293 char stream_name_digital[32]; /* digital PCM stream */
294 struct hda_pcm_stream *stream_digital_playback;
295 struct hda_pcm_stream *stream_digital_capture;
298 struct hda_multi_out multiout; /* playback set-up
299 * max_channels, dacs must be set
300 * dig_out_nid and hp_nid are optional
302 hda_nid_t alt_dac_nid;
303 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
307 unsigned int num_adc_nids;
309 hda_nid_t *capsrc_nids;
310 hda_nid_t dig_in_nid; /* digital-in NID; optional */
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 unsigned int cur_mux[3];
316 struct alc_mic_route ext_mic;
317 struct alc_mic_route int_mic;
320 const struct hda_channel_mode *channel_mode;
321 int num_channel_mode;
323 int const_channel_count;
324 int ext_channel_count;
326 /* PCM information */
327 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
329 /* dynamic controls, init_verbs and input_mux */
330 struct auto_pin_cfg autocfg;
331 struct snd_array kctls;
332 struct hda_input_mux private_imux[3];
333 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
334 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
335 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340 #ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec, int power);
344 /* for pin sensing */
345 unsigned int sense_updated: 1;
346 unsigned int jack_present: 1;
347 unsigned int master_sw: 1;
348 unsigned int auto_mic:1;
351 unsigned int no_analog :1; /* digital I/O only */
354 /* for virtual master */
355 hda_nid_t vmaster_nid;
356 #ifdef CONFIG_SND_HDA_POWER_SAVE
357 struct hda_loopback_check loopback;
362 unsigned int pll_coef_idx, pll_coef_bit;
366 * configuration template - to be copied to the spec instance
368 struct alc_config_preset {
369 struct snd_kcontrol_new *mixers[5]; /* should be identical size
372 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
373 const struct hda_verb *init_verbs[5];
374 unsigned int num_dacs;
376 hda_nid_t dig_out_nid; /* optional */
377 hda_nid_t hp_nid; /* optional */
378 hda_nid_t *slave_dig_outs;
379 unsigned int num_adc_nids;
381 hda_nid_t *capsrc_nids;
382 hda_nid_t dig_in_nid;
383 unsigned int num_channel_mode;
384 const struct hda_channel_mode *channel_mode;
386 int const_channel_count;
387 unsigned int num_mux_defs;
388 const struct hda_input_mux *input_mux;
389 void (*unsol_event)(struct hda_codec *, unsigned int);
390 void (*setup)(struct hda_codec *);
391 void (*init_hook)(struct hda_codec *);
392 #ifdef CONFIG_SND_HDA_POWER_SAVE
393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power);
402 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
403 struct snd_ctl_elem_info *uinfo)
405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
406 struct alc_spec *spec = codec->spec;
407 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
408 if (mux_idx >= spec->num_mux_defs)
410 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
413 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
414 struct snd_ctl_elem_value *ucontrol)
416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
417 struct alc_spec *spec = codec->spec;
418 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
420 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
424 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_value *ucontrol)
427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
428 struct alc_spec *spec = codec->spec;
429 const struct hda_input_mux *imux;
430 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
431 unsigned int mux_idx;
432 hda_nid_t nid = spec->capsrc_nids ?
433 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
436 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
437 imux = &spec->input_mux[mux_idx];
439 type = get_wcaps_type(get_wcaps(codec, nid));
440 if (type == AC_WID_AUD_MIX) {
441 /* Matrix-mixer style (e.g. ALC882) */
442 unsigned int *cur_val = &spec->cur_mux[adc_idx];
445 idx = ucontrol->value.enumerated.item[0];
446 if (idx >= imux->num_items)
447 idx = imux->num_items - 1;
450 for (i = 0; i < imux->num_items; i++) {
451 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
452 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
453 imux->items[i].index,
459 /* MUX style (e.g. ALC880) */
460 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
461 &spec->cur_mux[adc_idx]);
466 * channel mode setting
468 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_info *uinfo)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
474 spec->num_channel_mode);
477 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
483 spec->num_channel_mode,
484 spec->ext_channel_count);
487 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
488 struct snd_ctl_elem_value *ucontrol)
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 struct alc_spec *spec = codec->spec;
492 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
493 spec->num_channel_mode,
494 &spec->ext_channel_count);
495 if (err >= 0 && !spec->const_channel_count) {
496 spec->multiout.max_channels = spec->ext_channel_count;
497 if (spec->need_dac_fix)
498 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
504 * Control the mode of pin widget settings via the mixer. "pc" is used
505 * instead of "%" to avoid consequences of accidently treating the % as
506 * being part of a format specifier. Maximum allowed length of a value is
507 * 63 characters plus NULL terminator.
509 * Note: some retasking pin complexes seem to ignore requests for input
510 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
511 * are requested. Therefore order this list so that this behaviour will not
512 * cause problems when mixer clients move through the enum sequentially.
513 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
516 static char *alc_pin_mode_names[] = {
517 "Mic 50pc bias", "Mic 80pc bias",
518 "Line in", "Line out", "Headphone out",
520 static unsigned char alc_pin_mode_values[] = {
521 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
523 /* The control can present all 5 options, or it can limit the options based
524 * in the pin being assumed to be exclusively an input or an output pin. In
525 * addition, "input" pins may or may not process the mic bias option
526 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
527 * accept requests for bias as of chip versions up to March 2006) and/or
528 * wiring in the computer.
530 #define ALC_PIN_DIR_IN 0x00
531 #define ALC_PIN_DIR_OUT 0x01
532 #define ALC_PIN_DIR_INOUT 0x02
533 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
534 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
536 /* Info about the pin modes supported by the different pin direction modes.
537 * For each direction the minimum and maximum values are given.
539 static signed char alc_pin_mode_dir_info[5][2] = {
540 { 0, 2 }, /* ALC_PIN_DIR_IN */
541 { 3, 4 }, /* ALC_PIN_DIR_OUT */
542 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
543 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
544 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
546 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
547 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
548 #define alc_pin_mode_n_items(_dir) \
549 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
551 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_info *uinfo)
554 unsigned int item_num = uinfo->value.enumerated.item;
555 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
557 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
559 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
561 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
562 item_num = alc_pin_mode_min(dir);
563 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
567 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
568 struct snd_ctl_elem_value *ucontrol)
571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
572 hda_nid_t nid = kcontrol->private_value & 0xffff;
573 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
574 long *valp = ucontrol->value.integer.value;
575 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
576 AC_VERB_GET_PIN_WIDGET_CONTROL,
579 /* Find enumerated value for current pinctl setting */
580 i = alc_pin_mode_min(dir);
581 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
583 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
587 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_value *ucontrol)
591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
592 hda_nid_t nid = kcontrol->private_value & 0xffff;
593 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
594 long val = *ucontrol->value.integer.value;
595 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
596 AC_VERB_GET_PIN_WIDGET_CONTROL,
599 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
600 val = alc_pin_mode_min(dir);
602 change = pinctl != alc_pin_mode_values[val];
604 /* Set pin mode to that requested */
605 snd_hda_codec_write_cache(codec, nid, 0,
606 AC_VERB_SET_PIN_WIDGET_CONTROL,
607 alc_pin_mode_values[val]);
609 /* Also enable the retasking pin's input/output as required
610 * for the requested pin mode. Enum values of 2 or less are
613 * Dynamically switching the input/output buffers probably
614 * reduces noise slightly (particularly on input) so we'll
615 * do it. However, having both input and output buffers
616 * enabled simultaneously doesn't seem to be problematic if
617 * this turns out to be necessary in the future.
620 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
621 HDA_AMP_MUTE, HDA_AMP_MUTE);
622 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
625 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
626 HDA_AMP_MUTE, HDA_AMP_MUTE);
627 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
634 #define ALC_PIN_MODE(xname, nid, dir) \
635 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
636 .info = alc_pin_mode_info, \
637 .get = alc_pin_mode_get, \
638 .put = alc_pin_mode_put, \
639 .private_value = nid | (dir<<16) }
641 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
642 * together using a mask with more than one bit set. This control is
643 * currently used only by the ALC260 test model. At this stage they are not
644 * needed for any "production" models.
646 #ifdef CONFIG_SND_DEBUG
647 #define alc_gpio_data_info snd_ctl_boolean_mono_info
649 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
650 struct snd_ctl_elem_value *ucontrol)
652 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
653 hda_nid_t nid = kcontrol->private_value & 0xffff;
654 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
655 long *valp = ucontrol->value.integer.value;
656 unsigned int val = snd_hda_codec_read(codec, nid, 0,
657 AC_VERB_GET_GPIO_DATA, 0x00);
659 *valp = (val & mask) != 0;
662 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
663 struct snd_ctl_elem_value *ucontrol)
666 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
667 hda_nid_t nid = kcontrol->private_value & 0xffff;
668 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
669 long val = *ucontrol->value.integer.value;
670 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
671 AC_VERB_GET_GPIO_DATA,
674 /* Set/unset the masked GPIO bit(s) as needed */
675 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
680 snd_hda_codec_write_cache(codec, nid, 0,
681 AC_VERB_SET_GPIO_DATA, gpio_data);
685 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
686 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
687 .info = alc_gpio_data_info, \
688 .get = alc_gpio_data_get, \
689 .put = alc_gpio_data_put, \
690 .private_value = nid | (mask<<16) }
691 #endif /* CONFIG_SND_DEBUG */
693 /* A switch control to allow the enabling of the digital IO pins on the
694 * ALC260. This is incredibly simplistic; the intention of this control is
695 * to provide something in the test model allowing digital outputs to be
696 * identified if present. If models are found which can utilise these
697 * outputs a more complete mixer control can be devised for those models if
700 #ifdef CONFIG_SND_DEBUG
701 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
703 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
704 struct snd_ctl_elem_value *ucontrol)
706 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
707 hda_nid_t nid = kcontrol->private_value & 0xffff;
708 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
709 long *valp = ucontrol->value.integer.value;
710 unsigned int val = snd_hda_codec_read(codec, nid, 0,
711 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
713 *valp = (val & mask) != 0;
716 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
717 struct snd_ctl_elem_value *ucontrol)
720 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
721 hda_nid_t nid = kcontrol->private_value & 0xffff;
722 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
723 long val = *ucontrol->value.integer.value;
724 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
725 AC_VERB_GET_DIGI_CONVERT_1,
728 /* Set/unset the masked control bit(s) as needed */
729 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
734 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
739 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
740 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
741 .info = alc_spdif_ctrl_info, \
742 .get = alc_spdif_ctrl_get, \
743 .put = alc_spdif_ctrl_put, \
744 .private_value = nid | (mask<<16) }
745 #endif /* CONFIG_SND_DEBUG */
747 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
748 * Again, this is only used in the ALC26x test models to help identify when
749 * the EAPD line must be asserted for features to work.
751 #ifdef CONFIG_SND_DEBUG
752 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
754 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
755 struct snd_ctl_elem_value *ucontrol)
757 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
758 hda_nid_t nid = kcontrol->private_value & 0xffff;
759 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
760 long *valp = ucontrol->value.integer.value;
761 unsigned int val = snd_hda_codec_read(codec, nid, 0,
762 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
764 *valp = (val & mask) != 0;
768 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
769 struct snd_ctl_elem_value *ucontrol)
772 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
773 hda_nid_t nid = kcontrol->private_value & 0xffff;
774 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
775 long val = *ucontrol->value.integer.value;
776 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
777 AC_VERB_GET_EAPD_BTLENABLE,
780 /* Set/unset the masked control bit(s) as needed */
781 change = (!val ? 0 : mask) != (ctrl_data & mask);
786 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
792 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
793 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
794 .info = alc_eapd_ctrl_info, \
795 .get = alc_eapd_ctrl_get, \
796 .put = alc_eapd_ctrl_put, \
797 .private_value = nid | (mask<<16) }
798 #endif /* CONFIG_SND_DEBUG */
801 * set up the input pin config (depending on the given auto-pin type)
803 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
806 unsigned int val = PIN_IN;
808 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
810 pincap = snd_hda_query_pin_caps(codec, nid);
811 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
812 if (pincap & AC_PINCAP_VREF_80)
814 else if (pincap & AC_PINCAP_VREF_50)
816 else if (pincap & AC_PINCAP_VREF_100)
818 else if (pincap & AC_PINCAP_VREF_GRD)
821 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
826 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
828 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
830 spec->mixers[spec->num_mixers++] = mix;
833 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
835 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
837 spec->init_verbs[spec->num_init_verbs++] = verb;
840 #ifdef CONFIG_PROC_FS
844 static void print_realtek_coef(struct snd_info_buffer *buffer,
845 struct hda_codec *codec, hda_nid_t nid)
851 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
852 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
853 coeff = snd_hda_codec_read(codec, nid, 0,
854 AC_VERB_GET_COEF_INDEX, 0);
855 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
858 #define print_realtek_coef NULL
862 * set up from the preset table
864 static void setup_preset(struct hda_codec *codec,
865 const struct alc_config_preset *preset)
867 struct alc_spec *spec = codec->spec;
870 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
871 add_mixer(spec, preset->mixers[i]);
872 spec->cap_mixer = preset->cap_mixer;
873 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
875 add_verb(spec, preset->init_verbs[i]);
877 spec->channel_mode = preset->channel_mode;
878 spec->num_channel_mode = preset->num_channel_mode;
879 spec->need_dac_fix = preset->need_dac_fix;
880 spec->const_channel_count = preset->const_channel_count;
882 if (preset->const_channel_count)
883 spec->multiout.max_channels = preset->const_channel_count;
885 spec->multiout.max_channels = spec->channel_mode[0].channels;
886 spec->ext_channel_count = spec->channel_mode[0].channels;
888 spec->multiout.num_dacs = preset->num_dacs;
889 spec->multiout.dac_nids = preset->dac_nids;
890 spec->multiout.dig_out_nid = preset->dig_out_nid;
891 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
892 spec->multiout.hp_nid = preset->hp_nid;
894 spec->num_mux_defs = preset->num_mux_defs;
895 if (!spec->num_mux_defs)
896 spec->num_mux_defs = 1;
897 spec->input_mux = preset->input_mux;
899 spec->num_adc_nids = preset->num_adc_nids;
900 spec->adc_nids = preset->adc_nids;
901 spec->capsrc_nids = preset->capsrc_nids;
902 spec->dig_in_nid = preset->dig_in_nid;
904 spec->unsol_event = preset->unsol_event;
905 spec->init_hook = preset->init_hook;
906 #ifdef CONFIG_SND_HDA_POWER_SAVE
907 spec->power_hook = preset->power_hook;
908 spec->loopback.amplist = preset->loopbacks;
912 preset->setup(codec);
915 /* Enable GPIO mask and set output */
916 static struct hda_verb alc_gpio1_init_verbs[] = {
917 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
918 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
919 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
923 static struct hda_verb alc_gpio2_init_verbs[] = {
924 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
925 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
926 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
930 static struct hda_verb alc_gpio3_init_verbs[] = {
931 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
932 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
933 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
938 * Fix hardware PLL issue
939 * On some codecs, the analog PLL gating control must be off while
940 * the default value is 1.
942 static void alc_fix_pll(struct hda_codec *codec)
944 struct alc_spec *spec = codec->spec;
949 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
951 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
952 AC_VERB_GET_PROC_COEF, 0);
953 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
955 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
956 val & ~(1 << spec->pll_coef_bit));
959 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
960 unsigned int coef_idx, unsigned int coef_bit)
962 struct alc_spec *spec = codec->spec;
964 spec->pll_coef_idx = coef_idx;
965 spec->pll_coef_bit = coef_bit;
969 static void alc_automute_pin(struct hda_codec *codec)
971 struct alc_spec *spec = codec->spec;
972 unsigned int nid = spec->autocfg.hp_pins[0];
977 spec->jack_present = snd_hda_jack_detect(codec, nid);
978 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
979 nid = spec->autocfg.speaker_pins[i];
982 snd_hda_codec_write(codec, nid, 0,
983 AC_VERB_SET_PIN_WIDGET_CONTROL,
984 spec->jack_present ? 0 : PIN_OUT);
988 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
991 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
994 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
995 for (i = 0; i < nums; i++)
1001 static void alc_mic_automute(struct hda_codec *codec)
1003 struct alc_spec *spec = codec->spec;
1004 struct alc_mic_route *dead, *alive;
1005 unsigned int present, type;
1008 if (!spec->auto_mic)
1010 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1012 if (snd_BUG_ON(!spec->adc_nids))
1015 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1017 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1019 alive = &spec->ext_mic;
1020 dead = &spec->int_mic;
1022 alive = &spec->int_mic;
1023 dead = &spec->ext_mic;
1026 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1027 if (type == AC_WID_AUD_MIX) {
1028 /* Matrix-mixer style (e.g. ALC882) */
1029 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1032 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1034 HDA_AMP_MUTE, HDA_AMP_MUTE);
1036 /* MUX style (e.g. ALC880) */
1037 snd_hda_codec_write_cache(codec, cap_nid, 0,
1038 AC_VERB_SET_CONNECT_SEL,
1042 /* FIXME: analog mixer */
1045 /* unsolicited event for HP jack sensing */
1046 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1048 if (codec->vendor_id == 0x10ec0880)
1053 case ALC880_HP_EVENT:
1054 alc_automute_pin(codec);
1056 case ALC880_MIC_EVENT:
1057 alc_mic_automute(codec);
1062 static void alc_inithook(struct hda_codec *codec)
1064 alc_automute_pin(codec);
1065 alc_mic_automute(codec);
1068 /* additional initialization for ALC888 variants */
1069 static void alc888_coef_init(struct hda_codec *codec)
1073 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1074 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1075 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1076 if ((tmp & 0xf0) == 0x20)
1078 snd_hda_codec_read(codec, 0x20, 0,
1079 AC_VERB_SET_PROC_COEF, 0x830);
1082 snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_SET_PROC_COEF, 0x3030);
1086 static void alc889_coef_init(struct hda_codec *codec)
1090 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1091 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1092 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1093 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1096 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1101 case ALC_INIT_GPIO1:
1102 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1104 case ALC_INIT_GPIO2:
1105 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1107 case ALC_INIT_GPIO3:
1108 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1110 case ALC_INIT_DEFAULT:
1111 switch (codec->vendor_id) {
1113 snd_hda_codec_write(codec, 0x0f, 0,
1114 AC_VERB_SET_EAPD_BTLENABLE, 2);
1115 snd_hda_codec_write(codec, 0x10, 0,
1116 AC_VERB_SET_EAPD_BTLENABLE, 2);
1128 snd_hda_codec_write(codec, 0x14, 0,
1129 AC_VERB_SET_EAPD_BTLENABLE, 2);
1130 snd_hda_codec_write(codec, 0x15, 0,
1131 AC_VERB_SET_EAPD_BTLENABLE, 2);
1134 switch (codec->vendor_id) {
1136 snd_hda_codec_write(codec, 0x1a, 0,
1137 AC_VERB_SET_COEF_INDEX, 7);
1138 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1139 AC_VERB_GET_PROC_COEF, 0);
1140 snd_hda_codec_write(codec, 0x1a, 0,
1141 AC_VERB_SET_COEF_INDEX, 7);
1142 snd_hda_codec_write(codec, 0x1a, 0,
1143 AC_VERB_SET_PROC_COEF,
1153 alc889_coef_init(codec);
1156 alc888_coef_init(codec);
1160 snd_hda_codec_write(codec, 0x20, 0,
1161 AC_VERB_SET_COEF_INDEX, 7);
1162 tmp = snd_hda_codec_read(codec, 0x20, 0,
1163 AC_VERB_GET_PROC_COEF, 0);
1164 snd_hda_codec_write(codec, 0x20, 0,
1165 AC_VERB_SET_COEF_INDEX, 7);
1166 snd_hda_codec_write(codec, 0x20, 0,
1167 AC_VERB_SET_PROC_COEF,
1175 static void alc_init_auto_hp(struct hda_codec *codec)
1177 struct alc_spec *spec = codec->spec;
1179 if (!spec->autocfg.hp_pins[0])
1182 if (!spec->autocfg.speaker_pins[0]) {
1183 if (spec->autocfg.line_out_pins[0] &&
1184 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1185 spec->autocfg.speaker_pins[0] =
1186 spec->autocfg.line_out_pins[0];
1191 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1192 spec->autocfg.hp_pins[0]);
1193 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1194 AC_VERB_SET_UNSOLICITED_ENABLE,
1195 AC_USRSP_EN | ALC880_HP_EVENT);
1196 spec->unsol_event = alc_sku_unsol_event;
1199 static void alc_init_auto_mic(struct hda_codec *codec)
1201 struct alc_spec *spec = codec->spec;
1202 struct auto_pin_cfg *cfg = &spec->autocfg;
1203 hda_nid_t fixed, ext;
1206 /* there must be only two mic inputs exclusively */
1207 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1208 if (cfg->input_pins[i])
1212 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1213 hda_nid_t nid = cfg->input_pins[i];
1214 unsigned int defcfg;
1217 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1218 switch (get_defcfg_connect(defcfg)) {
1219 case AC_JACK_PORT_FIXED:
1221 return; /* already occupied */
1224 case AC_JACK_PORT_COMPLEX:
1226 return; /* already occupied */
1230 return; /* invalid entry */
1233 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1234 return; /* no unsol support */
1235 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1237 spec->ext_mic.pin = ext;
1238 spec->int_mic.pin = fixed;
1239 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1240 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1242 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1243 AC_VERB_SET_UNSOLICITED_ENABLE,
1244 AC_USRSP_EN | ALC880_MIC_EVENT);
1245 spec->unsol_event = alc_sku_unsol_event;
1248 /* check subsystem ID and set up device-specific initialization;
1249 * return 1 if initialized, 0 if invalid SSID
1251 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1252 * 31 ~ 16 : Manufacture ID
1254 * 7 ~ 0 : Assembly ID
1255 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1257 static int alc_subsystem_id(struct hda_codec *codec,
1258 hda_nid_t porta, hda_nid_t porte,
1261 unsigned int ass, tmp, i;
1263 struct alc_spec *spec = codec->spec;
1265 ass = codec->subsystem_id & 0xffff;
1266 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1269 /* invalid SSID, check the special NID pin defcfg instead */
1271 * 31~30 : port connectivity
1274 * 19~16 : Check sum (15:1)
1279 if (codec->vendor_id == 0x10ec0260)
1281 ass = snd_hda_codec_get_pincfg(codec, nid);
1282 snd_printd("realtek: No valid SSID, "
1283 "checking pincfg 0x%08x for NID 0x%x\n",
1285 if (!(ass & 1) && !(ass & 0x100000))
1287 if ((ass >> 30) != 1) /* no physical connection */
1292 for (i = 1; i < 16; i++) {
1296 if (((ass >> 16) & 0xf) != tmp)
1299 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1300 ass & 0xffff, codec->vendor_id);
1304 * 2 : 0 --> Desktop, 1 --> Laptop
1305 * 3~5 : External Amplifier control
1308 tmp = (ass & 0x38) >> 3; /* external Amp control */
1311 spec->init_amp = ALC_INIT_GPIO1;
1314 spec->init_amp = ALC_INIT_GPIO2;
1317 spec->init_amp = ALC_INIT_GPIO3;
1320 spec->init_amp = ALC_INIT_DEFAULT;
1324 /* is laptop or Desktop and enable the function "Mute internal speaker
1325 * when the external headphone out jack is plugged"
1327 if (!(ass & 0x8000))
1330 * 10~8 : Jack location
1331 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1333 * 15 : 1 --> enable the function "Mute internal speaker
1334 * when the external headphone out jack is plugged"
1336 if (!spec->autocfg.hp_pins[0]) {
1338 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1347 for (i = 0; i < spec->autocfg.line_outs; i++)
1348 if (spec->autocfg.line_out_pins[i] == nid)
1350 spec->autocfg.hp_pins[0] = nid;
1353 alc_init_auto_hp(codec);
1354 alc_init_auto_mic(codec);
1358 static void alc_ssid_check(struct hda_codec *codec,
1359 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1361 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1362 struct alc_spec *spec = codec->spec;
1363 snd_printd("realtek: "
1364 "Enable default setup for auto mode as fallback\n");
1365 spec->init_amp = ALC_INIT_DEFAULT;
1366 alc_init_auto_hp(codec);
1367 alc_init_auto_mic(codec);
1372 * Fix-up pin default configurations and add default verbs
1381 const struct alc_pincfg *pins;
1382 const struct hda_verb *verbs;
1385 static void alc_pick_fixup(struct hda_codec *codec,
1386 const struct snd_pci_quirk *quirk,
1387 const struct alc_fixup *fix)
1389 const struct alc_pincfg *cfg;
1391 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1395 fix += quirk->value;
1398 for (; cfg->nid; cfg++)
1399 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1402 add_verb(codec->spec, fix->verbs);
1405 static int alc_read_coef_idx(struct hda_codec *codec,
1406 unsigned int coef_idx)
1409 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1411 val = snd_hda_codec_read(codec, 0x20, 0,
1412 AC_VERB_GET_PROC_COEF, 0);
1423 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1424 /* Mic-in jack as mic in */
1425 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1426 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1427 /* Line-in jack as Line in */
1428 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1429 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1430 /* Line-Out as Front */
1431 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1438 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1439 /* Mic-in jack as mic in */
1440 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1441 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1442 /* Line-in jack as Surround */
1443 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1444 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1445 /* Line-Out as Front */
1446 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1453 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1454 /* Mic-in jack as CLFE */
1455 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1456 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1457 /* Line-in jack as Surround */
1458 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1459 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1460 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1461 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1468 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1469 /* Mic-in jack as CLFE */
1470 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1471 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1472 /* Line-in jack as Surround */
1473 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1474 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1475 /* Line-Out as Side */
1476 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1480 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1481 { 2, alc888_4ST_ch2_intel_init },
1482 { 4, alc888_4ST_ch4_intel_init },
1483 { 6, alc888_4ST_ch6_intel_init },
1484 { 8, alc888_4ST_ch8_intel_init },
1488 * ALC888 Fujitsu Siemens Amillo xa3530
1491 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1492 /* Front Mic: set to PIN_IN (empty by default) */
1493 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1494 /* Connect Internal HP to Front */
1495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1497 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1498 /* Connect Bass HP to Front */
1499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1502 /* Connect Line-Out side jack (SPDIF) to Side */
1503 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1504 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1505 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1506 /* Connect Mic jack to CLFE */
1507 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1510 /* Connect Line-in jack to Surround */
1511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1514 /* Connect HP out jack to Front */
1515 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1516 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1517 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1518 /* Enable unsolicited event for HP jack and Line-out jack */
1519 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1520 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1524 static void alc_automute_amp(struct hda_codec *codec)
1526 struct alc_spec *spec = codec->spec;
1531 spec->jack_present = 0;
1532 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1533 nid = spec->autocfg.hp_pins[i];
1536 if (snd_hda_jack_detect(codec, nid)) {
1537 spec->jack_present = 1;
1542 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1543 /* Toggle internal speakers muting */
1544 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1545 nid = spec->autocfg.speaker_pins[i];
1548 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1549 HDA_AMP_MUTE, mute);
1553 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1556 if (codec->vendor_id == 0x10ec0880)
1560 if (res == ALC880_HP_EVENT)
1561 alc_automute_amp(codec);
1564 static void alc889_automute_setup(struct hda_codec *codec)
1566 struct alc_spec *spec = codec->spec;
1568 spec->autocfg.hp_pins[0] = 0x15;
1569 spec->autocfg.speaker_pins[0] = 0x14;
1570 spec->autocfg.speaker_pins[1] = 0x16;
1571 spec->autocfg.speaker_pins[2] = 0x17;
1572 spec->autocfg.speaker_pins[3] = 0x19;
1573 spec->autocfg.speaker_pins[4] = 0x1a;
1576 static void alc889_intel_init_hook(struct hda_codec *codec)
1578 alc889_coef_init(codec);
1579 alc_automute_amp(codec);
1582 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1584 struct alc_spec *spec = codec->spec;
1586 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1587 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1588 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1589 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1593 * ALC888 Acer Aspire 4930G model
1596 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1597 /* Front Mic: set to PIN_IN (empty by default) */
1598 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1599 /* Unselect Front Mic by default in input mixer 3 */
1600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1601 /* Enable unsolicited event for HP jack */
1602 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1603 /* Connect Internal HP to front */
1604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1606 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1607 /* Connect HP out to front */
1608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1610 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1615 * ALC888 Acer Aspire 6530G model
1618 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1619 /* Bias voltage on for external mic port */
1620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1621 /* Front Mic: set to PIN_IN (empty by default) */
1622 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1623 /* Unselect Front Mic by default in input mixer 3 */
1624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1625 /* Enable unsolicited event for HP jack */
1626 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1627 /* Enable speaker output */
1628 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1629 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1630 /* Enable headphone output */
1631 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1633 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1638 * ALC889 Acer Aspire 8930G model
1641 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1642 /* Front Mic: set to PIN_IN (empty by default) */
1643 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1644 /* Unselect Front Mic by default in input mixer 3 */
1645 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1646 /* Enable unsolicited event for HP jack */
1647 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1648 /* Connect Internal Front to Front */
1649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1650 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1651 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1652 /* Connect Internal Rear to Rear */
1653 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1654 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1655 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1656 /* Connect Internal CLFE to CLFE */
1657 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1658 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1659 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1660 /* Connect HP out to Front */
1661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1663 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1664 /* Enable all DACs */
1665 /* DAC DISABLE/MUTE 1? */
1666 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1667 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1668 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1669 /* DAC DISABLE/MUTE 2? */
1670 /* some bit here disables the other DACs. Init=0x4900 */
1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1675 * which makes the stereo useless. However, either the mic or the ALC889
1676 * makes the signal become a difference/sum signal instead of standard
1677 * stereo, which is annoying. So instead we flip this bit which makes the
1678 * codec replicate the sum signal to both channels, turning it into a
1681 /* DMIC_CONTROL? Init value = 0x0001 */
1682 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1683 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1687 static struct hda_input_mux alc888_2_capture_sources[2] = {
1688 /* Front mic only available on one ADC */
1695 { "Front Mic", 0xb },
1708 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1709 /* Interal mic only available on one ADC */
1716 { "Input Mix", 0xa },
1726 { "Input Mix", 0xa },
1731 static struct hda_input_mux alc889_capture_sources[3] = {
1732 /* Digital mic only available on first "ADC" */
1739 { "Front Mic", 0xb },
1740 { "Input Mix", 0xa },
1749 { "Input Mix", 0xa },
1758 { "Input Mix", 0xa },
1763 static struct snd_kcontrol_new alc888_base_mixer[] = {
1764 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1766 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1767 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1768 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1770 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1772 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1774 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1775 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1776 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1778 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1780 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1785 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1789 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1804 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1806 struct alc_spec *spec = codec->spec;
1808 spec->autocfg.hp_pins[0] = 0x15;
1809 spec->autocfg.speaker_pins[0] = 0x14;
1810 spec->autocfg.speaker_pins[1] = 0x16;
1811 spec->autocfg.speaker_pins[2] = 0x17;
1814 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1816 struct alc_spec *spec = codec->spec;
1818 spec->autocfg.hp_pins[0] = 0x15;
1819 spec->autocfg.speaker_pins[0] = 0x14;
1820 spec->autocfg.speaker_pins[1] = 0x16;
1821 spec->autocfg.speaker_pins[2] = 0x17;
1824 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1826 struct alc_spec *spec = codec->spec;
1828 spec->autocfg.hp_pins[0] = 0x15;
1829 spec->autocfg.speaker_pins[0] = 0x14;
1830 spec->autocfg.speaker_pins[1] = 0x16;
1831 spec->autocfg.speaker_pins[2] = 0x1b;
1834 #ifdef CONFIG_SND_HDA_POWER_SAVE
1835 static void alc889_power_eapd(struct hda_codec *codec, int power)
1837 snd_hda_codec_write(codec, 0x14, 0,
1838 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1839 snd_hda_codec_write(codec, 0x15, 0,
1840 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1845 * ALC880 3-stack model
1847 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1848 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1849 * F-Mic = 0x1b, HP = 0x19
1852 static hda_nid_t alc880_dac_nids[4] = {
1853 /* front, rear, clfe, rear_surr */
1854 0x02, 0x05, 0x04, 0x03
1857 static hda_nid_t alc880_adc_nids[3] = {
1862 /* The datasheet says the node 0x07 is connected from inputs,
1863 * but it shows zero connection in the real implementation on some devices.
1864 * Note: this is a 915GAV bug, fixed on 915GLV
1866 static hda_nid_t alc880_adc_nids_alt[2] = {
1871 #define ALC880_DIGOUT_NID 0x06
1872 #define ALC880_DIGIN_NID 0x0a
1874 static struct hda_input_mux alc880_capture_source = {
1878 { "Front Mic", 0x3 },
1884 /* channel source setting (2/6 channel selection for 3-stack) */
1886 static struct hda_verb alc880_threestack_ch2_init[] = {
1887 /* set line-in to input, mute it */
1888 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1889 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1890 /* set mic-in to input vref 80%, mute it */
1891 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1892 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1897 static struct hda_verb alc880_threestack_ch6_init[] = {
1898 /* set line-in to output, unmute it */
1899 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1900 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1901 /* set mic-in to output, unmute it */
1902 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1903 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1907 static struct hda_channel_mode alc880_threestack_modes[2] = {
1908 { 2, alc880_threestack_ch2_init },
1909 { 6, alc880_threestack_ch6_init },
1912 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1914 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1915 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1916 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1917 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1918 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1919 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1920 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1921 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1922 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1923 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1924 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1927 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1928 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1932 .name = "Channel Mode",
1933 .info = alc_ch_mode_info,
1934 .get = alc_ch_mode_get,
1935 .put = alc_ch_mode_put,
1940 /* capture mixer elements */
1941 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1942 struct snd_ctl_elem_info *uinfo)
1944 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1945 struct alc_spec *spec = codec->spec;
1948 mutex_lock(&codec->control_mutex);
1949 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1951 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1952 mutex_unlock(&codec->control_mutex);
1956 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1957 unsigned int size, unsigned int __user *tlv)
1959 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1960 struct alc_spec *spec = codec->spec;
1963 mutex_lock(&codec->control_mutex);
1964 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1966 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1967 mutex_unlock(&codec->control_mutex);
1971 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1972 struct snd_ctl_elem_value *ucontrol);
1974 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1975 struct snd_ctl_elem_value *ucontrol,
1978 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1979 struct alc_spec *spec = codec->spec;
1980 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1983 mutex_lock(&codec->control_mutex);
1984 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1986 err = func(kcontrol, ucontrol);
1987 mutex_unlock(&codec->control_mutex);
1991 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1992 struct snd_ctl_elem_value *ucontrol)
1994 return alc_cap_getput_caller(kcontrol, ucontrol,
1995 snd_hda_mixer_amp_volume_get);
1998 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1999 struct snd_ctl_elem_value *ucontrol)
2001 return alc_cap_getput_caller(kcontrol, ucontrol,
2002 snd_hda_mixer_amp_volume_put);
2005 /* capture mixer elements */
2006 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2008 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2009 struct snd_ctl_elem_value *ucontrol)
2011 return alc_cap_getput_caller(kcontrol, ucontrol,
2012 snd_hda_mixer_amp_switch_get);
2015 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2016 struct snd_ctl_elem_value *ucontrol)
2018 return alc_cap_getput_caller(kcontrol, ucontrol,
2019 snd_hda_mixer_amp_switch_put);
2022 #define _DEFINE_CAPMIX(num) \
2024 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2025 .name = "Capture Switch", \
2026 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2028 .info = alc_cap_sw_info, \
2029 .get = alc_cap_sw_get, \
2030 .put = alc_cap_sw_put, \
2033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2034 .name = "Capture Volume", \
2035 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2036 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2037 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2039 .info = alc_cap_vol_info, \
2040 .get = alc_cap_vol_get, \
2041 .put = alc_cap_vol_put, \
2042 .tlv = { .c = alc_cap_vol_tlv }, \
2045 #define _DEFINE_CAPSRC(num) \
2047 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2048 /* .name = "Capture Source", */ \
2049 .name = "Input Source", \
2051 .info = alc_mux_enum_info, \
2052 .get = alc_mux_enum_get, \
2053 .put = alc_mux_enum_put, \
2056 #define DEFINE_CAPMIX(num) \
2057 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2058 _DEFINE_CAPMIX(num), \
2059 _DEFINE_CAPSRC(num), \
2063 #define DEFINE_CAPMIX_NOSRC(num) \
2064 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2065 _DEFINE_CAPMIX(num), \
2069 /* up to three ADCs */
2073 DEFINE_CAPMIX_NOSRC(1);
2074 DEFINE_CAPMIX_NOSRC(2);
2075 DEFINE_CAPMIX_NOSRC(3);
2078 * ALC880 5-stack model
2080 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2082 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2083 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2086 /* additional mixers to alc880_three_stack_mixer */
2087 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2088 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2089 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2093 /* channel source setting (6/8 channel selection for 5-stack) */
2095 static struct hda_verb alc880_fivestack_ch6_init[] = {
2096 /* set line-in to input, mute it */
2097 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2098 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2103 static struct hda_verb alc880_fivestack_ch8_init[] = {
2104 /* set line-in to output, unmute it */
2105 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2106 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2110 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2111 { 6, alc880_fivestack_ch6_init },
2112 { 8, alc880_fivestack_ch8_init },
2117 * ALC880 6-stack model
2119 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2120 * Side = 0x05 (0x0f)
2121 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2122 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2125 static hda_nid_t alc880_6st_dac_nids[4] = {
2126 /* front, rear, clfe, rear_surr */
2127 0x02, 0x03, 0x04, 0x05
2130 static struct hda_input_mux alc880_6stack_capture_source = {
2134 { "Front Mic", 0x1 },
2140 /* fixed 8-channels */
2141 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2145 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2147 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2148 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2149 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2150 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2151 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2152 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2153 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2154 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2155 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2156 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2157 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2158 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2159 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2162 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2163 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2166 .name = "Channel Mode",
2167 .info = alc_ch_mode_info,
2168 .get = alc_ch_mode_get,
2169 .put = alc_ch_mode_put,
2178 * W810 has rear IO for:
2181 * Center/LFE (DAC 04)
2184 * The system also has a pair of internal speakers, and a headphone jack.
2185 * These are both connected to Line2 on the codec, hence to DAC 02.
2187 * There is a variable resistor to control the speaker or headphone
2188 * volume. This is a hardware-only device without a software API.
2190 * Plugging headphones in will disable the internal speakers. This is
2191 * implemented in hardware, not via the driver using jack sense. In
2192 * a similar fashion, plugging into the rear socket marked "front" will
2193 * disable both the speakers and headphones.
2195 * For input, there's a microphone jack, and an "audio in" jack.
2196 * These may not do anything useful with this driver yet, because I
2197 * haven't setup any initialization verbs for these yet...
2200 static hda_nid_t alc880_w810_dac_nids[3] = {
2201 /* front, rear/surround, clfe */
2205 /* fixed 6 channels */
2206 static struct hda_channel_mode alc880_w810_modes[1] = {
2210 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2211 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2212 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2213 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2214 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2215 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2216 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2217 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2219 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2228 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2229 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2233 static hda_nid_t alc880_z71v_dac_nids[1] = {
2236 #define ALC880_Z71V_HP_DAC 0x03
2238 /* fixed 2 channels */
2239 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2243 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2244 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2245 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2247 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2248 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2249 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2257 * ALC880 F1734 model
2259 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2260 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2263 static hda_nid_t alc880_f1734_dac_nids[1] = {
2266 #define ALC880_F1734_HP_DAC 0x02
2268 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2269 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2270 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2271 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2272 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2273 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2274 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2276 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2280 static struct hda_input_mux alc880_f1734_capture_source = {
2292 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2293 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2294 * Mic = 0x18, Line = 0x1a
2297 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2298 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2300 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2301 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2302 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2303 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2304 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2305 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2306 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2307 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2308 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2309 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2310 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2311 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2312 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2316 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2317 .name = "Channel Mode",
2318 .info = alc_ch_mode_info,
2319 .get = alc_ch_mode_get,
2320 .put = alc_ch_mode_put,
2326 * ALC880 ASUS W1V model
2328 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2329 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2330 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2333 /* additional mixers to alc880_asus_mixer */
2334 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2335 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2336 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2341 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2342 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2343 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2345 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2346 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2348 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2350 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2355 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2356 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2359 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2360 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2361 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2362 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2363 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2364 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2365 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2366 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2367 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2369 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2371 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2373 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2374 .name = "Channel Mode",
2375 .info = alc_ch_mode_info,
2376 .get = alc_ch_mode_get,
2377 .put = alc_ch_mode_put,
2382 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2384 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2386 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2389 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2390 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2391 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2392 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2396 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2397 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2398 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2399 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2400 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2407 * virtual master controls
2411 * slave controls for virtual master
2413 static const char *alc_slave_vols[] = {
2414 "Front Playback Volume",
2415 "Surround Playback Volume",
2416 "Center Playback Volume",
2417 "LFE Playback Volume",
2418 "Side Playback Volume",
2419 "Headphone Playback Volume",
2420 "Speaker Playback Volume",
2421 "Mono Playback Volume",
2422 "Line-Out Playback Volume",
2423 "PCM Playback Volume",
2427 static const char *alc_slave_sws[] = {
2428 "Front Playback Switch",
2429 "Surround Playback Switch",
2430 "Center Playback Switch",
2431 "LFE Playback Switch",
2432 "Side Playback Switch",
2433 "Headphone Playback Switch",
2434 "Speaker Playback Switch",
2435 "Mono Playback Switch",
2436 "IEC958 Playback Switch",
2437 "Line-Out Playback Switch",
2438 "PCM Playback Switch",
2443 * build control elements
2446 static void alc_free_kctls(struct hda_codec *codec);
2448 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2449 /* additional beep mixers; the actual parameters are overwritten at build */
2450 static struct snd_kcontrol_new alc_beep_mixer[] = {
2451 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2452 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2457 static int alc_build_controls(struct hda_codec *codec)
2459 struct alc_spec *spec = codec->spec;
2463 for (i = 0; i < spec->num_mixers; i++) {
2464 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2468 if (spec->cap_mixer) {
2469 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2473 if (spec->multiout.dig_out_nid) {
2474 err = snd_hda_create_spdif_out_ctls(codec,
2475 spec->multiout.dig_out_nid);
2478 if (!spec->no_analog) {
2479 err = snd_hda_create_spdif_share_sw(codec,
2483 spec->multiout.share_spdif = 1;
2486 if (spec->dig_in_nid) {
2487 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2492 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2493 /* create beep controls if needed */
2494 if (spec->beep_amp) {
2495 struct snd_kcontrol_new *knew;
2496 for (knew = alc_beep_mixer; knew->name; knew++) {
2497 struct snd_kcontrol *kctl;
2498 kctl = snd_ctl_new1(knew, codec);
2501 kctl->private_value = spec->beep_amp;
2502 err = snd_hda_ctl_add(codec,
2503 get_amp_nid_(spec->beep_amp), kctl);
2510 /* if we have no master control, let's create it */
2511 if (!spec->no_analog &&
2512 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2513 unsigned int vmaster_tlv[4];
2514 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2515 HDA_OUTPUT, vmaster_tlv);
2516 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2517 vmaster_tlv, alc_slave_vols);
2521 if (!spec->no_analog &&
2522 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2523 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2524 NULL, alc_slave_sws);
2529 alc_free_kctls(codec); /* no longer needed */
2535 * initialize the codec volumes, etc
2539 * generic initialization of ADC, input mixers and output mixers
2541 static struct hda_verb alc880_volume_init_verbs[] = {
2543 * Unmute ADC0-2 and set the default input to mic-in
2545 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2547 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2548 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2549 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2550 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2552 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2554 * Note: PASD motherboards uses the Line In 2 as the input for front
2557 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2558 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2560 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2562 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2563 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2564 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2567 * Set up output mixers (0x0c - 0x0f)
2569 /* set vol=0 to output mixers */
2570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2571 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2572 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2573 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2574 /* set up input amps for analog loopback */
2575 /* Amp Indices: DAC = 0, mixer = 1 */
2576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2580 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2581 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2582 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2583 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2589 * 3-stack pin configuration:
2590 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2592 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2594 * preset connection lists of input pins
2595 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2597 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2598 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2599 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2602 * Set pin mode and muting
2604 /* set front pin widgets 0x14 for output */
2605 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2606 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2607 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2608 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2609 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2610 /* Mic2 (as headphone out) for HP output */
2611 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2612 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2613 /* Line In pin widget for input */
2614 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2615 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2616 /* Line2 (as front mic) pin widget for input and vref at 80% */
2617 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2618 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2619 /* CD pin widget for input */
2620 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2626 * 5-stack pin configuration:
2627 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2628 * line-in/side = 0x1a, f-mic = 0x1b
2630 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2632 * preset connection lists of input pins
2633 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2635 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2636 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2639 * Set pin mode and muting
2641 /* set pin widgets 0x14-0x17 for output */
2642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2644 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2645 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2646 /* unmute pins for output (no gain on this amp) */
2647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2649 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2650 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2652 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2653 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2654 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2655 /* Mic2 (as headphone out) for HP output */
2656 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2657 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2658 /* Line In pin widget for input */
2659 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2660 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2661 /* Line2 (as front mic) pin widget for input and vref at 80% */
2662 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2663 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2664 /* CD pin widget for input */
2665 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2671 * W810 pin configuration:
2672 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2674 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2675 /* hphone/speaker input selector: front DAC */
2676 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2679 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2682 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2686 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2692 * Z71V pin configuration:
2693 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2695 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2696 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2697 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2699 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2702 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2703 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2704 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2710 * 6-stack pin configuration:
2711 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2712 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2714 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2715 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2718 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2721 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2722 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2723 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2724 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2726 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2727 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2728 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2729 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2730 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2731 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2733 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2740 * Uniwill pin configuration:
2741 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2744 static struct hda_verb alc880_uniwill_init_verbs[] = {
2745 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2751 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2752 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2753 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2754 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2757 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2758 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2759 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2767 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2769 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2772 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2773 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2780 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2782 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2783 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2789 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2790 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2791 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2792 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2793 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2794 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2795 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2796 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2802 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2805 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2806 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2811 static struct hda_verb alc880_beep_init_verbs[] = {
2812 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2816 /* auto-toggle front mic */
2817 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2819 unsigned int present;
2822 present = snd_hda_jack_detect(codec, 0x18);
2823 bits = present ? HDA_AMP_MUTE : 0;
2824 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2827 static void alc880_uniwill_setup(struct hda_codec *codec)
2829 struct alc_spec *spec = codec->spec;
2831 spec->autocfg.hp_pins[0] = 0x14;
2832 spec->autocfg.speaker_pins[0] = 0x15;
2833 spec->autocfg.speaker_pins[0] = 0x16;
2836 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2838 alc_automute_amp(codec);
2839 alc880_uniwill_mic_automute(codec);
2842 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2845 /* Looks like the unsol event is incompatible with the standard
2846 * definition. 4bit tag is placed at 28 bit!
2848 switch (res >> 28) {
2849 case ALC880_MIC_EVENT:
2850 alc880_uniwill_mic_automute(codec);
2853 alc_automute_amp_unsol_event(codec, res);
2858 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2860 struct alc_spec *spec = codec->spec;
2862 spec->autocfg.hp_pins[0] = 0x14;
2863 spec->autocfg.speaker_pins[0] = 0x15;
2866 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2868 unsigned int present;
2870 present = snd_hda_codec_read(codec, 0x21, 0,
2871 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2872 present &= HDA_AMP_VOLMASK;
2873 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2874 HDA_AMP_VOLMASK, present);
2875 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2876 HDA_AMP_VOLMASK, present);
2879 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2882 /* Looks like the unsol event is incompatible with the standard
2883 * definition. 4bit tag is placed at 28 bit!
2885 if ((res >> 28) == ALC880_DCVOL_EVENT)
2886 alc880_uniwill_p53_dcvol_automute(codec);
2888 alc_automute_amp_unsol_event(codec, res);
2892 * F1734 pin configuration:
2893 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2895 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2896 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2897 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2898 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2899 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2900 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2902 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2903 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2907 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2908 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2910 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2911 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2913 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2914 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2917 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2918 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2924 * ASUS pin configuration:
2925 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2927 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2928 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2929 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2930 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2931 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2933 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2934 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2935 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2936 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2937 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2939 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2940 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2943 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2945 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2948 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2950 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2955 /* Enable GPIO mask and set output */
2956 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2957 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2958 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2960 /* Clevo m520g init */
2961 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2962 /* headphone output */
2963 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2965 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2968 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2969 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2971 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2972 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2973 /* Mic1 (rear panel) */
2974 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2975 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2976 /* Mic2 (front panel) */
2977 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2978 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2980 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2981 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2982 /* change to EAPD mode */
2983 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2984 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2989 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2990 /* change to EAPD mode */
2991 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2992 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2994 /* Headphone output */
2995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2998 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3000 /* Line In pin widget for input */
3001 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3002 /* CD pin widget for input */
3003 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3004 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3005 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3007 /* change to EAPD mode */
3008 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3009 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3015 * LG m1 express dual
3018 * Rear Line-In/Out (blue): 0x14
3019 * Build-in Mic-In: 0x15
3021 * HP-Out (green): 0x1b
3022 * Mic-In/Out (red): 0x19
3026 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3027 static hda_nid_t alc880_lg_dac_nids[3] = {
3031 /* seems analog CD is not working */
3032 static struct hda_input_mux alc880_lg_capture_source = {
3037 { "Internal Mic", 0x6 },
3041 /* 2,4,6 channel modes */
3042 static struct hda_verb alc880_lg_ch2_init[] = {
3043 /* set line-in and mic-in to input */
3044 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3045 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3049 static struct hda_verb alc880_lg_ch4_init[] = {
3050 /* set line-in to out and mic-in to input */
3051 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3052 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3056 static struct hda_verb alc880_lg_ch6_init[] = {
3057 /* set line-in and mic-in to output */
3058 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3059 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3063 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3064 { 2, alc880_lg_ch2_init },
3065 { 4, alc880_lg_ch4_init },
3066 { 6, alc880_lg_ch6_init },
3069 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3070 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3071 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3072 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3073 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3074 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3075 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3076 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3077 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3079 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3081 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3082 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3083 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3086 .name = "Channel Mode",
3087 .info = alc_ch_mode_info,
3088 .get = alc_ch_mode_get,
3089 .put = alc_ch_mode_put,
3094 static struct hda_verb alc880_lg_init_verbs[] = {
3095 /* set capture source to mic-in */
3096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3097 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3098 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3099 /* mute all amp mixer inputs */
3100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3103 /* line-in to input */
3104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3110 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3111 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3112 /* mic-in to input */
3113 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3114 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3115 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3117 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3118 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3121 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3125 /* toggle speaker-output according to the hp-jack state */
3126 static void alc880_lg_setup(struct hda_codec *codec)
3128 struct alc_spec *spec = codec->spec;
3130 spec->autocfg.hp_pins[0] = 0x1b;
3131 spec->autocfg.speaker_pins[0] = 0x17;
3140 * Built-in Mic-In: 0x19
3146 static struct hda_input_mux alc880_lg_lw_capture_source = {
3150 { "Internal Mic", 0x1 },
3155 #define alc880_lg_lw_modes alc880_threestack_modes
3157 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3160 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3161 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3162 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3163 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3164 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3165 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3166 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3167 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3170 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3171 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3173 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3174 .name = "Channel Mode",
3175 .info = alc_ch_mode_info,
3176 .get = alc_ch_mode_get,
3177 .put = alc_ch_mode_put,
3182 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3183 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3184 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3185 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3187 /* set capture source to mic-in */
3188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3189 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3190 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3191 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3193 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3194 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3198 /* mic-in to input */
3199 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3202 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3203 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3205 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3209 /* toggle speaker-output according to the hp-jack state */
3210 static void alc880_lg_lw_setup(struct hda_codec *codec)
3212 struct alc_spec *spec = codec->spec;
3214 spec->autocfg.hp_pins[0] = 0x1b;
3215 spec->autocfg.speaker_pins[0] = 0x14;
3218 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3219 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3220 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3223 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3224 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3228 static struct hda_input_mux alc880_medion_rim_capture_source = {
3232 { "Internal Mic", 0x1 },
3236 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3237 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3239 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3240 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3242 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3243 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3244 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3245 /* Mic2 (as headphone out) for HP output */
3246 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3247 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3248 /* Internal Speaker */
3249 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3250 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3252 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3253 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3255 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3259 /* toggle speaker-output according to the hp-jack state */
3260 static void alc880_medion_rim_automute(struct hda_codec *codec)
3262 struct alc_spec *spec = codec->spec;
3263 alc_automute_amp(codec);
3265 if (spec->jack_present)
3266 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3268 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3271 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3274 /* Looks like the unsol event is incompatible with the standard
3275 * definition. 4bit tag is placed at 28 bit!
3277 if ((res >> 28) == ALC880_HP_EVENT)
3278 alc880_medion_rim_automute(codec);
3281 static void alc880_medion_rim_setup(struct hda_codec *codec)
3283 struct alc_spec *spec = codec->spec;
3285 spec->autocfg.hp_pins[0] = 0x14;
3286 spec->autocfg.speaker_pins[0] = 0x1b;
3289 #ifdef CONFIG_SND_HDA_POWER_SAVE
3290 static struct hda_amp_list alc880_loopbacks[] = {
3291 { 0x0b, HDA_INPUT, 0 },
3292 { 0x0b, HDA_INPUT, 1 },
3293 { 0x0b, HDA_INPUT, 2 },
3294 { 0x0b, HDA_INPUT, 3 },
3295 { 0x0b, HDA_INPUT, 4 },
3299 static struct hda_amp_list alc880_lg_loopbacks[] = {
3300 { 0x0b, HDA_INPUT, 1 },
3301 { 0x0b, HDA_INPUT, 6 },
3302 { 0x0b, HDA_INPUT, 7 },
3311 static int alc_init(struct hda_codec *codec)
3313 struct alc_spec *spec = codec->spec;
3317 alc_auto_init_amp(codec, spec->init_amp);
3319 for (i = 0; i < spec->num_init_verbs; i++)
3320 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3322 if (spec->init_hook)
3323 spec->init_hook(codec);
3328 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3330 struct alc_spec *spec = codec->spec;
3332 if (spec->unsol_event)
3333 spec->unsol_event(codec, res);
3336 #ifdef CONFIG_SND_HDA_POWER_SAVE
3337 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3339 struct alc_spec *spec = codec->spec;
3340 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3345 * Analog playback callbacks
3347 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3348 struct hda_codec *codec,
3349 struct snd_pcm_substream *substream)
3351 struct alc_spec *spec = codec->spec;
3352 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3356 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3357 struct hda_codec *codec,
3358 unsigned int stream_tag,
3359 unsigned int format,
3360 struct snd_pcm_substream *substream)
3362 struct alc_spec *spec = codec->spec;
3363 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3364 stream_tag, format, substream);
3367 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3368 struct hda_codec *codec,
3369 struct snd_pcm_substream *substream)
3371 struct alc_spec *spec = codec->spec;
3372 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3378 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3379 struct hda_codec *codec,
3380 struct snd_pcm_substream *substream)
3382 struct alc_spec *spec = codec->spec;
3383 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3386 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3387 struct hda_codec *codec,
3388 unsigned int stream_tag,
3389 unsigned int format,
3390 struct snd_pcm_substream *substream)
3392 struct alc_spec *spec = codec->spec;
3393 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3394 stream_tag, format, substream);
3397 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3398 struct hda_codec *codec,
3399 struct snd_pcm_substream *substream)
3401 struct alc_spec *spec = codec->spec;
3402 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3405 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3406 struct hda_codec *codec,
3407 struct snd_pcm_substream *substream)
3409 struct alc_spec *spec = codec->spec;
3410 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3416 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3417 struct hda_codec *codec,
3418 unsigned int stream_tag,
3419 unsigned int format,
3420 struct snd_pcm_substream *substream)
3422 struct alc_spec *spec = codec->spec;
3424 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3425 stream_tag, 0, format);
3429 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3430 struct hda_codec *codec,
3431 struct snd_pcm_substream *substream)
3433 struct alc_spec *spec = codec->spec;
3435 snd_hda_codec_cleanup_stream(codec,
3436 spec->adc_nids[substream->number + 1]);
3443 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3447 /* NID is set in alc_build_pcms */
3449 .open = alc880_playback_pcm_open,
3450 .prepare = alc880_playback_pcm_prepare,
3451 .cleanup = alc880_playback_pcm_cleanup
3455 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3459 /* NID is set in alc_build_pcms */
3462 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3466 /* NID is set in alc_build_pcms */
3469 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3470 .substreams = 2, /* can be overridden */
3473 /* NID is set in alc_build_pcms */
3475 .prepare = alc880_alt_capture_pcm_prepare,
3476 .cleanup = alc880_alt_capture_pcm_cleanup
3480 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3484 /* NID is set in alc_build_pcms */
3486 .open = alc880_dig_playback_pcm_open,
3487 .close = alc880_dig_playback_pcm_close,
3488 .prepare = alc880_dig_playback_pcm_prepare,
3489 .cleanup = alc880_dig_playback_pcm_cleanup
3493 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3497 /* NID is set in alc_build_pcms */
3500 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3501 static struct hda_pcm_stream alc_pcm_null_stream = {
3507 static int alc_build_pcms(struct hda_codec *codec)
3509 struct alc_spec *spec = codec->spec;
3510 struct hda_pcm *info = spec->pcm_rec;
3513 codec->num_pcms = 1;
3514 codec->pcm_info = info;
3516 if (spec->no_analog)
3519 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3520 "%s Analog", codec->chip_name);
3521 info->name = spec->stream_name_analog;
3523 if (spec->stream_analog_playback) {
3524 if (snd_BUG_ON(!spec->multiout.dac_nids))
3526 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3527 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3529 if (spec->stream_analog_capture) {
3530 if (snd_BUG_ON(!spec->adc_nids))
3532 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3533 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3536 if (spec->channel_mode) {
3537 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3538 for (i = 0; i < spec->num_channel_mode; i++) {
3539 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3540 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3546 /* SPDIF for stream index #1 */
3547 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3548 snprintf(spec->stream_name_digital,
3549 sizeof(spec->stream_name_digital),
3550 "%s Digital", codec->chip_name);
3551 codec->num_pcms = 2;
3552 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3553 info = spec->pcm_rec + 1;
3554 info->name = spec->stream_name_digital;
3555 if (spec->dig_out_type)
3556 info->pcm_type = spec->dig_out_type;
3558 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3559 if (spec->multiout.dig_out_nid &&
3560 spec->stream_digital_playback) {
3561 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3562 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3564 if (spec->dig_in_nid &&
3565 spec->stream_digital_capture) {
3566 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3567 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3569 /* FIXME: do we need this for all Realtek codec models? */
3570 codec->spdif_status_reset = 1;
3573 if (spec->no_analog)
3576 /* If the use of more than one ADC is requested for the current
3577 * model, configure a second analog capture-only PCM.
3579 /* Additional Analaog capture for index #2 */
3580 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3581 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3582 codec->num_pcms = 3;
3583 info = spec->pcm_rec + 2;
3584 info->name = spec->stream_name_analog;
3585 if (spec->alt_dac_nid) {
3586 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3587 *spec->stream_analog_alt_playback;
3588 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3591 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3592 alc_pcm_null_stream;
3593 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3595 if (spec->num_adc_nids > 1) {
3596 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3597 *spec->stream_analog_alt_capture;
3598 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3600 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3601 spec->num_adc_nids - 1;
3603 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3604 alc_pcm_null_stream;
3605 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3612 static void alc_free_kctls(struct hda_codec *codec)
3614 struct alc_spec *spec = codec->spec;
3616 if (spec->kctls.list) {
3617 struct snd_kcontrol_new *kctl = spec->kctls.list;
3619 for (i = 0; i < spec->kctls.used; i++)
3620 kfree(kctl[i].name);
3622 snd_array_free(&spec->kctls);
3625 static void alc_free(struct hda_codec *codec)
3627 struct alc_spec *spec = codec->spec;
3632 alc_free_kctls(codec);
3634 snd_hda_detach_beep_device(codec);
3637 #ifdef CONFIG_SND_HDA_POWER_SAVE
3638 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3640 struct alc_spec *spec = codec->spec;
3641 if (spec && spec->power_hook)
3642 spec->power_hook(codec, 0);
3647 #ifdef SND_HDA_NEEDS_RESUME
3648 static int alc_resume(struct hda_codec *codec)
3650 #ifdef CONFIG_SND_HDA_POWER_SAVE
3651 struct alc_spec *spec = codec->spec;
3653 codec->patch_ops.init(codec);
3654 snd_hda_codec_resume_amp(codec);
3655 snd_hda_codec_resume_cache(codec);
3656 #ifdef CONFIG_SND_HDA_POWER_SAVE
3657 if (spec && spec->power_hook)
3658 spec->power_hook(codec, 1);
3666 static struct hda_codec_ops alc_patch_ops = {
3667 .build_controls = alc_build_controls,
3668 .build_pcms = alc_build_pcms,
3671 .unsol_event = alc_unsol_event,
3672 #ifdef SND_HDA_NEEDS_RESUME
3673 .resume = alc_resume,
3675 #ifdef CONFIG_SND_HDA_POWER_SAVE
3676 .suspend = alc_suspend,
3677 .check_power_status = alc_check_power_status,
3683 * Test configuration for debugging
3685 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3688 #ifdef CONFIG_SND_DEBUG
3689 static hda_nid_t alc880_test_dac_nids[4] = {
3690 0x02, 0x03, 0x04, 0x05
3693 static struct hda_input_mux alc880_test_capture_source = {
3702 { "Surround", 0x6 },
3706 static struct hda_channel_mode alc880_test_modes[4] = {
3713 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3714 struct snd_ctl_elem_info *uinfo)
3716 static char *texts[] = {
3717 "N/A", "Line Out", "HP Out",
3718 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3720 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3722 uinfo->value.enumerated.items = 8;
3723 if (uinfo->value.enumerated.item >= 8)
3724 uinfo->value.enumerated.item = 7;
3725 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3729 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3730 struct snd_ctl_elem_value *ucontrol)
3732 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3733 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3734 unsigned int pin_ctl, item = 0;
3736 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3737 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3738 if (pin_ctl & AC_PINCTL_OUT_EN) {
3739 if (pin_ctl & AC_PINCTL_HP_EN)
3743 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3744 switch (pin_ctl & AC_PINCTL_VREFEN) {
3745 case AC_PINCTL_VREF_HIZ: item = 3; break;
3746 case AC_PINCTL_VREF_50: item = 4; break;
3747 case AC_PINCTL_VREF_GRD: item = 5; break;
3748 case AC_PINCTL_VREF_80: item = 6; break;
3749 case AC_PINCTL_VREF_100: item = 7; break;
3752 ucontrol->value.enumerated.item[0] = item;
3756 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3757 struct snd_ctl_elem_value *ucontrol)
3759 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3760 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3761 static unsigned int ctls[] = {
3762 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3763 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3764 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3765 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3766 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3767 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3769 unsigned int old_ctl, new_ctl;
3771 old_ctl = snd_hda_codec_read(codec, nid, 0,
3772 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3773 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3774 if (old_ctl != new_ctl) {
3776 snd_hda_codec_write_cache(codec, nid, 0,
3777 AC_VERB_SET_PIN_WIDGET_CONTROL,
3779 val = ucontrol->value.enumerated.item[0] >= 3 ?
3781 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3788 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3789 struct snd_ctl_elem_info *uinfo)
3791 static char *texts[] = {
3792 "Front", "Surround", "CLFE", "Side"
3794 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3796 uinfo->value.enumerated.items = 4;
3797 if (uinfo->value.enumerated.item >= 4)
3798 uinfo->value.enumerated.item = 3;
3799 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3803 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3804 struct snd_ctl_elem_value *ucontrol)
3806 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3807 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3810 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3811 ucontrol->value.enumerated.item[0] = sel & 3;
3815 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3816 struct snd_ctl_elem_value *ucontrol)
3818 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3819 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3822 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3823 if (ucontrol->value.enumerated.item[0] != sel) {
3824 sel = ucontrol->value.enumerated.item[0] & 3;
3825 snd_hda_codec_write_cache(codec, nid, 0,
3826 AC_VERB_SET_CONNECT_SEL, sel);
3832 #define PIN_CTL_TEST(xname,nid) { \
3833 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3835 .info = alc_test_pin_ctl_info, \
3836 .get = alc_test_pin_ctl_get, \
3837 .put = alc_test_pin_ctl_put, \
3838 .private_value = nid \
3841 #define PIN_SRC_TEST(xname,nid) { \
3842 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3844 .info = alc_test_pin_src_info, \
3845 .get = alc_test_pin_src_get, \
3846 .put = alc_test_pin_src_put, \
3847 .private_value = nid \
3850 static struct snd_kcontrol_new alc880_test_mixer[] = {
3851 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3852 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3853 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3854 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3855 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3856 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3857 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3858 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3859 PIN_CTL_TEST("Front Pin Mode", 0x14),
3860 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3861 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3862 PIN_CTL_TEST("Side Pin Mode", 0x17),
3863 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3864 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3865 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3866 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3867 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3868 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3869 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3870 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3871 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3872 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3873 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3874 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3875 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3876 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3877 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3878 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3879 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3880 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3882 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3883 .name = "Channel Mode",
3884 .info = alc_ch_mode_info,
3885 .get = alc_ch_mode_get,
3886 .put = alc_ch_mode_put,
3891 static struct hda_verb alc880_test_init_verbs[] = {
3892 /* Unmute inputs of 0x0c - 0x0f */
3893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3899 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3900 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3901 /* Vol output for 0x0c-0x0f */
3902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3905 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3906 /* Set output pins 0x14-0x17 */
3907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3908 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3909 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3910 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3911 /* Unmute output pins 0x14-0x17 */
3912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3914 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3915 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3916 /* Set input pins 0x18-0x1c */
3917 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3918 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3919 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3920 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3921 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3922 /* Mute input pins 0x18-0x1b */
3923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3924 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3925 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3926 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3929 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3931 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3932 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3933 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3934 /* Analog input/passthru */
3935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3947 static const char *alc880_models[ALC880_MODEL_LAST] = {
3948 [ALC880_3ST] = "3stack",
3949 [ALC880_TCL_S700] = "tcl",
3950 [ALC880_3ST_DIG] = "3stack-digout",
3951 [ALC880_CLEVO] = "clevo",
3952 [ALC880_5ST] = "5stack",
3953 [ALC880_5ST_DIG] = "5stack-digout",
3954 [ALC880_W810] = "w810",
3955 [ALC880_Z71V] = "z71v",
3956 [ALC880_6ST] = "6stack",
3957 [ALC880_6ST_DIG] = "6stack-digout",
3958 [ALC880_ASUS] = "asus",
3959 [ALC880_ASUS_W1V] = "asus-w1v",
3960 [ALC880_ASUS_DIG] = "asus-dig",
3961 [ALC880_ASUS_DIG2] = "asus-dig2",
3962 [ALC880_UNIWILL_DIG] = "uniwill",
3963 [ALC880_UNIWILL_P53] = "uniwill-p53",
3964 [ALC880_FUJITSU] = "fujitsu",
3965 [ALC880_F1734] = "F1734",
3967 [ALC880_LG_LW] = "lg-lw",
3968 [ALC880_MEDION_RIM] = "medion",
3969 #ifdef CONFIG_SND_DEBUG
3970 [ALC880_TEST] = "test",
3972 [ALC880_AUTO] = "auto",
3975 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3976 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3977 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3978 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3979 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3980 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3981 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3982 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3983 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3984 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3985 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3986 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3987 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3988 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3989 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3990 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3991 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3992 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3993 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3994 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3995 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3996 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3997 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3998 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3999 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4000 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4001 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4002 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4003 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4004 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4005 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4006 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4007 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4008 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4009 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4010 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4011 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4012 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4013 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4014 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4015 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4016 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4017 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4018 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4019 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4020 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4021 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4022 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4023 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4024 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4025 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4026 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4027 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4028 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4029 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4030 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4031 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4032 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4033 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4034 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4035 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4036 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4037 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4038 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4039 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4040 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4041 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4042 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4043 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4045 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4046 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4047 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4052 * ALC880 codec presets
4054 static struct alc_config_preset alc880_presets[] = {
4056 .mixers = { alc880_three_stack_mixer },
4057 .init_verbs = { alc880_volume_init_verbs,
4058 alc880_pin_3stack_init_verbs },
4059 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4060 .dac_nids = alc880_dac_nids,
4061 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4062 .channel_mode = alc880_threestack_modes,
4064 .input_mux = &alc880_capture_source,
4066 [ALC880_3ST_DIG] = {
4067 .mixers = { alc880_three_stack_mixer },
4068 .init_verbs = { alc880_volume_init_verbs,
4069 alc880_pin_3stack_init_verbs },
4070 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4071 .dac_nids = alc880_dac_nids,
4072 .dig_out_nid = ALC880_DIGOUT_NID,
4073 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4074 .channel_mode = alc880_threestack_modes,
4076 .input_mux = &alc880_capture_source,
4078 [ALC880_TCL_S700] = {
4079 .mixers = { alc880_tcl_s700_mixer },
4080 .init_verbs = { alc880_volume_init_verbs,
4081 alc880_pin_tcl_S700_init_verbs,
4082 alc880_gpio2_init_verbs },
4083 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4084 .dac_nids = alc880_dac_nids,
4085 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4086 .num_adc_nids = 1, /* single ADC */
4088 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4089 .channel_mode = alc880_2_jack_modes,
4090 .input_mux = &alc880_capture_source,
4093 .mixers = { alc880_three_stack_mixer,
4094 alc880_five_stack_mixer},
4095 .init_verbs = { alc880_volume_init_verbs,
4096 alc880_pin_5stack_init_verbs },
4097 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4098 .dac_nids = alc880_dac_nids,
4099 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4100 .channel_mode = alc880_fivestack_modes,
4101 .input_mux = &alc880_capture_source,
4103 [ALC880_5ST_DIG] = {
4104 .mixers = { alc880_three_stack_mixer,
4105 alc880_five_stack_mixer },
4106 .init_verbs = { alc880_volume_init_verbs,
4107 alc880_pin_5stack_init_verbs },
4108 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4109 .dac_nids = alc880_dac_nids,
4110 .dig_out_nid = ALC880_DIGOUT_NID,
4111 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4112 .channel_mode = alc880_fivestack_modes,
4113 .input_mux = &alc880_capture_source,
4116 .mixers = { alc880_six_stack_mixer },
4117 .init_verbs = { alc880_volume_init_verbs,
4118 alc880_pin_6stack_init_verbs },
4119 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4120 .dac_nids = alc880_6st_dac_nids,
4121 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4122 .channel_mode = alc880_sixstack_modes,
4123 .input_mux = &alc880_6stack_capture_source,
4125 [ALC880_6ST_DIG] = {
4126 .mixers = { alc880_six_stack_mixer },
4127 .init_verbs = { alc880_volume_init_verbs,
4128 alc880_pin_6stack_init_verbs },
4129 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4130 .dac_nids = alc880_6st_dac_nids,
4131 .dig_out_nid = ALC880_DIGOUT_NID,
4132 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4133 .channel_mode = alc880_sixstack_modes,
4134 .input_mux = &alc880_6stack_capture_source,
4137 .mixers = { alc880_w810_base_mixer },
4138 .init_verbs = { alc880_volume_init_verbs,
4139 alc880_pin_w810_init_verbs,
4140 alc880_gpio2_init_verbs },
4141 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4142 .dac_nids = alc880_w810_dac_nids,
4143 .dig_out_nid = ALC880_DIGOUT_NID,
4144 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4145 .channel_mode = alc880_w810_modes,
4146 .input_mux = &alc880_capture_source,
4149 .mixers = { alc880_z71v_mixer },
4150 .init_verbs = { alc880_volume_init_verbs,
4151 alc880_pin_z71v_init_verbs },
4152 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4153 .dac_nids = alc880_z71v_dac_nids,
4154 .dig_out_nid = ALC880_DIGOUT_NID,
4156 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4157 .channel_mode = alc880_2_jack_modes,
4158 .input_mux = &alc880_capture_source,
4161 .mixers = { alc880_f1734_mixer },
4162 .init_verbs = { alc880_volume_init_verbs,
4163 alc880_pin_f1734_init_verbs },
4164 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4165 .dac_nids = alc880_f1734_dac_nids,
4167 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4168 .channel_mode = alc880_2_jack_modes,
4169 .input_mux = &alc880_f1734_capture_source,
4170 .unsol_event = alc880_uniwill_p53_unsol_event,
4171 .setup = alc880_uniwill_p53_setup,
4172 .init_hook = alc_automute_amp,
4175 .mixers = { alc880_asus_mixer },
4176 .init_verbs = { alc880_volume_init_verbs,
4177 alc880_pin_asus_init_verbs,
4178 alc880_gpio1_init_verbs },
4179 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4180 .dac_nids = alc880_asus_dac_nids,
4181 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4182 .channel_mode = alc880_asus_modes,
4184 .input_mux = &alc880_capture_source,
4186 [ALC880_ASUS_DIG] = {
4187 .mixers = { alc880_asus_mixer },
4188 .init_verbs = { alc880_volume_init_verbs,
4189 alc880_pin_asus_init_verbs,
4190 alc880_gpio1_init_verbs },
4191 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4192 .dac_nids = alc880_asus_dac_nids,
4193 .dig_out_nid = ALC880_DIGOUT_NID,
4194 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4195 .channel_mode = alc880_asus_modes,
4197 .input_mux = &alc880_capture_source,
4199 [ALC880_ASUS_DIG2] = {
4200 .mixers = { alc880_asus_mixer },
4201 .init_verbs = { alc880_volume_init_verbs,
4202 alc880_pin_asus_init_verbs,
4203 alc880_gpio2_init_verbs }, /* use GPIO2 */
4204 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4205 .dac_nids = alc880_asus_dac_nids,
4206 .dig_out_nid = ALC880_DIGOUT_NID,
4207 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4208 .channel_mode = alc880_asus_modes,
4210 .input_mux = &alc880_capture_source,
4212 [ALC880_ASUS_W1V] = {
4213 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4214 .init_verbs = { alc880_volume_init_verbs,
4215 alc880_pin_asus_init_verbs,
4216 alc880_gpio1_init_verbs },
4217 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4218 .dac_nids = alc880_asus_dac_nids,
4219 .dig_out_nid = ALC880_DIGOUT_NID,
4220 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4221 .channel_mode = alc880_asus_modes,
4223 .input_mux = &alc880_capture_source,
4225 [ALC880_UNIWILL_DIG] = {
4226 .mixers = { alc880_asus_mixer },
4227 .init_verbs = { alc880_volume_init_verbs,
4228 alc880_pin_asus_init_verbs },
4229 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4230 .dac_nids = alc880_asus_dac_nids,
4231 .dig_out_nid = ALC880_DIGOUT_NID,
4232 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4233 .channel_mode = alc880_asus_modes,
4235 .input_mux = &alc880_capture_source,
4237 [ALC880_UNIWILL] = {
4238 .mixers = { alc880_uniwill_mixer },
4239 .init_verbs = { alc880_volume_init_verbs,
4240 alc880_uniwill_init_verbs },
4241 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4242 .dac_nids = alc880_asus_dac_nids,
4243 .dig_out_nid = ALC880_DIGOUT_NID,
4244 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4245 .channel_mode = alc880_threestack_modes,
4247 .input_mux = &alc880_capture_source,
4248 .unsol_event = alc880_uniwill_unsol_event,
4249 .setup = alc880_uniwill_setup,
4250 .init_hook = alc880_uniwill_init_hook,
4252 [ALC880_UNIWILL_P53] = {
4253 .mixers = { alc880_uniwill_p53_mixer },
4254 .init_verbs = { alc880_volume_init_verbs,
4255 alc880_uniwill_p53_init_verbs },
4256 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4257 .dac_nids = alc880_asus_dac_nids,
4258 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4259 .channel_mode = alc880_threestack_modes,
4260 .input_mux = &alc880_capture_source,
4261 .unsol_event = alc880_uniwill_p53_unsol_event,
4262 .setup = alc880_uniwill_p53_setup,
4263 .init_hook = alc_automute_amp,
4265 [ALC880_FUJITSU] = {
4266 .mixers = { alc880_fujitsu_mixer },
4267 .init_verbs = { alc880_volume_init_verbs,
4268 alc880_uniwill_p53_init_verbs,
4269 alc880_beep_init_verbs },
4270 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4271 .dac_nids = alc880_dac_nids,
4272 .dig_out_nid = ALC880_DIGOUT_NID,
4273 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4274 .channel_mode = alc880_2_jack_modes,
4275 .input_mux = &alc880_capture_source,
4276 .unsol_event = alc880_uniwill_p53_unsol_event,
4277 .setup = alc880_uniwill_p53_setup,
4278 .init_hook = alc_automute_amp,
4281 .mixers = { alc880_three_stack_mixer },
4282 .init_verbs = { alc880_volume_init_verbs,
4283 alc880_pin_clevo_init_verbs },
4284 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4285 .dac_nids = alc880_dac_nids,
4287 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4288 .channel_mode = alc880_threestack_modes,
4290 .input_mux = &alc880_capture_source,
4293 .mixers = { alc880_lg_mixer },
4294 .init_verbs = { alc880_volume_init_verbs,
4295 alc880_lg_init_verbs },
4296 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4297 .dac_nids = alc880_lg_dac_nids,
4298 .dig_out_nid = ALC880_DIGOUT_NID,
4299 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4300 .channel_mode = alc880_lg_ch_modes,
4302 .input_mux = &alc880_lg_capture_source,
4303 .unsol_event = alc_automute_amp_unsol_event,
4304 .setup = alc880_lg_setup,
4305 .init_hook = alc_automute_amp,
4306 #ifdef CONFIG_SND_HDA_POWER_SAVE
4307 .loopbacks = alc880_lg_loopbacks,
4311 .mixers = { alc880_lg_lw_mixer },
4312 .init_verbs = { alc880_volume_init_verbs,
4313 alc880_lg_lw_init_verbs },
4314 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4315 .dac_nids = alc880_dac_nids,
4316 .dig_out_nid = ALC880_DIGOUT_NID,
4317 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4318 .channel_mode = alc880_lg_lw_modes,
4319 .input_mux = &alc880_lg_lw_capture_source,
4320 .unsol_event = alc_automute_amp_unsol_event,
4321 .setup = alc880_lg_lw_setup,
4322 .init_hook = alc_automute_amp,
4324 [ALC880_MEDION_RIM] = {
4325 .mixers = { alc880_medion_rim_mixer },
4326 .init_verbs = { alc880_volume_init_verbs,
4327 alc880_medion_rim_init_verbs,
4328 alc_gpio2_init_verbs },
4329 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4330 .dac_nids = alc880_dac_nids,
4331 .dig_out_nid = ALC880_DIGOUT_NID,
4332 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4333 .channel_mode = alc880_2_jack_modes,
4334 .input_mux = &alc880_medion_rim_capture_source,
4335 .unsol_event = alc880_medion_rim_unsol_event,
4336 .setup = alc880_medion_rim_setup,
4337 .init_hook = alc880_medion_rim_automute,
4339 #ifdef CONFIG_SND_DEBUG
4341 .mixers = { alc880_test_mixer },
4342 .init_verbs = { alc880_test_init_verbs },
4343 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4344 .dac_nids = alc880_test_dac_nids,
4345 .dig_out_nid = ALC880_DIGOUT_NID,
4346 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4347 .channel_mode = alc880_test_modes,
4348 .input_mux = &alc880_test_capture_source,
4354 * Automatic parse of I/O pins from the BIOS configuration
4359 ALC_CTL_WIDGET_MUTE,
4362 static struct snd_kcontrol_new alc880_control_templates[] = {
4363 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4364 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4365 HDA_BIND_MUTE(NULL, 0, 0, 0),
4368 /* add dynamic controls */
4369 static int add_control(struct alc_spec *spec, int type, const char *name,
4372 struct snd_kcontrol_new *knew;
4374 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4375 knew = snd_array_new(&spec->kctls);
4378 *knew = alc880_control_templates[type];
4379 knew->name = kstrdup(name, GFP_KERNEL);
4382 if (get_amp_nid_(val))
4383 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4384 knew->private_value = val;
4388 static int add_control_with_pfx(struct alc_spec *spec, int type,
4389 const char *pfx, const char *dir,
4390 const char *sfx, unsigned long val)
4393 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4394 return add_control(spec, type, name, val);
4397 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4398 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4399 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4400 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4402 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4403 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4404 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4405 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4406 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4407 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4408 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4409 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4410 #define ALC880_PIN_CD_NID 0x1c
4412 /* fill in the dac_nids table from the parsed pin configuration */
4413 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4414 const struct auto_pin_cfg *cfg)
4420 memset(assigned, 0, sizeof(assigned));
4421 spec->multiout.dac_nids = spec->private_dac_nids;
4423 /* check the pins hardwired to audio widget */
4424 for (i = 0; i < cfg->line_outs; i++) {
4425 nid = cfg->line_out_pins[i];
4426 if (alc880_is_fixed_pin(nid)) {
4427 int idx = alc880_fixed_pin_idx(nid);
4428 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4432 /* left pins can be connect to any audio widget */
4433 for (i = 0; i < cfg->line_outs; i++) {
4434 nid = cfg->line_out_pins[i];
4435 if (alc880_is_fixed_pin(nid))
4437 /* search for an empty channel */
4438 for (j = 0; j < cfg->line_outs; j++) {
4440 spec->multiout.dac_nids[i] =
4441 alc880_idx_to_dac(j);
4447 spec->multiout.num_dacs = cfg->line_outs;
4451 /* add playback controls from the parsed DAC table */
4452 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4453 const struct auto_pin_cfg *cfg)
4455 static const char *chname[4] = {
4456 "Front", "Surround", NULL /*CLFE*/, "Side"
4461 for (i = 0; i < cfg->line_outs; i++) {
4462 if (!spec->multiout.dac_nids[i])
4464 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4467 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4469 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4473 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4475 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4479 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4481 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4485 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4487 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4493 if (cfg->line_outs == 1 &&
4494 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4498 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4499 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4503 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4504 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4513 /* add playback controls for speaker and HP outputs */
4514 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4523 if (alc880_is_fixed_pin(pin)) {
4524 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4525 /* specify the DAC as the extra output */
4526 if (!spec->multiout.hp_nid)
4527 spec->multiout.hp_nid = nid;
4529 spec->multiout.extra_out_nid[0] = nid;
4530 /* control HP volume/switch on the output mixer amp */
4531 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4532 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4533 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4536 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4537 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4540 } else if (alc880_is_multi_pin(pin)) {
4541 /* set manual connection */
4542 /* we have only a switch on HP-out PIN */
4543 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4544 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4551 /* create input playback/capture controls for the given pin */
4552 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4553 const char *ctlname,
4554 int idx, hda_nid_t mix_nid)
4558 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4559 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4562 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4563 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4569 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4571 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4572 return (pincap & AC_PINCAP_IN) != 0;
4575 /* create playback/capture controls for input pins */
4576 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4577 const struct auto_pin_cfg *cfg,
4579 hda_nid_t cap1, hda_nid_t cap2)
4581 struct alc_spec *spec = codec->spec;
4582 struct hda_input_mux *imux = &spec->private_imux[0];
4585 for (i = 0; i < AUTO_PIN_LAST; i++) {
4588 pin = cfg->input_pins[i];
4589 if (!alc_is_input_pin(codec, pin))
4593 idx = get_connection_index(codec, mixer, pin);
4595 err = new_analog_input(spec, pin,
4596 auto_pin_cfg_labels[i],
4605 idx = get_connection_index(codec, cap1, pin);
4606 if (idx < 0 && cap2)
4607 idx = get_connection_index(codec, cap2, pin);
4609 imux->items[imux->num_items].label =
4610 auto_pin_cfg_labels[i];
4611 imux->items[imux->num_items].index = idx;
4618 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4619 const struct auto_pin_cfg *cfg)
4621 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4624 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4625 unsigned int pin_type)
4627 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4630 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4634 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4635 hda_nid_t nid, int pin_type,
4638 alc_set_pin_output(codec, nid, pin_type);
4639 /* need the manual connection? */
4640 if (alc880_is_multi_pin(nid)) {
4641 struct alc_spec *spec = codec->spec;
4642 int idx = alc880_multi_pin_idx(nid);
4643 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4644 AC_VERB_SET_CONNECT_SEL,
4645 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4649 static int get_pin_type(int line_out_type)
4651 if (line_out_type == AUTO_PIN_HP_OUT)
4657 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4659 struct alc_spec *spec = codec->spec;
4662 for (i = 0; i < spec->autocfg.line_outs; i++) {
4663 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4664 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4665 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4669 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4671 struct alc_spec *spec = codec->spec;
4674 pin = spec->autocfg.speaker_pins[0];
4675 if (pin) /* connect to front */
4676 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4677 pin = spec->autocfg.hp_pins[0];
4678 if (pin) /* connect to front */
4679 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4682 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4684 struct alc_spec *spec = codec->spec;
4687 for (i = 0; i < AUTO_PIN_LAST; i++) {
4688 hda_nid_t nid = spec->autocfg.input_pins[i];
4689 if (alc_is_input_pin(codec, nid)) {
4690 alc_set_input_pin(codec, nid, i);
4691 if (nid != ALC880_PIN_CD_NID &&
4692 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4693 snd_hda_codec_write(codec, nid, 0,
4694 AC_VERB_SET_AMP_GAIN_MUTE,
4700 /* parse the BIOS configuration and set up the alc_spec */
4701 /* return 1 if successful, 0 if the proper config is not found,
4702 * or a negative error code
4704 static int alc880_parse_auto_config(struct hda_codec *codec)
4706 struct alc_spec *spec = codec->spec;
4708 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4710 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4714 if (!spec->autocfg.line_outs)
4715 return 0; /* can't find valid BIOS pin config */
4717 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4720 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4723 err = alc880_auto_create_extra_out(spec,
4724 spec->autocfg.speaker_pins[0],
4728 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4732 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4736 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4738 /* check multiple SPDIF-out (for recent codecs) */
4739 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4741 err = snd_hda_get_connections(codec,
4742 spec->autocfg.dig_out_pins[i],
4747 spec->multiout.dig_out_nid = dig_nid;
4749 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4750 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4752 spec->slave_dig_outs[i - 1] = dig_nid;
4755 if (spec->autocfg.dig_in_pin)
4756 spec->dig_in_nid = ALC880_DIGIN_NID;
4758 if (spec->kctls.list)
4759 add_mixer(spec, spec->kctls.list);
4761 add_verb(spec, alc880_volume_init_verbs);
4763 spec->num_mux_defs = 1;
4764 spec->input_mux = &spec->private_imux[0];
4766 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4771 /* additional initialization for auto-configuration model */
4772 static void alc880_auto_init(struct hda_codec *codec)
4774 struct alc_spec *spec = codec->spec;
4775 alc880_auto_init_multi_out(codec);
4776 alc880_auto_init_extra_out(codec);
4777 alc880_auto_init_analog_input(codec);
4778 if (spec->unsol_event)
4779 alc_inithook(codec);
4782 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4783 * one of two digital mic pins, e.g. on ALC272
4785 static void fixup_automic_adc(struct hda_codec *codec)
4787 struct alc_spec *spec = codec->spec;
4790 for (i = 0; i < spec->num_adc_nids; i++) {
4791 hda_nid_t cap = spec->capsrc_nids ?
4792 spec->capsrc_nids[i] : spec->adc_nids[i];
4795 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4798 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4801 spec->int_mic.mux_idx = iidx;
4802 spec->ext_mic.mux_idx = eidx;
4803 if (spec->capsrc_nids)
4804 spec->capsrc_nids += i;
4805 spec->adc_nids += i;
4806 spec->num_adc_nids = 1;
4809 snd_printd(KERN_INFO "hda_codec: %s: "
4810 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4811 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4812 spec->auto_mic = 0; /* disable auto-mic to be sure */
4815 static void set_capture_mixer(struct hda_codec *codec)
4817 struct alc_spec *spec = codec->spec;
4818 static struct snd_kcontrol_new *caps[2][3] = {
4819 { alc_capture_mixer_nosrc1,
4820 alc_capture_mixer_nosrc2,
4821 alc_capture_mixer_nosrc3 },
4822 { alc_capture_mixer1,
4824 alc_capture_mixer3 },
4826 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4828 if (spec->auto_mic) {
4830 fixup_automic_adc(codec);
4831 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4835 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4839 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4840 #define set_beep_amp(spec, nid, idx, dir) \
4841 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4843 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4847 * OK, here we have finally the patch for ALC880
4850 static int patch_alc880(struct hda_codec *codec)
4852 struct alc_spec *spec;
4856 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4862 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4865 if (board_config < 0) {
4866 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4868 board_config = ALC880_AUTO;
4871 if (board_config == ALC880_AUTO) {
4872 /* automatic parse from the BIOS config */
4873 err = alc880_parse_auto_config(codec);
4879 "hda_codec: Cannot set up configuration "
4880 "from BIOS. Using 3-stack mode...\n");
4881 board_config = ALC880_3ST;
4885 err = snd_hda_attach_beep_device(codec, 0x1);
4891 if (board_config != ALC880_AUTO)
4892 setup_preset(codec, &alc880_presets[board_config]);
4894 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4895 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4896 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4898 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4899 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4901 if (!spec->adc_nids && spec->input_mux) {
4902 /* check whether NID 0x07 is valid */
4903 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4905 wcap = get_wcaps_type(wcap);
4906 if (wcap != AC_WID_AUD_IN) {
4907 spec->adc_nids = alc880_adc_nids_alt;
4908 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4910 spec->adc_nids = alc880_adc_nids;
4911 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4914 set_capture_mixer(codec);
4915 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4917 spec->vmaster_nid = 0x0c;
4919 codec->patch_ops = alc_patch_ops;
4920 if (board_config == ALC880_AUTO)
4921 spec->init_hook = alc880_auto_init;
4922 #ifdef CONFIG_SND_HDA_POWER_SAVE
4923 if (!spec->loopback.amplist)
4924 spec->loopback.amplist = alc880_loopbacks;
4926 codec->proc_widget_hook = print_realtek_coef;
4936 static hda_nid_t alc260_dac_nids[1] = {
4941 static hda_nid_t alc260_adc_nids[1] = {
4946 static hda_nid_t alc260_adc_nids_alt[1] = {
4951 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4952 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4954 static hda_nid_t alc260_dual_adc_nids[2] = {
4959 #define ALC260_DIGOUT_NID 0x03
4960 #define ALC260_DIGIN_NID 0x06
4962 static struct hda_input_mux alc260_capture_source = {
4966 { "Front Mic", 0x1 },
4972 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4973 * headphone jack and the internal CD lines since these are the only pins at
4974 * which audio can appear. For flexibility, also allow the option of
4975 * recording the mixer output on the second ADC (ADC0 doesn't have a
4976 * connection to the mixer output).
4978 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4982 { "Mic/Line", 0x0 },
4984 { "Headphone", 0x2 },
4990 { "Mic/Line", 0x0 },
4992 { "Headphone", 0x2 },
4999 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5000 * the Fujitsu S702x, but jacks are marked differently.
5002 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5009 { "Headphone", 0x5 },
5018 { "Headphone", 0x6 },
5024 /* Maxdata Favorit 100XS */
5025 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5029 { "Line/Mic", 0x0 },
5036 { "Line/Mic", 0x0 },
5044 * This is just place-holder, so there's something for alc_build_pcms to look
5045 * at when it calculates the maximum number of channels. ALC260 has no mixer
5046 * element which allows changing the channel mode, so the verb list is
5049 static struct hda_channel_mode alc260_modes[1] = {
5054 /* Mixer combinations
5056 * basic: base_output + input + pc_beep + capture
5057 * HP: base_output + input + capture_alt
5058 * HP_3013: hp_3013 + input + capture
5059 * fujitsu: fujitsu + capture
5060 * acer: acer + capture
5063 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5064 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5065 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5066 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5067 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5068 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5069 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5073 static struct snd_kcontrol_new alc260_input_mixer[] = {
5074 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5075 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5076 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5077 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5079 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5080 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5081 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5085 /* update HP, line and mono out pins according to the master switch */
5086 static void alc260_hp_master_update(struct hda_codec *codec,
5087 hda_nid_t hp, hda_nid_t line,
5090 struct alc_spec *spec = codec->spec;
5091 unsigned int val = spec->master_sw ? PIN_HP : 0;
5092 /* change HP and line-out pins */
5093 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5095 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5097 /* mono (speaker) depending on the HP jack sense */
5098 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5099 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5103 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5104 struct snd_ctl_elem_value *ucontrol)
5106 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5107 struct alc_spec *spec = codec->spec;
5108 *ucontrol->value.integer.value = spec->master_sw;
5112 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5113 struct snd_ctl_elem_value *ucontrol)
5115 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5116 struct alc_spec *spec = codec->spec;
5117 int val = !!*ucontrol->value.integer.value;
5118 hda_nid_t hp, line, mono;
5120 if (val == spec->master_sw)
5122 spec->master_sw = val;
5123 hp = (kcontrol->private_value >> 16) & 0xff;
5124 line = (kcontrol->private_value >> 8) & 0xff;
5125 mono = kcontrol->private_value & 0xff;
5126 alc260_hp_master_update(codec, hp, line, mono);
5130 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5133 .name = "Master Playback Switch",
5134 .info = snd_ctl_boolean_mono_info,
5135 .get = alc260_hp_master_sw_get,
5136 .put = alc260_hp_master_sw_put,
5137 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5139 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5140 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5141 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5142 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5143 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5145 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5149 static struct hda_verb alc260_hp_unsol_verbs[] = {
5150 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5154 static void alc260_hp_automute(struct hda_codec *codec)
5156 struct alc_spec *spec = codec->spec;
5158 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5159 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5162 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5164 if ((res >> 26) == ALC880_HP_EVENT)
5165 alc260_hp_automute(codec);
5168 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5170 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5171 .name = "Master Playback Switch",
5172 .info = snd_ctl_boolean_mono_info,
5173 .get = alc260_hp_master_sw_get,
5174 .put = alc260_hp_master_sw_put,
5175 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5177 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5178 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5179 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5180 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5181 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5183 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5184 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5188 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5189 .ops = &snd_hda_bind_vol,
5191 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5192 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5193 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5198 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5199 .ops = &snd_hda_bind_sw,
5201 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5202 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5207 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5208 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5209 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5210 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5211 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5215 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5216 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5220 static void alc260_hp_3013_automute(struct hda_codec *codec)
5222 struct alc_spec *spec = codec->spec;
5224 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5225 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5228 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5231 if ((res >> 26) == ALC880_HP_EVENT)
5232 alc260_hp_3013_automute(codec);
5235 static void alc260_hp_3012_automute(struct hda_codec *codec)
5237 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5239 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5241 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5243 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5247 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5250 if ((res >> 26) == ALC880_HP_EVENT)
5251 alc260_hp_3012_automute(codec);
5254 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5255 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5257 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5259 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5260 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5261 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5262 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5263 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5264 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5265 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5266 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5267 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5271 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5272 * versions of the ALC260 don't act on requests to enable mic bias from NID
5273 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5274 * datasheet doesn't mention this restriction. At this stage it's not clear
5275 * whether this behaviour is intentional or is a hardware bug in chip
5276 * revisions available in early 2006. Therefore for now allow the
5277 * "Headphone Jack Mode" control to span all choices, but if it turns out
5278 * that the lack of mic bias for this NID is intentional we could change the
5279 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5281 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5282 * don't appear to make the mic bias available from the "line" jack, even
5283 * though the NID used for this jack (0x14) can supply it. The theory is
5284 * that perhaps Acer have included blocking capacitors between the ALC260
5285 * and the output jack. If this turns out to be the case for all such
5286 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5287 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5289 * The C20x Tablet series have a mono internal speaker which is controlled
5290 * via the chip's Mono sum widget and pin complex, so include the necessary
5291 * controls for such models. On models without a "mono speaker" the control
5292 * won't do anything.
5294 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5295 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5296 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5297 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5298 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5300 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5302 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5303 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5305 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5306 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5307 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5308 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5309 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5313 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5315 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5316 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5317 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5318 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5319 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5320 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5321 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5325 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5326 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5328 static struct snd_kcontrol_new alc260_will_mixer[] = {
5329 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5330 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5332 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5333 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5334 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5335 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5336 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5337 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5338 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5342 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5343 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5345 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5346 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5347 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5349 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5350 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5351 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5352 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5353 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5354 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5355 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5360 * initialization verbs
5362 static struct hda_verb alc260_init_verbs[] = {
5363 /* Line In pin widget for input */
5364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5365 /* CD pin widget for input */
5366 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5367 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5368 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5369 /* Mic2 (front panel) pin widget for input and vref at 80% */
5370 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5371 /* LINE-2 is used for line-out in rear */
5372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5373 /* select line-out */
5374 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5376 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5378 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5380 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5381 /* mute capture amp left and right */
5382 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5383 /* set connection select to line in (default select for this ADC) */
5384 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5385 /* mute capture amp left and right */
5386 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5387 /* set connection select to line in (default select for this ADC) */
5388 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5389 /* set vol=0 Line-Out mixer amp left and right */
5390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5391 /* unmute pin widget amp left and right (no gain on this amp) */
5392 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5393 /* set vol=0 HP mixer amp left and right */
5394 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5395 /* unmute pin widget amp left and right (no gain on this amp) */
5396 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5397 /* set vol=0 Mono mixer amp left and right */
5398 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5399 /* unmute pin widget amp left and right (no gain on this amp) */
5400 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5401 /* unmute LINE-2 out pin */
5402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5403 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5406 /* mute analog inputs */
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5412 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5413 /* mute Front out path */
5414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5415 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5416 /* mute Headphone out path */
5417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5419 /* mute Mono out path */
5420 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5421 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5425 #if 0 /* should be identical with alc260_init_verbs? */
5426 static struct hda_verb alc260_hp_init_verbs[] = {
5427 /* Headphone and output */
5428 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5430 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5431 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5433 /* Mic2 (front panel) pin widget for input and vref at 80% */
5434 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5435 /* Line In pin widget for input */
5436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5437 /* Line-2 pin widget for output */
5438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5439 /* CD pin widget for input */
5440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5441 /* unmute amp left and right */
5442 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5443 /* set connection select to line in (default select for this ADC) */
5444 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5445 /* unmute Line-Out mixer amp left and right (volume = 0) */
5446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5447 /* mute pin widget amp left and right (no gain on this amp) */
5448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5449 /* unmute HP mixer amp left and right (volume = 0) */
5450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5451 /* mute pin widget amp left and right (no gain on this amp) */
5452 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5453 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5456 /* mute analog inputs */
5457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5462 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5463 /* Unmute Front out path */
5464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5466 /* Unmute Headphone out path */
5467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5469 /* Unmute Mono out path */
5470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5471 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5476 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5477 /* Line out and output */
5478 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5480 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5481 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5482 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5483 /* Mic2 (front panel) pin widget for input and vref at 80% */
5484 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5485 /* Line In pin widget for input */
5486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5487 /* Headphone pin widget for output */
5488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5489 /* CD pin widget for input */
5490 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5491 /* unmute amp left and right */
5492 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5493 /* set connection select to line in (default select for this ADC) */
5494 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5495 /* unmute Line-Out mixer amp left and right (volume = 0) */
5496 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5497 /* mute pin widget amp left and right (no gain on this amp) */
5498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5499 /* unmute HP mixer amp left and right (volume = 0) */
5500 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5501 /* mute pin widget amp left and right (no gain on this amp) */
5502 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5503 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5506 /* mute analog inputs */
5507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5512 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5513 /* Unmute Front out path */
5514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5515 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5516 /* Unmute Headphone out path */
5517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5518 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5519 /* Unmute Mono out path */
5520 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5521 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5525 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5526 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5527 * audio = 0x16, internal speaker = 0x10.
5529 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5530 /* Disable all GPIOs */
5531 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5532 /* Internal speaker is connected to headphone pin */
5533 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5534 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5536 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5537 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5538 /* Ensure all other unused pins are disabled and muted. */
5539 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5541 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5542 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5543 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5544 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5548 /* Disable digital (SPDIF) pins */
5549 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5550 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5552 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5553 * when acting as an output.
5555 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5557 /* Start with output sum widgets muted and their output gains at min */
5558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5560 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5562 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5564 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5565 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5566 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5568 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5569 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5570 /* Unmute Line1 pin widget output buffer since it starts as an output.
5571 * If the pin mode is changed by the user the pin mode control will
5572 * take care of enabling the pin's input/output buffers as needed.
5573 * Therefore there's no need to enable the input buffer at this
5576 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5577 /* Unmute input buffer of pin widget used for Line-in (no equiv
5580 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5582 /* Mute capture amp left and right */
5583 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5584 /* Set ADC connection select to match default mixer setting - line
5587 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5589 /* Do the same for the second ADC: mute capture input amp and
5590 * set ADC connection to line in (on mic1 pin)
5592 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5593 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5595 /* Mute all inputs to mixer widget (even unconnected ones) */
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5603 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5608 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5609 * similar laptops (adapted from Fujitsu init verbs).
5611 static struct hda_verb alc260_acer_init_verbs[] = {
5612 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5613 * the headphone jack. Turn this on and rely on the standard mute
5614 * methods whenever the user wants to turn these outputs off.
5616 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5617 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5618 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5619 /* Internal speaker/Headphone jack is connected to Line-out pin */
5620 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5621 /* Internal microphone/Mic jack is connected to Mic1 pin */
5622 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5623 /* Line In jack is connected to Line1 pin */
5624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5625 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5626 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5627 /* Ensure all other unused pins are disabled and muted. */
5628 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5629 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5630 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5631 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5632 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 /* Disable digital (SPDIF) pins */
5635 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5636 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5638 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5639 * bus when acting as outputs.
5641 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5642 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5644 /* Start with output sum widgets muted and their output gains at min */
5645 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5646 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5647 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5648 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5650 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5651 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5652 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5653 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5655 /* Unmute Line-out pin widget amp left and right
5656 * (no equiv mixer ctrl)
5658 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5659 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5660 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5661 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5662 * inputs. If the pin mode is changed by the user the pin mode control
5663 * will take care of enabling the pin's input/output buffers as needed.
5664 * Therefore there's no need to enable the input buffer at this
5667 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5668 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5670 /* Mute capture amp left and right */
5671 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5672 /* Set ADC connection select to match default mixer setting - mic
5675 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5677 /* Do similar with the second ADC: mute capture input amp and
5678 * set ADC connection to mic to match ALSA's default state.
5680 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5683 /* Mute all inputs to mixer widget (even unconnected ones) */
5684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5696 /* Initialisation sequence for Maxdata Favorit 100XS
5697 * (adapted from Acer init verbs).
5699 static struct hda_verb alc260_favorit100_init_verbs[] = {
5700 /* GPIO 0 enables the output jack.
5701 * Turn this on and rely on the standard mute
5702 * methods whenever the user wants to turn these outputs off.
5704 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5705 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5706 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5707 /* Line/Mic input jack is connected to Mic1 pin */
5708 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5709 /* Ensure all other unused pins are disabled and muted. */
5710 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5711 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5712 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5713 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5714 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5715 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5718 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5720 /* Disable digital (SPDIF) pins */
5721 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5722 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5724 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5725 * bus when acting as outputs.
5727 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5728 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5730 /* Start with output sum widgets muted and their output gains at min */
5731 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5735 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5736 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5737 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5738 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5739 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5741 /* Unmute Line-out pin widget amp left and right
5742 * (no equiv mixer ctrl)
5744 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5745 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5746 * inputs. If the pin mode is changed by the user the pin mode control
5747 * will take care of enabling the pin's input/output buffers as needed.
5748 * Therefore there's no need to enable the input buffer at this
5751 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5753 /* Mute capture amp left and right */
5754 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5755 /* Set ADC connection select to match default mixer setting - mic
5758 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5760 /* Do similar with the second ADC: mute capture input amp and
5761 * set ADC connection to mic to match ALSA's default state.
5763 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5764 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5766 /* Mute all inputs to mixer widget (even unconnected ones) */
5767 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5768 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5769 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5770 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5771 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5774 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5779 static struct hda_verb alc260_will_verbs[] = {
5780 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5781 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5782 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5783 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5784 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5785 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5789 static struct hda_verb alc260_replacer_672v_verbs[] = {
5790 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5791 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5792 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5794 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5795 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5796 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5798 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5802 /* toggle speaker-output according to the hp-jack state */
5803 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5805 unsigned int present;
5807 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5808 present = snd_hda_jack_detect(codec, 0x0f);
5810 snd_hda_codec_write_cache(codec, 0x01, 0,
5811 AC_VERB_SET_GPIO_DATA, 1);
5812 snd_hda_codec_write_cache(codec, 0x0f, 0,
5813 AC_VERB_SET_PIN_WIDGET_CONTROL,
5816 snd_hda_codec_write_cache(codec, 0x01, 0,
5817 AC_VERB_SET_GPIO_DATA, 0);
5818 snd_hda_codec_write_cache(codec, 0x0f, 0,
5819 AC_VERB_SET_PIN_WIDGET_CONTROL,
5824 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5827 if ((res >> 26) == ALC880_HP_EVENT)
5828 alc260_replacer_672v_automute(codec);
5831 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5832 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5833 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5834 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5835 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5836 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5838 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5839 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5840 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5841 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5845 /* Test configuration for debugging, modelled after the ALC880 test
5848 #ifdef CONFIG_SND_DEBUG
5849 static hda_nid_t alc260_test_dac_nids[1] = {
5852 static hda_nid_t alc260_test_adc_nids[2] = {
5855 /* For testing the ALC260, each input MUX needs its own definition since
5856 * the signal assignments are different. This assumes that the first ADC
5859 static struct hda_input_mux alc260_test_capture_sources[2] = {
5863 { "MIC1 pin", 0x0 },
5864 { "MIC2 pin", 0x1 },
5865 { "LINE1 pin", 0x2 },
5866 { "LINE2 pin", 0x3 },
5868 { "LINE-OUT pin", 0x5 },
5869 { "HP-OUT pin", 0x6 },
5875 { "MIC1 pin", 0x0 },
5876 { "MIC2 pin", 0x1 },
5877 { "LINE1 pin", 0x2 },
5878 { "LINE2 pin", 0x3 },
5881 { "LINE-OUT pin", 0x6 },
5882 { "HP-OUT pin", 0x7 },
5886 static struct snd_kcontrol_new alc260_test_mixer[] = {
5887 /* Output driver widgets */
5888 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5889 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5890 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5891 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5892 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5893 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5895 /* Modes for retasking pin widgets
5896 * Note: the ALC260 doesn't seem to act on requests to enable mic
5897 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5898 * mention this restriction. At this stage it's not clear whether
5899 * this behaviour is intentional or is a hardware bug in chip
5900 * revisions available at least up until early 2006. Therefore for
5901 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5902 * choices, but if it turns out that the lack of mic bias for these
5903 * NIDs is intentional we could change their modes from
5904 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5906 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5907 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5908 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5909 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5910 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5911 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5913 /* Loopback mixer controls */
5914 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5915 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5916 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5917 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5918 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5919 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5920 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5921 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5922 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5923 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5924 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5925 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5926 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5927 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5929 /* Controls for GPIO pins, assuming they are configured as outputs */
5930 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5931 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5932 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5933 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5935 /* Switches to allow the digital IO pins to be enabled. The datasheet
5936 * is ambigious as to which NID is which; testing on laptops which
5937 * make this output available should provide clarification.
5939 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5940 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5942 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5943 * this output to turn on an external amplifier.
5945 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5946 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5950 static struct hda_verb alc260_test_init_verbs[] = {
5951 /* Enable all GPIOs as outputs with an initial value of 0 */
5952 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5953 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5954 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5956 /* Enable retasking pins as output, initially without power amp */
5957 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5958 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5960 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5961 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5962 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5964 /* Disable digital (SPDIF) pins initially, but users can enable
5965 * them via a mixer switch. In the case of SPDIF-out, this initverb
5966 * payload also sets the generation to 0, output to be in "consumer"
5967 * PCM format, copyright asserted, no pre-emphasis and no validity
5970 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5971 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5973 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5974 * OUT1 sum bus when acting as an output.
5976 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5977 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5978 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5979 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5981 /* Start with output sum widgets muted and their output gains at min */
5982 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5985 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5988 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5989 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5992 /* Unmute retasking pin widget output buffers since the default
5993 * state appears to be output. As the pin mode is changed by the
5994 * user the pin mode control will take care of enabling the pin's
5995 * input/output buffers as needed.
5997 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5998 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6001 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6002 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6003 /* Also unmute the mono-out pin widget */
6004 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6006 /* Mute capture amp left and right */
6007 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6008 /* Set ADC connection select to match default mixer setting (mic1
6011 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6013 /* Do the same for the second ADC: mute capture input amp and
6014 * set ADC connection to mic1 pin
6016 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6017 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6019 /* Mute all inputs to mixer widget (even unconnected ones) */
6020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6021 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6033 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6034 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6036 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6037 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6040 * for BIOS auto-configuration
6043 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6044 const char *pfx, int *vol_bits)
6047 unsigned long vol_val, sw_val;
6050 if (nid >= 0x0f && nid < 0x11) {
6051 nid_vol = nid - 0x7;
6052 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6053 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6054 } else if (nid == 0x11) {
6055 nid_vol = nid - 0x7;
6056 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6057 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6058 } else if (nid >= 0x12 && nid <= 0x15) {
6060 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6061 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6065 if (!(*vol_bits & (1 << nid_vol))) {
6066 /* first control for the volume widget */
6067 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6070 *vol_bits |= (1 << nid_vol);
6072 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6078 /* add playback controls from the parsed DAC table */
6079 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6080 const struct auto_pin_cfg *cfg)
6086 spec->multiout.num_dacs = 1;
6087 spec->multiout.dac_nids = spec->private_dac_nids;
6088 spec->multiout.dac_nids[0] = 0x02;
6090 nid = cfg->line_out_pins[0];
6093 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6095 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6099 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6104 nid = cfg->speaker_pins[0];
6106 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6111 nid = cfg->hp_pins[0];
6113 err = alc260_add_playback_controls(spec, nid, "Headphone",
6121 /* create playback/capture controls for input pins */
6122 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6123 const struct auto_pin_cfg *cfg)
6125 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6128 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6129 hda_nid_t nid, int pin_type,
6132 alc_set_pin_output(codec, nid, pin_type);
6133 /* need the manual connection? */
6135 int idx = nid - 0x12;
6136 snd_hda_codec_write(codec, idx + 0x0b, 0,
6137 AC_VERB_SET_CONNECT_SEL, sel_idx);
6141 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6143 struct alc_spec *spec = codec->spec;
6146 nid = spec->autocfg.line_out_pins[0];
6148 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6149 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6152 nid = spec->autocfg.speaker_pins[0];
6154 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6156 nid = spec->autocfg.hp_pins[0];
6158 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6161 #define ALC260_PIN_CD_NID 0x16
6162 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6164 struct alc_spec *spec = codec->spec;
6167 for (i = 0; i < AUTO_PIN_LAST; i++) {
6168 hda_nid_t nid = spec->autocfg.input_pins[i];
6170 alc_set_input_pin(codec, nid, i);
6171 if (nid != ALC260_PIN_CD_NID &&
6172 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6173 snd_hda_codec_write(codec, nid, 0,
6174 AC_VERB_SET_AMP_GAIN_MUTE,
6181 * generic initialization of ADC, input mixers and output mixers
6183 static struct hda_verb alc260_volume_init_verbs[] = {
6185 * Unmute ADC0-1 and set the default input to mic-in
6187 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6188 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6189 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6190 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6192 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6194 * Note: PASD motherboards uses the Line In 2 as the input for
6195 * front panel mic (mic 2)
6197 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6198 /* mute analog inputs */
6199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6201 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6202 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6203 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6206 * Set up output mixers (0x08 - 0x0a)
6208 /* set vol=0 to output mixers */
6209 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6210 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6211 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6212 /* set up input amps for analog loopback */
6213 /* Amp Indices: DAC = 0, mixer = 1 */
6214 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6217 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6218 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6219 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6224 static int alc260_parse_auto_config(struct hda_codec *codec)
6226 struct alc_spec *spec = codec->spec;
6228 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6230 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6234 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6237 if (!spec->kctls.list)
6238 return 0; /* can't find valid BIOS pin config */
6239 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6243 spec->multiout.max_channels = 2;
6245 if (spec->autocfg.dig_outs)
6246 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6247 if (spec->kctls.list)
6248 add_mixer(spec, spec->kctls.list);
6250 add_verb(spec, alc260_volume_init_verbs);
6252 spec->num_mux_defs = 1;
6253 spec->input_mux = &spec->private_imux[0];
6255 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6260 /* additional initialization for auto-configuration model */
6261 static void alc260_auto_init(struct hda_codec *codec)
6263 struct alc_spec *spec = codec->spec;
6264 alc260_auto_init_multi_out(codec);
6265 alc260_auto_init_analog_input(codec);
6266 if (spec->unsol_event)
6267 alc_inithook(codec);
6270 #ifdef CONFIG_SND_HDA_POWER_SAVE
6271 static struct hda_amp_list alc260_loopbacks[] = {
6272 { 0x07, HDA_INPUT, 0 },
6273 { 0x07, HDA_INPUT, 1 },
6274 { 0x07, HDA_INPUT, 2 },
6275 { 0x07, HDA_INPUT, 3 },
6276 { 0x07, HDA_INPUT, 4 },
6282 * ALC260 configurations
6284 static const char *alc260_models[ALC260_MODEL_LAST] = {
6285 [ALC260_BASIC] = "basic",
6287 [ALC260_HP_3013] = "hp-3013",
6288 [ALC260_HP_DC7600] = "hp-dc7600",
6289 [ALC260_FUJITSU_S702X] = "fujitsu",
6290 [ALC260_ACER] = "acer",
6291 [ALC260_WILL] = "will",
6292 [ALC260_REPLACER_672V] = "replacer",
6293 [ALC260_FAVORIT100] = "favorit100",
6294 #ifdef CONFIG_SND_DEBUG
6295 [ALC260_TEST] = "test",
6297 [ALC260_AUTO] = "auto",
6300 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6301 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6302 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6303 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6304 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6305 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6306 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6307 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6308 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6309 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6310 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6311 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6312 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6313 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6314 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6315 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6316 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6317 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6318 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6319 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6320 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6324 static struct alc_config_preset alc260_presets[] = {
6326 .mixers = { alc260_base_output_mixer,
6327 alc260_input_mixer },
6328 .init_verbs = { alc260_init_verbs },
6329 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6330 .dac_nids = alc260_dac_nids,
6331 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6332 .adc_nids = alc260_adc_nids,
6333 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6334 .channel_mode = alc260_modes,
6335 .input_mux = &alc260_capture_source,
6338 .mixers = { alc260_hp_output_mixer,
6339 alc260_input_mixer },
6340 .init_verbs = { alc260_init_verbs,
6341 alc260_hp_unsol_verbs },
6342 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6343 .dac_nids = alc260_dac_nids,
6344 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6345 .adc_nids = alc260_adc_nids_alt,
6346 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6347 .channel_mode = alc260_modes,
6348 .input_mux = &alc260_capture_source,
6349 .unsol_event = alc260_hp_unsol_event,
6350 .init_hook = alc260_hp_automute,
6352 [ALC260_HP_DC7600] = {
6353 .mixers = { alc260_hp_dc7600_mixer,
6354 alc260_input_mixer },
6355 .init_verbs = { alc260_init_verbs,
6356 alc260_hp_dc7600_verbs },
6357 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6358 .dac_nids = alc260_dac_nids,
6359 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6360 .adc_nids = alc260_adc_nids_alt,
6361 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6362 .channel_mode = alc260_modes,
6363 .input_mux = &alc260_capture_source,
6364 .unsol_event = alc260_hp_3012_unsol_event,
6365 .init_hook = alc260_hp_3012_automute,
6367 [ALC260_HP_3013] = {
6368 .mixers = { alc260_hp_3013_mixer,
6369 alc260_input_mixer },
6370 .init_verbs = { alc260_hp_3013_init_verbs,
6371 alc260_hp_3013_unsol_verbs },
6372 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6373 .dac_nids = alc260_dac_nids,
6374 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6375 .adc_nids = alc260_adc_nids_alt,
6376 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6377 .channel_mode = alc260_modes,
6378 .input_mux = &alc260_capture_source,
6379 .unsol_event = alc260_hp_3013_unsol_event,
6380 .init_hook = alc260_hp_3013_automute,
6382 [ALC260_FUJITSU_S702X] = {
6383 .mixers = { alc260_fujitsu_mixer },
6384 .init_verbs = { alc260_fujitsu_init_verbs },
6385 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6386 .dac_nids = alc260_dac_nids,
6387 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6388 .adc_nids = alc260_dual_adc_nids,
6389 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6390 .channel_mode = alc260_modes,
6391 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6392 .input_mux = alc260_fujitsu_capture_sources,
6395 .mixers = { alc260_acer_mixer },
6396 .init_verbs = { alc260_acer_init_verbs },
6397 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6398 .dac_nids = alc260_dac_nids,
6399 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6400 .adc_nids = alc260_dual_adc_nids,
6401 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6402 .channel_mode = alc260_modes,
6403 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6404 .input_mux = alc260_acer_capture_sources,
6406 [ALC260_FAVORIT100] = {
6407 .mixers = { alc260_favorit100_mixer },
6408 .init_verbs = { alc260_favorit100_init_verbs },
6409 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6410 .dac_nids = alc260_dac_nids,
6411 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6412 .adc_nids = alc260_dual_adc_nids,
6413 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6414 .channel_mode = alc260_modes,
6415 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6416 .input_mux = alc260_favorit100_capture_sources,
6419 .mixers = { alc260_will_mixer },
6420 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6421 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6422 .dac_nids = alc260_dac_nids,
6423 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6424 .adc_nids = alc260_adc_nids,
6425 .dig_out_nid = ALC260_DIGOUT_NID,
6426 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6427 .channel_mode = alc260_modes,
6428 .input_mux = &alc260_capture_source,
6430 [ALC260_REPLACER_672V] = {
6431 .mixers = { alc260_replacer_672v_mixer },
6432 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6433 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6434 .dac_nids = alc260_dac_nids,
6435 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6436 .adc_nids = alc260_adc_nids,
6437 .dig_out_nid = ALC260_DIGOUT_NID,
6438 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6439 .channel_mode = alc260_modes,
6440 .input_mux = &alc260_capture_source,
6441 .unsol_event = alc260_replacer_672v_unsol_event,
6442 .init_hook = alc260_replacer_672v_automute,
6444 #ifdef CONFIG_SND_DEBUG
6446 .mixers = { alc260_test_mixer },
6447 .init_verbs = { alc260_test_init_verbs },
6448 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6449 .dac_nids = alc260_test_dac_nids,
6450 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6451 .adc_nids = alc260_test_adc_nids,
6452 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6453 .channel_mode = alc260_modes,
6454 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6455 .input_mux = alc260_test_capture_sources,
6460 static int patch_alc260(struct hda_codec *codec)
6462 struct alc_spec *spec;
6463 int err, board_config;
6465 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6471 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6474 if (board_config < 0) {
6475 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6477 board_config = ALC260_AUTO;
6480 if (board_config == ALC260_AUTO) {
6481 /* automatic parse from the BIOS config */
6482 err = alc260_parse_auto_config(codec);
6488 "hda_codec: Cannot set up configuration "
6489 "from BIOS. Using base mode...\n");
6490 board_config = ALC260_BASIC;
6494 err = snd_hda_attach_beep_device(codec, 0x1);
6500 if (board_config != ALC260_AUTO)
6501 setup_preset(codec, &alc260_presets[board_config]);
6503 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6504 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6506 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6507 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6509 if (!spec->adc_nids && spec->input_mux) {
6510 /* check whether NID 0x04 is valid */
6511 unsigned int wcap = get_wcaps(codec, 0x04);
6512 wcap = get_wcaps_type(wcap);
6514 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6515 spec->adc_nids = alc260_adc_nids_alt;
6516 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6518 spec->adc_nids = alc260_adc_nids;
6519 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6522 set_capture_mixer(codec);
6523 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6525 spec->vmaster_nid = 0x08;
6527 codec->patch_ops = alc_patch_ops;
6528 if (board_config == ALC260_AUTO)
6529 spec->init_hook = alc260_auto_init;
6530 #ifdef CONFIG_SND_HDA_POWER_SAVE
6531 if (!spec->loopback.amplist)
6532 spec->loopback.amplist = alc260_loopbacks;
6534 codec->proc_widget_hook = print_realtek_coef;
6541 * ALC882/883/885/888/889 support
6543 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6544 * configuration. Each pin widget can choose any input DACs and a mixer.
6545 * Each ADC is connected from a mixer of all inputs. This makes possible
6546 * 6-channel independent captures.
6548 * In addition, an independent DAC for the multi-playback (not used in this
6551 #define ALC882_DIGOUT_NID 0x06
6552 #define ALC882_DIGIN_NID 0x0a
6553 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6554 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6555 #define ALC1200_DIGOUT_NID 0x10
6558 static struct hda_channel_mode alc882_ch_modes[1] = {
6563 static hda_nid_t alc882_dac_nids[4] = {
6564 /* front, rear, clfe, rear_surr */
6565 0x02, 0x03, 0x04, 0x05
6567 #define alc883_dac_nids alc882_dac_nids
6570 #define alc882_adc_nids alc880_adc_nids
6571 #define alc882_adc_nids_alt alc880_adc_nids_alt
6572 #define alc883_adc_nids alc882_adc_nids_alt
6573 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6574 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6575 #define alc889_adc_nids alc880_adc_nids
6577 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6578 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6579 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6580 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6581 #define alc889_capsrc_nids alc882_capsrc_nids
6584 /* FIXME: should be a matrix-type input source selection */
6586 static struct hda_input_mux alc882_capture_source = {
6590 { "Front Mic", 0x1 },
6596 #define alc883_capture_source alc882_capture_source
6598 static struct hda_input_mux alc889_capture_source = {
6601 { "Front Mic", 0x0 },
6607 static struct hda_input_mux mb5_capture_source = {
6616 static struct hda_input_mux alc883_3stack_6ch_intel = {
6620 { "Front Mic", 0x0 },
6626 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6634 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6644 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6652 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6656 { "Front Mic", 0x1 },
6661 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6669 static struct hda_input_mux alc889A_mb31_capture_source = {
6673 /* Front Mic (0x01) unused */
6675 /* Line 2 (0x03) unused */
6676 /* CD (0x04) unsused? */
6683 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6690 static struct hda_verb alc882_3ST_ch2_init[] = {
6691 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6692 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6693 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6694 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6701 static struct hda_verb alc882_3ST_ch4_init[] = {
6702 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6703 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6704 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6705 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6706 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6713 static struct hda_verb alc882_3ST_ch6_init[] = {
6714 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6715 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6716 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6717 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6718 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6719 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6723 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6724 { 2, alc882_3ST_ch2_init },
6725 { 4, alc882_3ST_ch4_init },
6726 { 6, alc882_3ST_ch6_init },
6729 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6734 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6735 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6736 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6737 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6738 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6739 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6746 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6747 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6748 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6749 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6750 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6751 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6752 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6759 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6760 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6761 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6762 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6763 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6764 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6765 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6766 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6770 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6771 { 2, alc883_3ST_ch2_clevo_init },
6772 { 4, alc883_3ST_ch4_clevo_init },
6773 { 6, alc883_3ST_ch6_clevo_init },
6780 static struct hda_verb alc882_sixstack_ch6_init[] = {
6781 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6782 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6783 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6784 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6791 static struct hda_verb alc882_sixstack_ch8_init[] = {
6792 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6793 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6794 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6795 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6800 { 6, alc882_sixstack_ch6_init },
6801 { 8, alc882_sixstack_ch8_init },
6805 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6811 static struct hda_verb alc885_mbp_ch2_init[] = {
6812 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6813 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6814 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6821 static struct hda_verb alc885_mbp_ch4_init[] = {
6822 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6823 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6824 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6825 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6826 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6830 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6831 { 2, alc885_mbp_ch2_init },
6832 { 4, alc885_mbp_ch4_init },
6837 * Speakers/Woofer/HP = Front
6840 static struct hda_verb alc885_mb5_ch2_init[] = {
6841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6842 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6848 * Speakers/HP = Front
6852 static struct hda_verb alc885_mb5_ch6_init[] = {
6853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6859 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6860 { 2, alc885_mb5_ch2_init },
6861 { 6, alc885_mb5_ch6_init },
6868 static struct hda_verb alc883_4ST_ch2_init[] = {
6869 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6870 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6871 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6872 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6873 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6874 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6881 static struct hda_verb alc883_4ST_ch4_init[] = {
6882 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6883 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6884 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6885 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6886 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6887 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6888 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6895 static struct hda_verb alc883_4ST_ch6_init[] = {
6896 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6897 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6898 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6899 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6900 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6901 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6902 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6903 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6910 static struct hda_verb alc883_4ST_ch8_init[] = {
6911 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6912 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6913 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6914 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6915 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6916 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6917 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6918 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6919 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6923 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6924 { 2, alc883_4ST_ch2_init },
6925 { 4, alc883_4ST_ch4_init },
6926 { 6, alc883_4ST_ch6_init },
6927 { 8, alc883_4ST_ch8_init },
6934 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6935 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6936 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6937 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6938 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6945 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6946 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6947 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6948 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6949 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6950 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6957 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6958 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6959 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6960 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6961 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6962 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6963 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6967 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6968 { 2, alc883_3ST_ch2_intel_init },
6969 { 4, alc883_3ST_ch4_intel_init },
6970 { 6, alc883_3ST_ch6_intel_init },
6976 static struct hda_verb alc889_ch2_intel_init[] = {
6977 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6978 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6979 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6980 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6981 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6982 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6989 static struct hda_verb alc889_ch6_intel_init[] = {
6990 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6991 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6992 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6993 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6994 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6995 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7002 static struct hda_verb alc889_ch8_intel_init[] = {
7003 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7004 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7005 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7006 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7007 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7008 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7009 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7013 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7014 { 2, alc889_ch2_intel_init },
7015 { 6, alc889_ch6_intel_init },
7016 { 8, alc889_ch8_intel_init },
7022 static struct hda_verb alc883_sixstack_ch6_init[] = {
7023 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7024 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7025 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7026 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7033 static struct hda_verb alc883_sixstack_ch8_init[] = {
7034 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7036 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7037 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7041 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7042 { 6, alc883_sixstack_ch6_init },
7043 { 8, alc883_sixstack_ch8_init },
7047 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7048 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7050 static struct snd_kcontrol_new alc882_base_mixer[] = {
7051 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7052 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7053 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7054 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7055 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7056 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7057 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7058 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7059 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7060 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7062 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7063 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7064 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7065 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7069 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7071 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7075 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7076 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7077 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7078 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7079 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7080 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7081 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7082 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7084 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7085 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7090 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7092 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7093 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7094 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7095 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7096 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7097 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7098 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7100 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7102 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7104 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7108 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7109 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7110 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7111 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7112 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7114 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7116 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7122 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7124 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7130 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7135 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7136 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7137 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7139 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7140 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7141 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7142 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7152 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7153 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7155 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7156 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7157 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7159 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7160 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7161 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7165 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7172 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7173 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7174 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7186 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7188 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7189 .name = "Channel Mode",
7190 .info = alc_ch_mode_info,
7191 .get = alc_ch_mode_get,
7192 .put = alc_ch_mode_put,
7197 static struct hda_verb alc882_base_init_verbs[] = {
7198 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7203 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7205 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7208 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7209 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7211 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7212 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7213 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7215 /* mute analog input loopbacks */
7216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7218 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7219 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7220 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7222 /* Front Pin: output 0 (0x0c) */
7223 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7224 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7225 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7226 /* Rear Pin: output 1 (0x0d) */
7227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7229 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7230 /* CLFE Pin: output 2 (0x0e) */
7231 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7232 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7233 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7234 /* Side Pin: output 3 (0x0f) */
7235 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7236 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7237 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7238 /* Mic (rear) pin: input vref at 80% */
7239 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7240 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7241 /* Front Mic pin: input vref at 80% */
7242 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7243 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7244 /* Line In pin: input */
7245 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7246 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7247 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7248 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7249 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7250 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7251 /* CD pin widget for input */
7252 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7254 /* FIXME: use matrix-type input source selection */
7255 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7257 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7266 /* ADC2: mute amp left and right */
7267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7268 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7269 /* ADC3: mute amp left and right */
7270 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7271 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7276 static struct hda_verb alc882_adc1_init_verbs[] = {
7277 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7282 /* ADC1: mute amp left and right */
7283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7284 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7288 static struct hda_verb alc882_eapd_verbs[] = {
7289 /* change to EAPD mode */
7290 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7291 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7295 static struct hda_verb alc889_eapd_verbs[] = {
7296 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7297 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7301 static struct hda_verb alc_hp15_unsol_verbs[] = {
7302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7303 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7307 static struct hda_verb alc885_init_verbs[] = {
7308 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7313 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7314 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7317 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7321 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7325 /* mute analog input loopbacks */
7326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7330 /* Front HP Pin: output 0 (0x0c) */
7331 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7333 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7334 /* Front Pin: output 0 (0x0c) */
7335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7336 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7337 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7338 /* Rear Pin: output 1 (0x0d) */
7339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7341 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7342 /* CLFE Pin: output 2 (0x0e) */
7343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7344 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7345 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7346 /* Side Pin: output 3 (0x0f) */
7347 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7348 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7349 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7350 /* Mic (rear) pin: input vref at 80% */
7351 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7352 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7353 /* Front Mic pin: input vref at 80% */
7354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7356 /* Line In pin: input */
7357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7360 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7373 /* ADC2: mute amp left and right */
7374 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7375 /* ADC3: mute amp left and right */
7376 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7381 static struct hda_verb alc885_init_input_verbs[] = {
7382 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7389 /* Unmute Selector 24h and set the default input to front mic */
7390 static struct hda_verb alc889_init_input_verbs[] = {
7391 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7397 #define alc883_init_verbs alc882_base_init_verbs
7400 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7401 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7402 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7406 /* FIXME: this looks suspicious...
7407 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7408 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7413 static struct hda_verb alc882_macpro_init_verbs[] = {
7414 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7418 /* Front Pin: output 0 (0x0c) */
7419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7421 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7422 /* Front Mic pin: input vref at 80% */
7423 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7424 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7425 /* Speaker: output */
7426 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7427 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7428 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7429 /* Headphone output (output 0 - 0x0c) */
7430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7432 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7434 /* FIXME: use matrix-type input source selection */
7435 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7436 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7444 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7445 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7448 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7449 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7451 /* ADC1: mute amp left and right */
7452 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7453 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7454 /* ADC2: mute amp left and right */
7455 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7456 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7457 /* ADC3: mute amp left and right */
7458 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7459 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7465 static struct hda_verb alc885_mb5_init_verbs[] = {
7467 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7468 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7469 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7470 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7475 /* Surround mixer */
7476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7485 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7486 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7487 /* Front Pin (0x0c) */
7488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7489 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7490 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7491 /* LFE Pin (0x0e) */
7492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7493 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7494 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7499 /* Front Mic pin: input vref at 80% */
7500 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7501 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7508 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7509 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7513 /* Macbook Pro rev3 */
7514 static struct hda_verb alc885_mbp3_init_verbs[] = {
7515 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7516 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7524 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7525 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7526 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7527 /* Front Pin: output 0 (0x0c) */
7528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7529 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7530 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7531 /* HP Pin: output 0 (0x0e) */
7532 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7533 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7534 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7535 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7536 /* Mic (rear) pin: input vref at 80% */
7537 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7538 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7539 /* Front Mic pin: input vref at 80% */
7540 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7541 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7542 /* Line In pin: use output 1 when in LineOut mode */
7543 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7544 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7545 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7547 /* FIXME: use matrix-type input source selection */
7548 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7549 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7555 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7560 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7561 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7562 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7563 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7564 /* ADC1: mute amp left and right */
7565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7566 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7567 /* ADC2: mute amp left and right */
7568 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7569 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7570 /* ADC3: mute amp left and right */
7571 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7572 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7578 static struct hda_verb alc885_imac91_init_verbs[] = {
7579 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7587 /* HP Pin: output 0 (0x0c) */
7588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7589 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7590 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7591 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7592 /* Internal Speakers: output 0 (0x0d) */
7593 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7594 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7596 /* Mic (rear) pin: input vref at 80% */
7597 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7598 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7599 /* Front Mic pin: input vref at 80% */
7600 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7601 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7602 /* Line In pin: use output 1 when in LineOut mode */
7603 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7604 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7605 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7607 /* FIXME: use matrix-type input source selection */
7608 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7609 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7624 /* ADC1: mute amp left and right */
7625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7626 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7627 /* ADC2: mute amp left and right */
7628 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7629 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7630 /* ADC3: mute amp left and right */
7631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7632 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7637 /* iMac 24 mixer. */
7638 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7639 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7640 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7644 /* iMac 24 init verbs. */
7645 static struct hda_verb alc885_imac24_init_verbs[] = {
7646 /* Internal speakers: output 0 (0x0c) */
7647 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7648 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7649 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7650 /* Internal speakers: output 0 (0x0c) */
7651 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7652 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7653 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7654 /* Headphone: output 0 (0x0c) */
7655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7656 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7657 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7658 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7659 /* Front Mic: input vref at 80% */
7660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7661 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7665 /* Toggle speaker-output according to the hp-jack state */
7666 static void alc885_imac24_setup(struct hda_codec *codec)
7668 struct alc_spec *spec = codec->spec;
7670 spec->autocfg.hp_pins[0] = 0x14;
7671 spec->autocfg.speaker_pins[0] = 0x18;
7672 spec->autocfg.speaker_pins[1] = 0x1a;
7675 static void alc885_mbp3_setup(struct hda_codec *codec)
7677 struct alc_spec *spec = codec->spec;
7679 spec->autocfg.hp_pins[0] = 0x15;
7680 spec->autocfg.speaker_pins[0] = 0x14;
7683 static void alc885_imac91_automute(struct hda_codec *codec)
7685 unsigned int present;
7687 present = snd_hda_codec_read(codec, 0x14, 0,
7688 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7689 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7690 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7691 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7692 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7696 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7699 /* Headphone insertion or removal. */
7700 if ((res >> 26) == ALC880_HP_EVENT)
7701 alc885_imac91_automute(codec);
7704 static struct hda_verb alc882_targa_verbs[] = {
7705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7709 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7711 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7712 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7713 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7715 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7719 /* toggle speaker-output according to the hp-jack state */
7720 static void alc882_targa_automute(struct hda_codec *codec)
7722 struct alc_spec *spec = codec->spec;
7723 alc_automute_amp(codec);
7724 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7725 spec->jack_present ? 1 : 3);
7728 static void alc882_targa_setup(struct hda_codec *codec)
7730 struct alc_spec *spec = codec->spec;
7732 spec->autocfg.hp_pins[0] = 0x14;
7733 spec->autocfg.speaker_pins[0] = 0x1b;
7736 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7738 if ((res >> 26) == ALC880_HP_EVENT)
7739 alc882_targa_automute(codec);
7742 static struct hda_verb alc882_asus_a7j_verbs[] = {
7743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7746 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7748 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7750 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7752 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7754 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7755 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7756 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7760 static struct hda_verb alc882_asus_a7m_verbs[] = {
7761 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7766 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7768 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7769 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7770 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7772 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7773 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7774 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7778 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7780 unsigned int gpiostate, gpiomask, gpiodir;
7782 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7783 AC_VERB_GET_GPIO_DATA, 0);
7786 gpiostate |= (1 << pin);
7788 gpiostate &= ~(1 << pin);
7790 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7791 AC_VERB_GET_GPIO_MASK, 0);
7792 gpiomask |= (1 << pin);
7794 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7795 AC_VERB_GET_GPIO_DIRECTION, 0);
7796 gpiodir |= (1 << pin);
7799 snd_hda_codec_write(codec, codec->afg, 0,
7800 AC_VERB_SET_GPIO_MASK, gpiomask);
7801 snd_hda_codec_write(codec, codec->afg, 0,
7802 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7806 snd_hda_codec_write(codec, codec->afg, 0,
7807 AC_VERB_SET_GPIO_DATA, gpiostate);
7810 /* set up GPIO at initialization */
7811 static void alc885_macpro_init_hook(struct hda_codec *codec)
7813 alc882_gpio_mute(codec, 0, 0);
7814 alc882_gpio_mute(codec, 1, 0);
7817 /* set up GPIO and update auto-muting at initialization */
7818 static void alc885_imac24_init_hook(struct hda_codec *codec)
7820 alc885_macpro_init_hook(codec);
7821 alc_automute_amp(codec);
7825 * generic initialization of ADC, input mixers and output mixers
7827 static struct hda_verb alc883_auto_init_verbs[] = {
7829 * Unmute ADC0-2 and set the default input to mic-in
7831 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7832 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7833 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7834 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7836 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7838 * Note: PASD motherboards uses the Line In 2 as the input for
7839 * front panel mic (mic 2)
7841 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7844 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7846 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7849 * Set up output mixers (0x0c - 0x0f)
7851 /* set vol=0 to output mixers */
7852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7853 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7854 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7855 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7856 /* set up input amps for analog loopback */
7857 /* Amp Indices: DAC = 0, mixer = 1 */
7858 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7859 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7860 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7861 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7862 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7863 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7864 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7865 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7866 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7867 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7869 /* FIXME: use matrix-type input source selection */
7870 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7873 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7874 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7875 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7879 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7880 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7885 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7886 static struct hda_verb alc889A_mb31_ch2_init[] = {
7887 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7888 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7889 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7894 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7895 static struct hda_verb alc889A_mb31_ch4_init[] = {
7896 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7897 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7898 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7899 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7903 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7904 static struct hda_verb alc889A_mb31_ch5_init[] = {
7905 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7906 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7907 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7908 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7912 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7913 static struct hda_verb alc889A_mb31_ch6_init[] = {
7914 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7915 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7916 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7917 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7921 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7922 { 2, alc889A_mb31_ch2_init },
7923 { 4, alc889A_mb31_ch4_init },
7924 { 5, alc889A_mb31_ch5_init },
7925 { 6, alc889A_mb31_ch6_init },
7928 static struct hda_verb alc883_medion_eapd_verbs[] = {
7929 /* eanable EAPD on medion laptop */
7930 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7931 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7935 #define alc883_base_mixer alc882_base_mixer
7937 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7938 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7939 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7940 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7941 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7942 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7943 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7946 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7949 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7950 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7954 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7955 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7956 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7957 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7958 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7960 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7963 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7964 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7968 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7969 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7970 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7972 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7976 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7977 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7978 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7982 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7986 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7987 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7989 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7992 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7999 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8000 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8001 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8002 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8003 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8004 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8005 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8006 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8007 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8009 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8010 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8011 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8012 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8018 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8022 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8023 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8024 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8025 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8026 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8027 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8029 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8030 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8031 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8033 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8034 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8036 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8039 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8040 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8041 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8042 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8046 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8047 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8048 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8050 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8051 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8053 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8054 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8055 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8056 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8057 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8059 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8060 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8064 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8065 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8066 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8070 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8071 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8072 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8074 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8075 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8076 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8077 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8078 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8080 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8081 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8083 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8085 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8086 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8088 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8089 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8093 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8094 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8095 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8097 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
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, HDA_OUTPUT),
8101 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8102 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8103 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8109 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8110 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8114 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8115 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8116 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8118 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8119 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8120 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8122 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8125 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8126 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8130 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8131 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8132 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8133 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8134 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8135 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8139 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8140 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8141 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8143 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8144 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8151 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8152 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8153 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8155 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8156 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8157 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8158 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8159 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8160 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8164 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8167 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8168 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8169 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8173 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8177 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8178 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8179 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8180 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8181 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8182 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8184 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8189 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8191 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8192 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8193 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8195 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8199 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8204 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8205 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8206 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8208 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8209 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8210 0x0d, 1, 0x0, HDA_OUTPUT),
8211 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8212 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8213 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8214 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8215 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8224 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8225 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8229 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8231 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8232 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8233 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8234 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8235 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8237 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8238 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8239 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8240 /* Output switches */
8241 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8242 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8243 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8245 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8250 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8251 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8255 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8256 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8257 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8260 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8261 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8265 static struct hda_bind_ctls alc883_bind_cap_vol = {
8266 .ops = &snd_hda_bind_vol,
8268 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8269 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8274 static struct hda_bind_ctls alc883_bind_cap_switch = {
8275 .ops = &snd_hda_bind_sw,
8277 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8278 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8283 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8284 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8285 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8286 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8287 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8288 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8290 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8295 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8296 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8297 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8299 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8300 /* .name = "Capture Source", */
8301 .name = "Input Source",
8303 .info = alc_mux_enum_info,
8304 .get = alc_mux_enum_get,
8305 .put = alc_mux_enum_put,
8310 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8312 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8313 .name = "Channel Mode",
8314 .info = alc_ch_mode_info,
8315 .get = alc_ch_mode_get,
8316 .put = alc_ch_mode_put,
8321 /* toggle speaker-output according to the hp-jack state */
8322 static void alc883_mitac_setup(struct hda_codec *codec)
8324 struct alc_spec *spec = codec->spec;
8326 spec->autocfg.hp_pins[0] = 0x15;
8327 spec->autocfg.speaker_pins[0] = 0x14;
8328 spec->autocfg.speaker_pins[1] = 0x17;
8331 /* auto-toggle front mic */
8333 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8335 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8337 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8341 static struct hda_verb alc883_mitac_verbs[] = {
8343 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8346 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8347 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8349 /* enable unsolicited event */
8350 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8351 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8356 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8358 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8361 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8363 /* enable unsolicited event */
8365 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8366 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8372 static struct hda_verb alc883_clevo_m720_verbs[] = {
8374 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8377 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8378 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8380 /* enable unsolicited event */
8381 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8382 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8387 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8389 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8392 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8395 /* enable unsolicited event */
8396 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8401 static struct hda_verb alc883_targa_verbs[] = {
8402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8405 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8406 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8408 /* Connect Line-Out side jack (SPDIF) to Side */
8409 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8410 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8411 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8412 /* Connect Mic jack to CLFE */
8413 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8414 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8415 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8416 /* Connect Line-in jack to Surround */
8417 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8418 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8419 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8420 /* Connect HP out jack to Front */
8421 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8422 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8423 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8425 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8430 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8432 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8433 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8437 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8438 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8440 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8445 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8446 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8448 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8449 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8450 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8454 static struct hda_verb alc883_haier_w66_verbs[] = {
8455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8460 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8461 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8462 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8463 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8467 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8472 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8473 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8474 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8475 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8479 static struct hda_verb alc888_6st_dell_verbs[] = {
8480 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8484 static struct hda_verb alc883_vaiott_verbs[] = {
8486 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8489 /* enable unsolicited event */
8490 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8495 static void alc888_3st_hp_setup(struct hda_codec *codec)
8497 struct alc_spec *spec = codec->spec;
8499 spec->autocfg.hp_pins[0] = 0x1b;
8500 spec->autocfg.speaker_pins[0] = 0x14;
8501 spec->autocfg.speaker_pins[1] = 0x16;
8502 spec->autocfg.speaker_pins[2] = 0x18;
8505 static struct hda_verb alc888_3st_hp_verbs[] = {
8506 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8507 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8508 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8509 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8516 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8517 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8518 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8519 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8520 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8527 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8528 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8529 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8530 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8531 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8532 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8539 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8540 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8541 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8542 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8543 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8544 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8545 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8549 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8550 { 2, alc888_3st_hp_2ch_init },
8551 { 4, alc888_3st_hp_4ch_init },
8552 { 6, alc888_3st_hp_6ch_init },
8555 /* toggle front-jack and RCA according to the hp-jack state */
8556 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8558 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8560 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8561 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8562 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8563 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8566 /* toggle RCA according to the front-jack state */
8567 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8569 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8571 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8572 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8575 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8578 if ((res >> 26) == ALC880_HP_EVENT)
8579 alc888_lenovo_ms7195_front_automute(codec);
8580 if ((res >> 26) == ALC880_FRONT_EVENT)
8581 alc888_lenovo_ms7195_rca_automute(codec);
8584 static struct hda_verb alc883_medion_md2_verbs[] = {
8585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8590 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8594 /* toggle speaker-output according to the hp-jack state */
8595 static void alc883_medion_md2_setup(struct hda_codec *codec)
8597 struct alc_spec *spec = codec->spec;
8599 spec->autocfg.hp_pins[0] = 0x14;
8600 spec->autocfg.speaker_pins[0] = 0x15;
8603 /* toggle speaker-output according to the hp-jack state */
8604 #define alc883_targa_init_hook alc882_targa_init_hook
8605 #define alc883_targa_unsol_event alc882_targa_unsol_event
8607 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8609 unsigned int present;
8611 present = snd_hda_jack_detect(codec, 0x18);
8612 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8613 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8616 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8618 struct alc_spec *spec = codec->spec;
8620 spec->autocfg.hp_pins[0] = 0x15;
8621 spec->autocfg.speaker_pins[0] = 0x14;
8624 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8626 alc_automute_amp(codec);
8627 alc883_clevo_m720_mic_automute(codec);
8630 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8633 switch (res >> 26) {
8634 case ALC880_MIC_EVENT:
8635 alc883_clevo_m720_mic_automute(codec);
8638 alc_automute_amp_unsol_event(codec, res);
8643 /* toggle speaker-output according to the hp-jack state */
8644 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8646 struct alc_spec *spec = codec->spec;
8648 spec->autocfg.hp_pins[0] = 0x14;
8649 spec->autocfg.speaker_pins[0] = 0x15;
8652 static void alc883_haier_w66_setup(struct hda_codec *codec)
8654 struct alc_spec *spec = codec->spec;
8656 spec->autocfg.hp_pins[0] = 0x1b;
8657 spec->autocfg.speaker_pins[0] = 0x14;
8660 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8662 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8664 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8665 HDA_AMP_MUTE, bits);
8668 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8670 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8672 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8673 HDA_AMP_MUTE, bits);
8674 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8675 HDA_AMP_MUTE, bits);
8678 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8681 if ((res >> 26) == ALC880_HP_EVENT)
8682 alc883_lenovo_101e_all_automute(codec);
8683 if ((res >> 26) == ALC880_FRONT_EVENT)
8684 alc883_lenovo_101e_ispeaker_automute(codec);
8687 /* toggle speaker-output according to the hp-jack state */
8688 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8690 struct alc_spec *spec = codec->spec;
8692 spec->autocfg.hp_pins[0] = 0x14;
8693 spec->autocfg.speaker_pins[0] = 0x15;
8694 spec->autocfg.speaker_pins[1] = 0x16;
8697 static struct hda_verb alc883_acer_eapd_verbs[] = {
8698 /* HP Pin: output 0 (0x0c) */
8699 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8700 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8701 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8702 /* Front Pin: output 0 (0x0c) */
8703 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8704 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8705 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8706 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8707 /* eanable EAPD on medion laptop */
8708 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8709 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8710 /* enable unsolicited event */
8711 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8715 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8716 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8717 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8718 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8722 static void alc888_6st_dell_setup(struct hda_codec *codec)
8724 struct alc_spec *spec = codec->spec;
8726 spec->autocfg.hp_pins[0] = 0x1b;
8727 spec->autocfg.speaker_pins[0] = 0x14;
8728 spec->autocfg.speaker_pins[1] = 0x15;
8729 spec->autocfg.speaker_pins[2] = 0x16;
8730 spec->autocfg.speaker_pins[3] = 0x17;
8733 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8735 struct alc_spec *spec = codec->spec;
8737 spec->autocfg.hp_pins[0] = 0x1b;
8738 spec->autocfg.speaker_pins[0] = 0x14;
8739 spec->autocfg.speaker_pins[1] = 0x15;
8740 spec->autocfg.speaker_pins[2] = 0x16;
8741 spec->autocfg.speaker_pins[3] = 0x17;
8742 spec->autocfg.speaker_pins[4] = 0x1a;
8745 static void alc883_vaiott_setup(struct hda_codec *codec)
8747 struct alc_spec *spec = codec->spec;
8749 spec->autocfg.hp_pins[0] = 0x15;
8750 spec->autocfg.speaker_pins[0] = 0x14;
8751 spec->autocfg.speaker_pins[1] = 0x17;
8754 static struct hda_verb alc888_asus_m90v_verbs[] = {
8755 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8756 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8757 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8758 /* enable unsolicited event */
8759 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8760 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8764 static void alc883_mode2_setup(struct hda_codec *codec)
8766 struct alc_spec *spec = codec->spec;
8768 spec->autocfg.hp_pins[0] = 0x1b;
8769 spec->autocfg.speaker_pins[0] = 0x14;
8770 spec->autocfg.speaker_pins[1] = 0x15;
8771 spec->autocfg.speaker_pins[2] = 0x16;
8772 spec->ext_mic.pin = 0x18;
8773 spec->int_mic.pin = 0x19;
8774 spec->ext_mic.mux_idx = 0;
8775 spec->int_mic.mux_idx = 1;
8779 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8785 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8786 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8787 /* enable unsolicited event */
8788 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8792 static void alc883_eee1601_inithook(struct hda_codec *codec)
8794 struct alc_spec *spec = codec->spec;
8796 spec->autocfg.hp_pins[0] = 0x14;
8797 spec->autocfg.speaker_pins[0] = 0x1b;
8798 alc_automute_pin(codec);
8801 static struct hda_verb alc889A_mb31_verbs[] = {
8802 /* Init rear pin (used as headphone output) */
8803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8804 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8805 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8806 /* Init line pin (used as output in 4ch and 6ch mode) */
8807 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8808 /* Init line 2 pin (used as headphone out by default) */
8809 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8810 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8814 /* Mute speakers according to the headphone jack state */
8815 static void alc889A_mb31_automute(struct hda_codec *codec)
8817 unsigned int present;
8819 /* Mute only in 2ch or 4ch mode */
8820 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8822 present = snd_hda_jack_detect(codec, 0x15);
8823 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8824 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8825 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8826 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8830 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8832 if ((res >> 26) == ALC880_HP_EVENT)
8833 alc889A_mb31_automute(codec);
8837 #ifdef CONFIG_SND_HDA_POWER_SAVE
8838 #define alc882_loopbacks alc880_loopbacks
8841 /* pcm configuration: identical with ALC880 */
8842 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8843 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8844 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8845 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8847 static hda_nid_t alc883_slave_dig_outs[] = {
8848 ALC1200_DIGOUT_NID, 0,
8851 static hda_nid_t alc1200_slave_dig_outs[] = {
8852 ALC883_DIGOUT_NID, 0,
8856 * configuration and preset
8858 static const char *alc882_models[ALC882_MODEL_LAST] = {
8859 [ALC882_3ST_DIG] = "3stack-dig",
8860 [ALC882_6ST_DIG] = "6stack-dig",
8861 [ALC882_ARIMA] = "arima",
8862 [ALC882_W2JC] = "w2jc",
8863 [ALC882_TARGA] = "targa",
8864 [ALC882_ASUS_A7J] = "asus-a7j",
8865 [ALC882_ASUS_A7M] = "asus-a7m",
8866 [ALC885_MACPRO] = "macpro",
8867 [ALC885_MB5] = "mb5",
8868 [ALC885_MBP3] = "mbp3",
8869 [ALC885_IMAC24] = "imac24",
8870 [ALC885_IMAC91] = "imac91",
8871 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8872 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8873 [ALC883_3ST_6ch] = "3stack-6ch",
8874 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8875 [ALC883_TARGA_DIG] = "targa-dig",
8876 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8877 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8878 [ALC883_ACER] = "acer",
8879 [ALC883_ACER_ASPIRE] = "acer-aspire",
8880 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8881 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8882 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8883 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8884 [ALC883_MEDION] = "medion",
8885 [ALC883_MEDION_MD2] = "medion-md2",
8886 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8887 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8888 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8889 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8890 [ALC888_LENOVO_SKY] = "lenovo-sky",
8891 [ALC883_HAIER_W66] = "haier-w66",
8892 [ALC888_3ST_HP] = "3stack-hp",
8893 [ALC888_6ST_DELL] = "6stack-dell",
8894 [ALC883_MITAC] = "mitac",
8895 [ALC883_CLEVO_M540R] = "clevo-m540r",
8896 [ALC883_CLEVO_M720] = "clevo-m720",
8897 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8898 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8899 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8900 [ALC889A_INTEL] = "intel-alc889a",
8901 [ALC889_INTEL] = "intel-x58",
8902 [ALC1200_ASUS_P5Q] = "asus-p5q",
8903 [ALC889A_MB31] = "mb31",
8904 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8905 [ALC882_AUTO] = "auto",
8908 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8909 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8911 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8912 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8913 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8914 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8915 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8916 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8917 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8918 ALC888_ACER_ASPIRE_4930G),
8919 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8920 ALC888_ACER_ASPIRE_4930G),
8921 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8922 ALC888_ACER_ASPIRE_8930G),
8923 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8924 ALC888_ACER_ASPIRE_8930G),
8925 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8926 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8927 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8928 ALC888_ACER_ASPIRE_6530G),
8929 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8930 ALC888_ACER_ASPIRE_6530G),
8931 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8932 ALC888_ACER_ASPIRE_7730G),
8933 /* default Acer -- disabled as it causes more problems.
8934 * model=auto should work fine now
8936 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8938 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8940 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8941 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8942 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8943 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8944 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8945 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8947 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8948 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8949 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8950 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8951 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8952 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8953 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8954 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8955 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8956 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8957 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8959 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8960 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8961 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8962 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8963 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8964 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8965 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8966 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8967 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8969 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8970 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8971 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8972 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8973 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8974 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8975 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8976 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8977 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8978 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8979 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8980 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8981 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8982 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8983 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8984 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8985 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8986 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8987 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8988 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8989 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8990 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8991 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8992 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8993 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8994 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8995 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8996 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8997 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8999 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9000 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9001 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9002 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9003 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9004 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9005 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9006 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9007 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9008 ALC883_FUJITSU_PI2515),
9009 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9010 ALC888_FUJITSU_XA3530),
9011 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9012 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9013 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9014 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9015 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9016 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9017 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9018 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9019 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9021 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9022 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9023 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9024 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9025 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9026 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9027 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9032 /* codec SSID table for Intel Mac */
9033 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9034 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9035 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9036 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9037 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9038 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9039 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9040 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9041 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9042 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9043 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9044 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9045 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9046 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9047 * so apparently no perfect solution yet
9049 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9050 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9054 static struct alc_config_preset alc882_presets[] = {
9055 [ALC882_3ST_DIG] = {
9056 .mixers = { alc882_base_mixer },
9057 .init_verbs = { alc882_base_init_verbs,
9058 alc882_adc1_init_verbs },
9059 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9060 .dac_nids = alc882_dac_nids,
9061 .dig_out_nid = ALC882_DIGOUT_NID,
9062 .dig_in_nid = ALC882_DIGIN_NID,
9063 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9064 .channel_mode = alc882_ch_modes,
9066 .input_mux = &alc882_capture_source,
9068 [ALC882_6ST_DIG] = {
9069 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9070 .init_verbs = { alc882_base_init_verbs,
9071 alc882_adc1_init_verbs },
9072 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9073 .dac_nids = alc882_dac_nids,
9074 .dig_out_nid = ALC882_DIGOUT_NID,
9075 .dig_in_nid = ALC882_DIGIN_NID,
9076 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9077 .channel_mode = alc882_sixstack_modes,
9078 .input_mux = &alc882_capture_source,
9081 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9082 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9083 alc882_eapd_verbs },
9084 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9085 .dac_nids = alc882_dac_nids,
9086 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9087 .channel_mode = alc882_sixstack_modes,
9088 .input_mux = &alc882_capture_source,
9091 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9092 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9093 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9094 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9095 .dac_nids = alc882_dac_nids,
9096 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9097 .channel_mode = alc880_threestack_modes,
9099 .input_mux = &alc882_capture_source,
9100 .dig_out_nid = ALC882_DIGOUT_NID,
9103 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9104 .init_verbs = { alc885_mbp3_init_verbs,
9105 alc880_gpio1_init_verbs },
9107 .dac_nids = alc882_dac_nids,
9109 .channel_mode = alc885_mbp_4ch_modes,
9110 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9111 .input_mux = &alc882_capture_source,
9112 .dig_out_nid = ALC882_DIGOUT_NID,
9113 .dig_in_nid = ALC882_DIGIN_NID,
9114 .unsol_event = alc_automute_amp_unsol_event,
9115 .setup = alc885_mbp3_setup,
9116 .init_hook = alc_automute_amp,
9119 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9120 .init_verbs = { alc885_mb5_init_verbs,
9121 alc880_gpio1_init_verbs },
9122 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9123 .dac_nids = alc882_dac_nids,
9124 .channel_mode = alc885_mb5_6ch_modes,
9125 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9126 .input_mux = &mb5_capture_source,
9127 .dig_out_nid = ALC882_DIGOUT_NID,
9128 .dig_in_nid = ALC882_DIGIN_NID,
9131 .mixers = { alc882_macpro_mixer },
9132 .init_verbs = { alc882_macpro_init_verbs },
9133 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9134 .dac_nids = alc882_dac_nids,
9135 .dig_out_nid = ALC882_DIGOUT_NID,
9136 .dig_in_nid = ALC882_DIGIN_NID,
9137 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9138 .channel_mode = alc882_ch_modes,
9139 .input_mux = &alc882_capture_source,
9140 .init_hook = alc885_macpro_init_hook,
9143 .mixers = { alc885_imac24_mixer },
9144 .init_verbs = { alc885_imac24_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_ch_modes),
9150 .channel_mode = alc882_ch_modes,
9151 .input_mux = &alc882_capture_source,
9152 .unsol_event = alc_automute_amp_unsol_event,
9153 .setup = alc885_imac24_setup,
9154 .init_hook = alc885_imac24_init_hook,
9157 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9158 .init_verbs = { alc885_imac91_init_verbs,
9159 alc880_gpio1_init_verbs },
9160 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9161 .dac_nids = alc882_dac_nids,
9162 .channel_mode = alc885_mbp_4ch_modes,
9163 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9164 .input_mux = &alc882_capture_source,
9165 .dig_out_nid = ALC882_DIGOUT_NID,
9166 .dig_in_nid = ALC882_DIGIN_NID,
9167 .unsol_event = alc885_imac91_unsol_event,
9168 .init_hook = alc885_imac91_automute,
9171 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9172 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9173 alc880_gpio3_init_verbs, alc882_targa_verbs},
9174 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9175 .dac_nids = alc882_dac_nids,
9176 .dig_out_nid = ALC882_DIGOUT_NID,
9177 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9178 .adc_nids = alc882_adc_nids,
9179 .capsrc_nids = alc882_capsrc_nids,
9180 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9181 .channel_mode = alc882_3ST_6ch_modes,
9183 .input_mux = &alc882_capture_source,
9184 .unsol_event = alc882_targa_unsol_event,
9185 .setup = alc882_targa_setup,
9186 .init_hook = alc882_targa_automute,
9188 [ALC882_ASUS_A7J] = {
9189 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9190 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9191 alc882_asus_a7j_verbs},
9192 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9193 .dac_nids = alc882_dac_nids,
9194 .dig_out_nid = ALC882_DIGOUT_NID,
9195 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9196 .adc_nids = alc882_adc_nids,
9197 .capsrc_nids = alc882_capsrc_nids,
9198 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9199 .channel_mode = alc882_3ST_6ch_modes,
9201 .input_mux = &alc882_capture_source,
9203 [ALC882_ASUS_A7M] = {
9204 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9205 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9206 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9207 alc882_asus_a7m_verbs },
9208 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9209 .dac_nids = alc882_dac_nids,
9210 .dig_out_nid = ALC882_DIGOUT_NID,
9211 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9212 .channel_mode = alc880_threestack_modes,
9214 .input_mux = &alc882_capture_source,
9216 [ALC883_3ST_2ch_DIG] = {
9217 .mixers = { alc883_3ST_2ch_mixer },
9218 .init_verbs = { alc883_init_verbs },
9219 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9220 .dac_nids = alc883_dac_nids,
9221 .dig_out_nid = ALC883_DIGOUT_NID,
9222 .dig_in_nid = ALC883_DIGIN_NID,
9223 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9224 .channel_mode = alc883_3ST_2ch_modes,
9225 .input_mux = &alc883_capture_source,
9227 [ALC883_3ST_6ch_DIG] = {
9228 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9229 .init_verbs = { alc883_init_verbs },
9230 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9231 .dac_nids = alc883_dac_nids,
9232 .dig_out_nid = ALC883_DIGOUT_NID,
9233 .dig_in_nid = ALC883_DIGIN_NID,
9234 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9235 .channel_mode = alc883_3ST_6ch_modes,
9237 .input_mux = &alc883_capture_source,
9239 [ALC883_3ST_6ch] = {
9240 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9241 .init_verbs = { alc883_init_verbs },
9242 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9243 .dac_nids = alc883_dac_nids,
9244 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9245 .channel_mode = alc883_3ST_6ch_modes,
9247 .input_mux = &alc883_capture_source,
9249 [ALC883_3ST_6ch_INTEL] = {
9250 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9251 .init_verbs = { alc883_init_verbs },
9252 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9253 .dac_nids = alc883_dac_nids,
9254 .dig_out_nid = ALC883_DIGOUT_NID,
9255 .dig_in_nid = ALC883_DIGIN_NID,
9256 .slave_dig_outs = alc883_slave_dig_outs,
9257 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9258 .channel_mode = alc883_3ST_6ch_intel_modes,
9260 .input_mux = &alc883_3stack_6ch_intel,
9263 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9264 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9265 alc_hp15_unsol_verbs },
9266 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9267 .dac_nids = alc883_dac_nids,
9268 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9269 .adc_nids = alc889_adc_nids,
9270 .dig_out_nid = ALC883_DIGOUT_NID,
9271 .dig_in_nid = ALC883_DIGIN_NID,
9272 .slave_dig_outs = alc883_slave_dig_outs,
9273 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9274 .channel_mode = alc889_8ch_intel_modes,
9275 .capsrc_nids = alc889_capsrc_nids,
9276 .input_mux = &alc889_capture_source,
9277 .setup = alc889_automute_setup,
9278 .init_hook = alc_automute_amp,
9279 .unsol_event = alc_automute_amp_unsol_event,
9283 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9284 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9285 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9287 .dac_nids = alc883_dac_nids,
9288 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9289 .adc_nids = alc889_adc_nids,
9290 .capsrc_nids = alc889_capsrc_nids,
9291 .capsrc_nids = alc889_capsrc_nids,
9292 .dig_out_nid = ALC883_DIGOUT_NID,
9293 .dig_in_nid = ALC883_DIGIN_NID,
9294 .slave_dig_outs = alc883_slave_dig_outs,
9295 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9296 .channel_mode = alc889_8ch_intel_modes,
9297 .capsrc_nids = alc889_capsrc_nids,
9298 .input_mux = &alc889_capture_source,
9299 .setup = alc889_automute_setup,
9300 .init_hook = alc889_intel_init_hook,
9301 .unsol_event = alc_automute_amp_unsol_event,
9304 [ALC883_6ST_DIG] = {
9305 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9306 .init_verbs = { alc883_init_verbs },
9307 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9308 .dac_nids = alc883_dac_nids,
9309 .dig_out_nid = ALC883_DIGOUT_NID,
9310 .dig_in_nid = ALC883_DIGIN_NID,
9311 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9312 .channel_mode = alc883_sixstack_modes,
9313 .input_mux = &alc883_capture_source,
9315 [ALC883_TARGA_DIG] = {
9316 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9317 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9318 alc883_targa_verbs},
9319 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9320 .dac_nids = alc883_dac_nids,
9321 .dig_out_nid = ALC883_DIGOUT_NID,
9322 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9323 .channel_mode = alc883_3ST_6ch_modes,
9325 .input_mux = &alc883_capture_source,
9326 .unsol_event = alc883_targa_unsol_event,
9327 .setup = alc882_targa_setup,
9328 .init_hook = alc882_targa_automute,
9330 [ALC883_TARGA_2ch_DIG] = {
9331 .mixers = { alc883_targa_2ch_mixer},
9332 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9333 alc883_targa_verbs},
9334 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9335 .dac_nids = alc883_dac_nids,
9336 .adc_nids = alc883_adc_nids_alt,
9337 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9338 .capsrc_nids = alc883_capsrc_nids,
9339 .dig_out_nid = ALC883_DIGOUT_NID,
9340 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9341 .channel_mode = alc883_3ST_2ch_modes,
9342 .input_mux = &alc883_capture_source,
9343 .unsol_event = alc883_targa_unsol_event,
9344 .setup = alc882_targa_setup,
9345 .init_hook = alc882_targa_automute,
9347 [ALC883_TARGA_8ch_DIG] = {
9348 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9349 alc883_chmode_mixer },
9350 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9351 alc883_targa_verbs },
9352 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9353 .dac_nids = alc883_dac_nids,
9354 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9355 .adc_nids = alc883_adc_nids_rev,
9356 .capsrc_nids = alc883_capsrc_nids_rev,
9357 .dig_out_nid = ALC883_DIGOUT_NID,
9358 .dig_in_nid = ALC883_DIGIN_NID,
9359 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9360 .channel_mode = alc883_4ST_8ch_modes,
9362 .input_mux = &alc883_capture_source,
9363 .unsol_event = alc883_targa_unsol_event,
9364 .setup = alc882_targa_setup,
9365 .init_hook = alc882_targa_automute,
9368 .mixers = { alc883_base_mixer },
9369 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9370 * and the headphone jack. Turn this on and rely on the
9371 * standard mute methods whenever the user wants to turn
9372 * these outputs off.
9374 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9375 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9376 .dac_nids = alc883_dac_nids,
9377 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9378 .channel_mode = alc883_3ST_2ch_modes,
9379 .input_mux = &alc883_capture_source,
9381 [ALC883_ACER_ASPIRE] = {
9382 .mixers = { alc883_acer_aspire_mixer },
9383 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9384 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9385 .dac_nids = alc883_dac_nids,
9386 .dig_out_nid = ALC883_DIGOUT_NID,
9387 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9388 .channel_mode = alc883_3ST_2ch_modes,
9389 .input_mux = &alc883_capture_source,
9390 .unsol_event = alc_automute_amp_unsol_event,
9391 .setup = alc883_acer_aspire_setup,
9392 .init_hook = alc_automute_amp,
9394 [ALC888_ACER_ASPIRE_4930G] = {
9395 .mixers = { alc888_base_mixer,
9396 alc883_chmode_mixer },
9397 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9398 alc888_acer_aspire_4930g_verbs },
9399 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9400 .dac_nids = alc883_dac_nids,
9401 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9402 .adc_nids = alc883_adc_nids_rev,
9403 .capsrc_nids = alc883_capsrc_nids_rev,
9404 .dig_out_nid = ALC883_DIGOUT_NID,
9405 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9406 .channel_mode = alc883_3ST_6ch_modes,
9409 ARRAY_SIZE(alc888_2_capture_sources),
9410 .input_mux = alc888_2_capture_sources,
9411 .unsol_event = alc_automute_amp_unsol_event,
9412 .setup = alc888_acer_aspire_4930g_setup,
9413 .init_hook = alc_automute_amp,
9415 [ALC888_ACER_ASPIRE_6530G] = {
9416 .mixers = { alc888_acer_aspire_6530_mixer },
9417 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9418 alc888_acer_aspire_6530g_verbs },
9419 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9420 .dac_nids = alc883_dac_nids,
9421 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9422 .adc_nids = alc883_adc_nids_rev,
9423 .capsrc_nids = alc883_capsrc_nids_rev,
9424 .dig_out_nid = ALC883_DIGOUT_NID,
9425 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9426 .channel_mode = alc883_3ST_2ch_modes,
9428 ARRAY_SIZE(alc888_2_capture_sources),
9429 .input_mux = alc888_acer_aspire_6530_sources,
9430 .unsol_event = alc_automute_amp_unsol_event,
9431 .setup = alc888_acer_aspire_6530g_setup,
9432 .init_hook = alc_automute_amp,
9434 [ALC888_ACER_ASPIRE_8930G] = {
9435 .mixers = { alc889_acer_aspire_8930g_mixer,
9436 alc883_chmode_mixer },
9437 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9438 alc889_acer_aspire_8930g_verbs,
9440 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9441 .dac_nids = alc883_dac_nids,
9442 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9443 .adc_nids = alc889_adc_nids,
9444 .capsrc_nids = alc889_capsrc_nids,
9445 .dig_out_nid = ALC883_DIGOUT_NID,
9446 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9447 .channel_mode = alc883_3ST_6ch_modes,
9449 .const_channel_count = 6,
9451 ARRAY_SIZE(alc889_capture_sources),
9452 .input_mux = alc889_capture_sources,
9453 .unsol_event = alc_automute_amp_unsol_event,
9454 .setup = alc889_acer_aspire_8930g_setup,
9455 .init_hook = alc_automute_amp,
9456 #ifdef CONFIG_SND_HDA_POWER_SAVE
9457 .power_hook = alc889_power_eapd,
9460 [ALC888_ACER_ASPIRE_7730G] = {
9461 .mixers = { alc883_3ST_6ch_mixer,
9462 alc883_chmode_mixer },
9463 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9464 alc888_acer_aspire_7730G_verbs },
9465 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9466 .dac_nids = alc883_dac_nids,
9467 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9468 .adc_nids = alc883_adc_nids_rev,
9469 .capsrc_nids = alc883_capsrc_nids_rev,
9470 .dig_out_nid = ALC883_DIGOUT_NID,
9471 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9472 .channel_mode = alc883_3ST_6ch_modes,
9474 .const_channel_count = 6,
9475 .input_mux = &alc883_capture_source,
9476 .unsol_event = alc_automute_amp_unsol_event,
9477 .setup = alc888_acer_aspire_6530g_setup,
9478 .init_hook = alc_automute_amp,
9481 .mixers = { alc883_fivestack_mixer,
9482 alc883_chmode_mixer },
9483 .init_verbs = { alc883_init_verbs,
9484 alc883_medion_eapd_verbs },
9485 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9486 .dac_nids = alc883_dac_nids,
9487 .adc_nids = alc883_adc_nids_alt,
9488 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9489 .capsrc_nids = alc883_capsrc_nids,
9490 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9491 .channel_mode = alc883_sixstack_modes,
9492 .input_mux = &alc883_capture_source,
9494 [ALC883_MEDION_MD2] = {
9495 .mixers = { alc883_medion_md2_mixer},
9496 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9497 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9498 .dac_nids = alc883_dac_nids,
9499 .dig_out_nid = ALC883_DIGOUT_NID,
9500 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9501 .channel_mode = alc883_3ST_2ch_modes,
9502 .input_mux = &alc883_capture_source,
9503 .unsol_event = alc_automute_amp_unsol_event,
9504 .setup = alc883_medion_md2_setup,
9505 .init_hook = alc_automute_amp,
9507 [ALC883_LAPTOP_EAPD] = {
9508 .mixers = { alc883_base_mixer },
9509 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9510 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9511 .dac_nids = alc883_dac_nids,
9512 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9513 .channel_mode = alc883_3ST_2ch_modes,
9514 .input_mux = &alc883_capture_source,
9516 [ALC883_CLEVO_M540R] = {
9517 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9518 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9519 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9520 .dac_nids = alc883_dac_nids,
9521 .dig_out_nid = ALC883_DIGOUT_NID,
9522 .dig_in_nid = ALC883_DIGIN_NID,
9523 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9524 .channel_mode = alc883_3ST_6ch_clevo_modes,
9526 .input_mux = &alc883_capture_source,
9527 /* This machine has the hardware HP auto-muting, thus
9528 * we need no software mute via unsol event
9531 [ALC883_CLEVO_M720] = {
9532 .mixers = { alc883_clevo_m720_mixer },
9533 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9534 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9535 .dac_nids = alc883_dac_nids,
9536 .dig_out_nid = ALC883_DIGOUT_NID,
9537 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9538 .channel_mode = alc883_3ST_2ch_modes,
9539 .input_mux = &alc883_capture_source,
9540 .unsol_event = alc883_clevo_m720_unsol_event,
9541 .setup = alc883_clevo_m720_setup,
9542 .init_hook = alc883_clevo_m720_init_hook,
9544 [ALC883_LENOVO_101E_2ch] = {
9545 .mixers = { alc883_lenovo_101e_2ch_mixer},
9546 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9547 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9548 .dac_nids = alc883_dac_nids,
9549 .adc_nids = alc883_adc_nids_alt,
9550 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9551 .capsrc_nids = alc883_capsrc_nids,
9552 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9553 .channel_mode = alc883_3ST_2ch_modes,
9554 .input_mux = &alc883_lenovo_101e_capture_source,
9555 .unsol_event = alc883_lenovo_101e_unsol_event,
9556 .init_hook = alc883_lenovo_101e_all_automute,
9558 [ALC883_LENOVO_NB0763] = {
9559 .mixers = { alc883_lenovo_nb0763_mixer },
9560 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9561 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9562 .dac_nids = alc883_dac_nids,
9563 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9564 .channel_mode = alc883_3ST_2ch_modes,
9566 .input_mux = &alc883_lenovo_nb0763_capture_source,
9567 .unsol_event = alc_automute_amp_unsol_event,
9568 .setup = alc883_medion_md2_setup,
9569 .init_hook = alc_automute_amp,
9571 [ALC888_LENOVO_MS7195_DIG] = {
9572 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9573 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9574 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9575 .dac_nids = alc883_dac_nids,
9576 .dig_out_nid = ALC883_DIGOUT_NID,
9577 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9578 .channel_mode = alc883_3ST_6ch_modes,
9580 .input_mux = &alc883_capture_source,
9581 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9582 .init_hook = alc888_lenovo_ms7195_front_automute,
9584 [ALC883_HAIER_W66] = {
9585 .mixers = { alc883_targa_2ch_mixer},
9586 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9587 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9588 .dac_nids = alc883_dac_nids,
9589 .dig_out_nid = ALC883_DIGOUT_NID,
9590 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9591 .channel_mode = alc883_3ST_2ch_modes,
9592 .input_mux = &alc883_capture_source,
9593 .unsol_event = alc_automute_amp_unsol_event,
9594 .setup = alc883_haier_w66_setup,
9595 .init_hook = alc_automute_amp,
9598 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9599 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9600 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9601 .dac_nids = alc883_dac_nids,
9602 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9603 .channel_mode = alc888_3st_hp_modes,
9605 .input_mux = &alc883_capture_source,
9606 .unsol_event = alc_automute_amp_unsol_event,
9607 .setup = alc888_3st_hp_setup,
9608 .init_hook = alc_automute_amp,
9610 [ALC888_6ST_DELL] = {
9611 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9612 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9614 .dac_nids = alc883_dac_nids,
9615 .dig_out_nid = ALC883_DIGOUT_NID,
9616 .dig_in_nid = ALC883_DIGIN_NID,
9617 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9618 .channel_mode = alc883_sixstack_modes,
9619 .input_mux = &alc883_capture_source,
9620 .unsol_event = alc_automute_amp_unsol_event,
9621 .setup = alc888_6st_dell_setup,
9622 .init_hook = alc_automute_amp,
9625 .mixers = { alc883_mitac_mixer },
9626 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9628 .dac_nids = alc883_dac_nids,
9629 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9630 .channel_mode = alc883_3ST_2ch_modes,
9631 .input_mux = &alc883_capture_source,
9632 .unsol_event = alc_automute_amp_unsol_event,
9633 .setup = alc883_mitac_setup,
9634 .init_hook = alc_automute_amp,
9636 [ALC883_FUJITSU_PI2515] = {
9637 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9638 .init_verbs = { alc883_init_verbs,
9639 alc883_2ch_fujitsu_pi2515_verbs},
9640 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9641 .dac_nids = alc883_dac_nids,
9642 .dig_out_nid = ALC883_DIGOUT_NID,
9643 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9644 .channel_mode = alc883_3ST_2ch_modes,
9645 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9646 .unsol_event = alc_automute_amp_unsol_event,
9647 .setup = alc883_2ch_fujitsu_pi2515_setup,
9648 .init_hook = alc_automute_amp,
9650 [ALC888_FUJITSU_XA3530] = {
9651 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9652 .init_verbs = { alc883_init_verbs,
9653 alc888_fujitsu_xa3530_verbs },
9654 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9655 .dac_nids = alc883_dac_nids,
9656 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9657 .adc_nids = alc883_adc_nids_rev,
9658 .capsrc_nids = alc883_capsrc_nids_rev,
9659 .dig_out_nid = ALC883_DIGOUT_NID,
9660 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9661 .channel_mode = alc888_4ST_8ch_intel_modes,
9663 ARRAY_SIZE(alc888_2_capture_sources),
9664 .input_mux = alc888_2_capture_sources,
9665 .unsol_event = alc_automute_amp_unsol_event,
9666 .setup = alc888_fujitsu_xa3530_setup,
9667 .init_hook = alc_automute_amp,
9669 [ALC888_LENOVO_SKY] = {
9670 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9671 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9672 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9673 .dac_nids = alc883_dac_nids,
9674 .dig_out_nid = ALC883_DIGOUT_NID,
9675 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9676 .channel_mode = alc883_sixstack_modes,
9678 .input_mux = &alc883_lenovo_sky_capture_source,
9679 .unsol_event = alc_automute_amp_unsol_event,
9680 .setup = alc888_lenovo_sky_setup,
9681 .init_hook = alc_automute_amp,
9683 [ALC888_ASUS_M90V] = {
9684 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9685 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9686 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9687 .dac_nids = alc883_dac_nids,
9688 .dig_out_nid = ALC883_DIGOUT_NID,
9689 .dig_in_nid = ALC883_DIGIN_NID,
9690 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9691 .channel_mode = alc883_3ST_6ch_modes,
9693 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9694 .unsol_event = alc_sku_unsol_event,
9695 .setup = alc883_mode2_setup,
9696 .init_hook = alc_inithook,
9698 [ALC888_ASUS_EEE1601] = {
9699 .mixers = { alc883_asus_eee1601_mixer },
9700 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9701 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9702 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9703 .dac_nids = alc883_dac_nids,
9704 .dig_out_nid = ALC883_DIGOUT_NID,
9705 .dig_in_nid = ALC883_DIGIN_NID,
9706 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9707 .channel_mode = alc883_3ST_2ch_modes,
9709 .input_mux = &alc883_asus_eee1601_capture_source,
9710 .unsol_event = alc_sku_unsol_event,
9711 .init_hook = alc883_eee1601_inithook,
9713 [ALC1200_ASUS_P5Q] = {
9714 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9715 .init_verbs = { alc883_init_verbs },
9716 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9717 .dac_nids = alc883_dac_nids,
9718 .dig_out_nid = ALC1200_DIGOUT_NID,
9719 .dig_in_nid = ALC883_DIGIN_NID,
9720 .slave_dig_outs = alc1200_slave_dig_outs,
9721 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9722 .channel_mode = alc883_sixstack_modes,
9723 .input_mux = &alc883_capture_source,
9726 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9727 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9728 alc880_gpio1_init_verbs },
9729 .adc_nids = alc883_adc_nids,
9730 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9731 .capsrc_nids = alc883_capsrc_nids,
9732 .dac_nids = alc883_dac_nids,
9733 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9734 .channel_mode = alc889A_mb31_6ch_modes,
9735 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9736 .input_mux = &alc889A_mb31_capture_source,
9737 .dig_out_nid = ALC883_DIGOUT_NID,
9738 .unsol_event = alc889A_mb31_unsol_event,
9739 .init_hook = alc889A_mb31_automute,
9741 [ALC883_SONY_VAIO_TT] = {
9742 .mixers = { alc883_vaiott_mixer },
9743 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9744 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9745 .dac_nids = alc883_dac_nids,
9746 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9747 .channel_mode = alc883_3ST_2ch_modes,
9748 .input_mux = &alc883_capture_source,
9749 .unsol_event = alc_automute_amp_unsol_event,
9750 .setup = alc883_vaiott_setup,
9751 .init_hook = alc_automute_amp,
9760 PINFIX_ABIT_AW9D_MAX
9763 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9764 { 0x15, 0x01080104 }, /* side */
9765 { 0x16, 0x01011012 }, /* rear */
9766 { 0x17, 0x01016011 }, /* clfe */
9770 static const struct alc_fixup alc882_fixups[] = {
9771 [PINFIX_ABIT_AW9D_MAX] = {
9772 .pins = alc882_abit_aw9d_pinfix
9776 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9777 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9782 * BIOS auto configuration
9784 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9785 const struct auto_pin_cfg *cfg)
9787 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9790 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9791 hda_nid_t nid, int pin_type,
9795 struct alc_spec *spec = codec->spec;
9798 alc_set_pin_output(codec, nid, pin_type);
9799 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9802 idx = spec->multiout.dac_nids[dac_idx] - 2;
9803 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9807 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9809 struct alc_spec *spec = codec->spec;
9812 for (i = 0; i <= HDA_SIDE; i++) {
9813 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9814 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9816 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9821 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9823 struct alc_spec *spec = codec->spec;
9826 pin = spec->autocfg.hp_pins[0];
9827 if (pin) /* connect to front */
9829 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9830 pin = spec->autocfg.speaker_pins[0];
9832 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9835 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9837 struct alc_spec *spec = codec->spec;
9840 for (i = 0; i < AUTO_PIN_LAST; i++) {
9841 hda_nid_t nid = spec->autocfg.input_pins[i];
9844 alc_set_input_pin(codec, nid, i);
9845 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9846 snd_hda_codec_write(codec, nid, 0,
9847 AC_VERB_SET_AMP_GAIN_MUTE,
9852 static void alc882_auto_init_input_src(struct hda_codec *codec)
9854 struct alc_spec *spec = codec->spec;
9857 for (c = 0; c < spec->num_adc_nids; c++) {
9858 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9859 hda_nid_t nid = spec->capsrc_nids[c];
9860 unsigned int mux_idx;
9861 const struct hda_input_mux *imux;
9862 int conns, mute, idx, item;
9864 conns = snd_hda_get_connections(codec, nid, conn_list,
9865 ARRAY_SIZE(conn_list));
9868 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9869 imux = &spec->input_mux[mux_idx];
9870 for (idx = 0; idx < conns; idx++) {
9871 /* if the current connection is the selected one,
9872 * unmute it as default - otherwise mute it
9874 mute = AMP_IN_MUTE(idx);
9875 for (item = 0; item < imux->num_items; item++) {
9876 if (imux->items[item].index == idx) {
9877 if (spec->cur_mux[c] == item)
9878 mute = AMP_IN_UNMUTE(idx);
9882 /* check if we have a selector or mixer
9883 * we could check for the widget type instead, but
9884 * just check for Amp-In presence (in case of mixer
9885 * without amp-in there is something wrong, this
9886 * function shouldn't be used or capsrc nid is wrong)
9888 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9889 snd_hda_codec_write(codec, nid, 0,
9890 AC_VERB_SET_AMP_GAIN_MUTE,
9892 else if (mute != AMP_IN_MUTE(idx))
9893 snd_hda_codec_write(codec, nid, 0,
9894 AC_VERB_SET_CONNECT_SEL,
9900 /* add mic boosts if needed */
9901 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9903 struct alc_spec *spec = codec->spec;
9907 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9908 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9909 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9911 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9915 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9916 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9917 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9919 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9926 /* almost identical with ALC880 parser... */
9927 static int alc882_parse_auto_config(struct hda_codec *codec)
9929 struct alc_spec *spec = codec->spec;
9930 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9933 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9937 if (!spec->autocfg.line_outs)
9938 return 0; /* can't find valid BIOS pin config */
9940 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9943 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9946 err = alc880_auto_create_extra_out(spec,
9947 spec->autocfg.speaker_pins[0],
9951 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9955 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9959 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9961 /* check multiple SPDIF-out (for recent codecs) */
9962 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9964 err = snd_hda_get_connections(codec,
9965 spec->autocfg.dig_out_pins[i],
9970 spec->multiout.dig_out_nid = dig_nid;
9972 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9973 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9975 spec->slave_dig_outs[i - 1] = dig_nid;
9978 if (spec->autocfg.dig_in_pin)
9979 spec->dig_in_nid = ALC880_DIGIN_NID;
9981 if (spec->kctls.list)
9982 add_mixer(spec, spec->kctls.list);
9984 add_verb(spec, alc883_auto_init_verbs);
9985 /* if ADC 0x07 is available, initialize it, too */
9986 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9987 add_verb(spec, alc882_adc1_init_verbs);
9989 spec->num_mux_defs = 1;
9990 spec->input_mux = &spec->private_imux[0];
9992 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9994 err = alc_auto_add_mic_boost(codec);
9998 return 1; /* config found */
10001 /* additional initialization for auto-configuration model */
10002 static void alc882_auto_init(struct hda_codec *codec)
10004 struct alc_spec *spec = codec->spec;
10005 alc882_auto_init_multi_out(codec);
10006 alc882_auto_init_hp_out(codec);
10007 alc882_auto_init_analog_input(codec);
10008 alc882_auto_init_input_src(codec);
10009 if (spec->unsol_event)
10010 alc_inithook(codec);
10013 static int patch_alc882(struct hda_codec *codec)
10015 struct alc_spec *spec;
10016 int err, board_config;
10018 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10022 codec->spec = spec;
10024 switch (codec->vendor_id) {
10029 /* ALC883 and variants */
10030 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10034 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10038 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10039 board_config = snd_hda_check_board_codec_sid_config(codec,
10040 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10042 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10043 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10045 board_config = ALC882_AUTO;
10048 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10050 if (board_config == ALC882_AUTO) {
10051 /* automatic parse from the BIOS config */
10052 err = alc882_parse_auto_config(codec);
10058 "hda_codec: Cannot set up configuration "
10059 "from BIOS. Using base mode...\n");
10060 board_config = ALC882_3ST_DIG;
10064 err = snd_hda_attach_beep_device(codec, 0x1);
10070 if (board_config != ALC882_AUTO)
10071 setup_preset(codec, &alc882_presets[board_config]);
10073 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10074 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10075 /* FIXME: setup DAC5 */
10076 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10077 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10079 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10080 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10082 if (codec->vendor_id == 0x10ec0888)
10083 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10085 if (!spec->adc_nids && spec->input_mux) {
10087 spec->num_adc_nids = 0;
10088 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10089 const struct hda_input_mux *imux = spec->input_mux;
10091 hda_nid_t items[16];
10092 hda_nid_t nid = alc882_adc_nids[i];
10093 unsigned int wcap = get_wcaps(codec, nid);
10095 wcap = get_wcaps_type(wcap);
10096 if (wcap != AC_WID_AUD_IN)
10098 spec->private_adc_nids[spec->num_adc_nids] = nid;
10099 err = snd_hda_get_connections(codec, nid, &cap, 1);
10102 err = snd_hda_get_connections(codec, cap, items,
10103 ARRAY_SIZE(items));
10106 for (j = 0; j < imux->num_items; j++)
10107 if (imux->items[j].index >= err)
10109 if (j < imux->num_items)
10111 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10112 spec->num_adc_nids++;
10114 spec->adc_nids = spec->private_adc_nids;
10115 spec->capsrc_nids = spec->private_capsrc_nids;
10118 set_capture_mixer(codec);
10119 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10121 spec->vmaster_nid = 0x0c;
10123 codec->patch_ops = alc_patch_ops;
10124 if (board_config == ALC882_AUTO)
10125 spec->init_hook = alc882_auto_init;
10126 #ifdef CONFIG_SND_HDA_POWER_SAVE
10127 if (!spec->loopback.amplist)
10128 spec->loopback.amplist = alc882_loopbacks;
10130 codec->proc_widget_hook = print_realtek_coef;
10140 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10141 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10143 #define alc262_dac_nids alc260_dac_nids
10144 #define alc262_adc_nids alc882_adc_nids
10145 #define alc262_adc_nids_alt alc882_adc_nids_alt
10146 #define alc262_capsrc_nids alc882_capsrc_nids
10147 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10149 #define alc262_modes alc260_modes
10150 #define alc262_capture_source alc882_capture_source
10152 static hda_nid_t alc262_dmic_adc_nids[1] = {
10157 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10159 static struct snd_kcontrol_new alc262_base_mixer[] = {
10160 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10161 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10162 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10163 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10165 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10169 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10170 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10171 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10172 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10174 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10175 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10179 /* update HP, line and mono-out pins according to the master switch */
10180 static void alc262_hp_master_update(struct hda_codec *codec)
10182 struct alc_spec *spec = codec->spec;
10183 int val = spec->master_sw;
10185 /* HP & line-out */
10186 snd_hda_codec_write_cache(codec, 0x1b, 0,
10187 AC_VERB_SET_PIN_WIDGET_CONTROL,
10189 snd_hda_codec_write_cache(codec, 0x15, 0,
10190 AC_VERB_SET_PIN_WIDGET_CONTROL,
10192 /* mono (speaker) depending on the HP jack sense */
10193 val = val && !spec->jack_present;
10194 snd_hda_codec_write_cache(codec, 0x16, 0,
10195 AC_VERB_SET_PIN_WIDGET_CONTROL,
10196 val ? PIN_OUT : 0);
10199 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10201 struct alc_spec *spec = codec->spec;
10203 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10204 alc262_hp_master_update(codec);
10207 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10209 if ((res >> 26) != ALC880_HP_EVENT)
10211 alc262_hp_bpc_automute(codec);
10214 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10216 struct alc_spec *spec = codec->spec;
10218 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10219 alc262_hp_master_update(codec);
10222 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10225 if ((res >> 26) != ALC880_HP_EVENT)
10227 alc262_hp_wildwest_automute(codec);
10230 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10232 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10233 struct snd_ctl_elem_value *ucontrol)
10235 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10236 struct alc_spec *spec = codec->spec;
10237 int val = !!*ucontrol->value.integer.value;
10239 if (val == spec->master_sw)
10241 spec->master_sw = val;
10242 alc262_hp_master_update(codec);
10246 #define ALC262_HP_MASTER_SWITCH \
10248 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10249 .name = "Master Playback Switch", \
10250 .info = snd_ctl_boolean_mono_info, \
10251 .get = alc262_hp_master_sw_get, \
10252 .put = alc262_hp_master_sw_put, \
10255 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10256 ALC262_HP_MASTER_SWITCH,
10257 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10258 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10260 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10262 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10266 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10267 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10268 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10269 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10272 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10273 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10274 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10275 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10279 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10280 ALC262_HP_MASTER_SWITCH,
10281 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10282 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10283 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10284 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10285 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10287 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10289 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10290 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10291 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10292 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10293 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10294 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10295 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10299 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10300 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10301 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10302 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10306 /* mute/unmute internal speaker according to the hp jack and mute state */
10307 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10309 struct alc_spec *spec = codec->spec;
10311 spec->autocfg.hp_pins[0] = 0x15;
10312 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10315 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10316 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10317 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10318 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10319 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10322 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10326 static struct hda_verb alc262_hp_t5735_verbs[] = {
10327 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10330 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10334 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10335 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10336 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10337 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10338 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10339 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10340 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10344 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10345 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10346 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10347 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10348 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10349 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10350 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10351 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10353 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10358 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10365 /* bind hp and internal speaker mute (with plug check) as master switch */
10366 static void alc262_hippo_master_update(struct hda_codec *codec)
10368 struct alc_spec *spec = codec->spec;
10369 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10370 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10371 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10375 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10376 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10377 HDA_AMP_MUTE, mute);
10378 /* mute internal speaker per jack sense */
10379 if (spec->jack_present)
10380 mute = HDA_AMP_MUTE;
10382 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10383 HDA_AMP_MUTE, mute);
10384 if (speaker_nid && speaker_nid != line_nid)
10385 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10386 HDA_AMP_MUTE, mute);
10389 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10391 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10392 struct snd_ctl_elem_value *ucontrol)
10394 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10395 struct alc_spec *spec = codec->spec;
10396 int val = !!*ucontrol->value.integer.value;
10398 if (val == spec->master_sw)
10400 spec->master_sw = val;
10401 alc262_hippo_master_update(codec);
10405 #define ALC262_HIPPO_MASTER_SWITCH \
10407 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10408 .name = "Master Playback Switch", \
10409 .info = snd_ctl_boolean_mono_info, \
10410 .get = alc262_hippo_master_sw_get, \
10411 .put = alc262_hippo_master_sw_put, \
10414 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10415 ALC262_HIPPO_MASTER_SWITCH,
10416 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10419 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10420 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10423 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10424 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10425 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10426 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10427 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10431 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10432 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10433 ALC262_HIPPO_MASTER_SWITCH,
10434 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10435 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10436 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10437 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10439 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10440 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10441 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10442 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10443 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10447 /* mute/unmute internal speaker according to the hp jack and mute state */
10448 static void alc262_hippo_automute(struct hda_codec *codec)
10450 struct alc_spec *spec = codec->spec;
10451 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10453 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10454 alc262_hippo_master_update(codec);
10457 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10459 if ((res >> 26) != ALC880_HP_EVENT)
10461 alc262_hippo_automute(codec);
10464 static void alc262_hippo_setup(struct hda_codec *codec)
10466 struct alc_spec *spec = codec->spec;
10468 spec->autocfg.hp_pins[0] = 0x15;
10469 spec->autocfg.speaker_pins[0] = 0x14;
10472 static void alc262_hippo1_setup(struct hda_codec *codec)
10474 struct alc_spec *spec = codec->spec;
10476 spec->autocfg.hp_pins[0] = 0x1b;
10477 spec->autocfg.speaker_pins[0] = 0x14;
10481 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10482 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10483 ALC262_HIPPO_MASTER_SWITCH,
10484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10486 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10487 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10491 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10492 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10493 ALC262_HIPPO_MASTER_SWITCH,
10494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
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("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10498 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10502 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10503 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10504 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10505 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10506 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10507 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10508 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10511 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10512 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10513 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10514 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10518 static struct hda_verb alc262_tyan_verbs[] = {
10519 /* Headphone automute */
10520 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10521 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10522 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10524 /* P11 AUX_IN, white 4-pin connector */
10525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10526 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10527 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10528 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10533 /* unsolicited event for HP jack sensing */
10534 static void alc262_tyan_setup(struct hda_codec *codec)
10536 struct alc_spec *spec = codec->spec;
10538 spec->autocfg.hp_pins[0] = 0x1b;
10539 spec->autocfg.speaker_pins[0] = 0x15;
10543 #define alc262_capture_mixer alc882_capture_mixer
10544 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10547 * generic initialization of ADC, input mixers and output mixers
10549 static struct hda_verb alc262_init_verbs[] = {
10551 * Unmute ADC0-2 and set the default input to mic-in
10553 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10555 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10556 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10557 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10558 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10560 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10562 * Note: PASD motherboards uses the Line In 2 as the input for
10563 * front panel mic (mic 2)
10565 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10573 * Set up output mixers (0x0c - 0x0e)
10575 /* set vol=0 to output mixers */
10576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10577 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10578 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10579 /* set up input amps for analog loopback */
10580 /* Amp Indices: DAC = 0, mixer = 1 */
10581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10590 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10592 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10593 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10595 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10596 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10597 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10598 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10599 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10601 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10602 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10604 /* FIXME: use matrix-type input source selection */
10605 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10606 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10607 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10609 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10625 static struct hda_verb alc262_eapd_verbs[] = {
10626 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10627 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10631 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10632 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10633 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10634 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10636 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10637 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10641 static struct hda_verb alc262_sony_unsol_verbs[] = {
10642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10643 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10644 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10646 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10647 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10651 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10652 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10653 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10660 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10661 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10662 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10663 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10664 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10665 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10666 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10667 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10668 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10672 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10674 struct alc_spec *spec = codec->spec;
10676 spec->autocfg.hp_pins[0] = 0x15;
10677 spec->autocfg.speaker_pins[0] = 0x14;
10678 spec->ext_mic.pin = 0x18;
10679 spec->ext_mic.mux_idx = 0;
10680 spec->int_mic.pin = 0x12;
10681 spec->int_mic.mux_idx = 9;
10682 spec->auto_mic = 1;
10688 * 0x16 = internal speaker
10689 * 0x18 = external mic
10692 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10693 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10694 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10700 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10701 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10705 static struct hda_verb alc262_nec_verbs[] = {
10706 /* Unmute Speaker */
10707 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10710 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10713 /* External mic to headphone */
10714 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10715 /* External mic to speaker */
10716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10722 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10723 * 0x1b = port replicator headphone out
10726 #define ALC_HP_EVENT 0x37
10728 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10729 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10731 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10736 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10737 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10738 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10742 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10743 /* Front Mic pin: input vref at 50% */
10744 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10745 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10749 static struct hda_input_mux alc262_fujitsu_capture_source = {
10753 { "Int Mic", 0x1 },
10758 static struct hda_input_mux alc262_HP_capture_source = {
10762 { "Front Mic", 0x1 },
10769 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10773 { "Front Mic", 0x2 },
10779 /* mute/unmute internal speaker according to the hp jacks and mute state */
10780 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10782 struct alc_spec *spec = codec->spec;
10785 if (force || !spec->sense_updated) {
10786 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10787 snd_hda_jack_detect(codec, 0x1b);
10788 spec->sense_updated = 1;
10790 /* unmute internal speaker only if both HPs are unplugged and
10791 * master switch is on
10793 if (spec->jack_present)
10794 mute = HDA_AMP_MUTE;
10796 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10797 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10798 HDA_AMP_MUTE, mute);
10801 /* unsolicited event for HP jack sensing */
10802 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10805 if ((res >> 26) != ALC_HP_EVENT)
10807 alc262_fujitsu_automute(codec, 1);
10810 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10812 alc262_fujitsu_automute(codec, 1);
10815 /* bind volumes of both NID 0x0c and 0x0d */
10816 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10817 .ops = &snd_hda_bind_vol,
10819 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10820 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10825 /* mute/unmute internal speaker according to the hp jack and mute state */
10826 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10828 struct alc_spec *spec = codec->spec;
10831 if (force || !spec->sense_updated) {
10832 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10833 spec->sense_updated = 1;
10835 if (spec->jack_present) {
10836 /* mute internal speaker */
10837 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10838 HDA_AMP_MUTE, HDA_AMP_MUTE);
10839 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10840 HDA_AMP_MUTE, HDA_AMP_MUTE);
10842 /* unmute internal speaker if necessary */
10843 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10844 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10845 HDA_AMP_MUTE, mute);
10846 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10847 HDA_AMP_MUTE, mute);
10851 /* unsolicited event for HP jack sensing */
10852 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10855 if ((res >> 26) != ALC_HP_EVENT)
10857 alc262_lenovo_3000_automute(codec, 1);
10860 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10861 int dir, int idx, long *valp)
10865 for (i = 0; i < 2; i++, valp++)
10866 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10868 *valp ? 0 : HDA_AMP_MUTE);
10872 /* bind hp and internal speaker mute (with plug check) */
10873 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10874 struct snd_ctl_elem_value *ucontrol)
10876 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10877 long *valp = ucontrol->value.integer.value;
10880 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10881 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10883 alc262_fujitsu_automute(codec, 0);
10887 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10888 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10890 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10891 .name = "Master Playback Switch",
10892 .info = snd_hda_mixer_amp_switch_info,
10893 .get = snd_hda_mixer_amp_switch_get,
10894 .put = alc262_fujitsu_master_sw_put,
10895 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10897 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10898 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10899 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10902 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10903 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10904 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10908 /* bind hp and internal speaker mute (with plug check) */
10909 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10910 struct snd_ctl_elem_value *ucontrol)
10912 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10913 long *valp = ucontrol->value.integer.value;
10916 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10918 alc262_lenovo_3000_automute(codec, 0);
10922 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10923 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10925 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10926 .name = "Master Playback Switch",
10927 .info = snd_hda_mixer_amp_switch_info,
10928 .get = snd_hda_mixer_amp_switch_get,
10929 .put = alc262_lenovo_3000_master_sw_put,
10930 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10934 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10937 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10938 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10939 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10943 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10944 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10945 ALC262_HIPPO_MASTER_SWITCH,
10946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10949 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10950 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10951 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10955 /* additional init verbs for Benq laptops */
10956 static struct hda_verb alc262_EAPD_verbs[] = {
10957 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10958 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10962 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10963 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10964 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10966 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10967 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10971 /* Samsung Q1 Ultra Vista model setup */
10972 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10973 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10974 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10976 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10977 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10978 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10982 static struct hda_verb alc262_ultra_verbs[] = {
10984 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10988 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10989 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10990 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10991 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10993 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10996 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10997 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10999 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11001 /* ADC, choose mic */
11002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11003 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11004 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11005 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11006 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11007 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11008 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11009 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11010 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11011 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11015 /* mute/unmute internal speaker according to the hp jack and mute state */
11016 static void alc262_ultra_automute(struct hda_codec *codec)
11018 struct alc_spec *spec = codec->spec;
11022 /* auto-mute only when HP is used as HP */
11023 if (!spec->cur_mux[0]) {
11024 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11025 if (spec->jack_present)
11026 mute = HDA_AMP_MUTE;
11028 /* mute/unmute internal speaker */
11029 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11030 HDA_AMP_MUTE, mute);
11031 /* mute/unmute HP */
11032 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11033 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11036 /* unsolicited event for HP jack sensing */
11037 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11040 if ((res >> 26) != ALC880_HP_EVENT)
11042 alc262_ultra_automute(codec);
11045 static struct hda_input_mux alc262_ultra_capture_source = {
11049 { "Headphone", 0x7 },
11053 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11054 struct snd_ctl_elem_value *ucontrol)
11056 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11057 struct alc_spec *spec = codec->spec;
11060 ret = alc_mux_enum_put(kcontrol, ucontrol);
11063 /* reprogram the HP pin as mic or HP according to the input source */
11064 snd_hda_codec_write_cache(codec, 0x15, 0,
11065 AC_VERB_SET_PIN_WIDGET_CONTROL,
11066 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11067 alc262_ultra_automute(codec); /* mute/unmute HP */
11071 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11072 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11073 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11075 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11076 .name = "Capture Source",
11077 .info = alc_mux_enum_info,
11078 .get = alc_mux_enum_get,
11079 .put = alc262_ultra_mux_enum_put,
11084 /* We use two mixers depending on the output pin; 0x16 is a mono output
11085 * and thus it's bound with a different mixer.
11086 * This function returns which mixer amp should be used.
11088 static int alc262_check_volbit(hda_nid_t nid)
11092 else if (nid == 0x16)
11098 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11099 const char *pfx, int *vbits)
11104 vbit = alc262_check_volbit(nid);
11107 if (*vbits & vbit) /* a volume control for this mixer already there */
11111 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11113 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11114 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11117 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11125 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11127 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11128 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11131 /* add playback controls from the parsed DAC table */
11132 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11133 const struct auto_pin_cfg *cfg)
11139 spec->multiout.num_dacs = 1; /* only use one dac */
11140 spec->multiout.dac_nids = spec->private_dac_nids;
11141 spec->multiout.dac_nids[0] = 2;
11143 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11145 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11149 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11152 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11155 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11159 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11160 alc262_check_volbit(cfg->speaker_pins[0]) |
11161 alc262_check_volbit(cfg->hp_pins[0]);
11162 if (vbits == 1 || vbits == 2)
11163 pfx = "Master"; /* only one mixer is used */
11164 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11169 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11172 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11176 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11183 #define alc262_auto_create_input_ctls \
11184 alc880_auto_create_input_ctls
11187 * generic initialization of ADC, input mixers and output mixers
11189 static struct hda_verb alc262_volume_init_verbs[] = {
11191 * Unmute ADC0-2 and set the default input to mic-in
11193 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11194 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11195 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11197 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11198 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11200 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11202 * Note: PASD motherboards uses the Line In 2 as the input for
11203 * front panel mic (mic 2)
11205 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11206 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11207 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11208 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11209 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11210 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11213 * Set up output mixers (0x0c - 0x0f)
11215 /* set vol=0 to output mixers */
11216 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11217 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11218 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11220 /* set up input amps for analog loopback */
11221 /* Amp Indices: DAC = 0, mixer = 1 */
11222 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11223 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11224 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11225 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11226 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11227 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11229 /* FIXME: use matrix-type input source selection */
11230 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11231 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11234 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11237 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11238 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11239 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11240 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11242 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11243 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11244 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11245 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11250 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11252 * Unmute ADC0-2 and set the default input to mic-in
11254 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11256 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11257 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11258 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11259 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11261 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11263 * Note: PASD motherboards uses the Line In 2 as the input for
11264 * front panel mic (mic 2)
11266 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11276 * Set up output mixers (0x0c - 0x0e)
11278 /* set vol=0 to output mixers */
11279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11281 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11283 /* set up input amps for analog loopback */
11284 /* Amp Indices: DAC = 0, mixer = 1 */
11285 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11286 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11288 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11290 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11292 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11296 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11297 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11299 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11300 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11303 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11304 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11305 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11306 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11308 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11309 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11310 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11311 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11312 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11313 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11316 /* FIXME: use matrix-type input source selection */
11317 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11318 /* Input mixer1: only unmute Mic */
11319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11320 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11322 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11327 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11335 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11336 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11337 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11340 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11341 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11349 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11354 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11356 * Unmute ADC0-2 and set the default input to mic-in
11358 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11360 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11362 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11365 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11367 * Note: PASD motherboards uses the Line In 2 as the input for front
11368 * panel mic (mic 2)
11370 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11373 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11374 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11380 * Set up output mixers (0x0c - 0x0e)
11382 /* set vol=0 to output mixers */
11383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11384 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11387 /* set up input amps for analog loopback */
11388 /* Amp Indices: DAC = 0, mixer = 1 */
11389 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11393 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11398 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11400 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11401 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11402 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11403 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11405 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11406 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11408 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11409 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11411 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11412 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11413 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11415 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11416 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11418 /* FIXME: use matrix-type input source selection */
11419 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11420 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11422 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11423 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11424 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11425 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11426 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11427 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11429 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11430 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11431 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11432 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11433 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11434 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11435 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11437 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11438 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11439 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11441 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11442 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11443 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11445 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11450 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11452 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11453 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11454 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11456 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11457 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11458 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11459 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11461 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11463 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11468 #ifdef CONFIG_SND_HDA_POWER_SAVE
11469 #define alc262_loopbacks alc880_loopbacks
11472 /* pcm configuration: identical with ALC880 */
11473 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11474 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11475 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11476 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11479 * BIOS auto configuration
11481 static int alc262_parse_auto_config(struct hda_codec *codec)
11483 struct alc_spec *spec = codec->spec;
11485 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11487 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11491 if (!spec->autocfg.line_outs) {
11492 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11493 spec->multiout.max_channels = 2;
11494 spec->no_analog = 1;
11497 return 0; /* can't find valid BIOS pin config */
11499 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11502 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11506 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11509 if (spec->autocfg.dig_outs) {
11510 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11511 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11513 if (spec->autocfg.dig_in_pin)
11514 spec->dig_in_nid = ALC262_DIGIN_NID;
11516 if (spec->kctls.list)
11517 add_mixer(spec, spec->kctls.list);
11519 add_verb(spec, alc262_volume_init_verbs);
11520 spec->num_mux_defs = 1;
11521 spec->input_mux = &spec->private_imux[0];
11523 err = alc_auto_add_mic_boost(codec);
11527 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11532 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11533 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11534 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11535 #define alc262_auto_init_input_src alc882_auto_init_input_src
11538 /* init callback for auto-configuration model -- overriding the default init */
11539 static void alc262_auto_init(struct hda_codec *codec)
11541 struct alc_spec *spec = codec->spec;
11542 alc262_auto_init_multi_out(codec);
11543 alc262_auto_init_hp_out(codec);
11544 alc262_auto_init_analog_input(codec);
11545 alc262_auto_init_input_src(codec);
11546 if (spec->unsol_event)
11547 alc_inithook(codec);
11551 * configuration and preset
11553 static const char *alc262_models[ALC262_MODEL_LAST] = {
11554 [ALC262_BASIC] = "basic",
11555 [ALC262_HIPPO] = "hippo",
11556 [ALC262_HIPPO_1] = "hippo_1",
11557 [ALC262_FUJITSU] = "fujitsu",
11558 [ALC262_HP_BPC] = "hp-bpc",
11559 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11560 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11561 [ALC262_HP_RP5700] = "hp-rp5700",
11562 [ALC262_BENQ_ED8] = "benq",
11563 [ALC262_BENQ_T31] = "benq-t31",
11564 [ALC262_SONY_ASSAMD] = "sony-assamd",
11565 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11566 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11567 [ALC262_ULTRA] = "ultra",
11568 [ALC262_LENOVO_3000] = "lenovo-3000",
11569 [ALC262_NEC] = "nec",
11570 [ALC262_TYAN] = "tyan",
11571 [ALC262_AUTO] = "auto",
11574 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11575 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11576 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11577 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11579 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11581 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11583 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11584 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11585 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11586 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11587 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11588 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11589 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11590 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11591 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11592 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11593 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11594 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11595 ALC262_HP_TC_T5735),
11596 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11597 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11598 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11599 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11600 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11601 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11602 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11603 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11604 #if 0 /* disable the quirk since model=auto works better in recent versions */
11605 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11606 ALC262_SONY_ASSAMD),
11608 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11609 ALC262_TOSHIBA_RX1),
11610 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11611 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11612 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11613 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11614 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11616 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11617 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11618 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11619 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11620 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11624 static struct alc_config_preset alc262_presets[] = {
11626 .mixers = { alc262_base_mixer },
11627 .init_verbs = { alc262_init_verbs },
11628 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11629 .dac_nids = alc262_dac_nids,
11631 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11632 .channel_mode = alc262_modes,
11633 .input_mux = &alc262_capture_source,
11636 .mixers = { alc262_hippo_mixer },
11637 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11638 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11639 .dac_nids = alc262_dac_nids,
11641 .dig_out_nid = ALC262_DIGOUT_NID,
11642 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11643 .channel_mode = alc262_modes,
11644 .input_mux = &alc262_capture_source,
11645 .unsol_event = alc262_hippo_unsol_event,
11646 .setup = alc262_hippo_setup,
11647 .init_hook = alc262_hippo_automute,
11649 [ALC262_HIPPO_1] = {
11650 .mixers = { alc262_hippo1_mixer },
11651 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11652 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11653 .dac_nids = alc262_dac_nids,
11655 .dig_out_nid = ALC262_DIGOUT_NID,
11656 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11657 .channel_mode = alc262_modes,
11658 .input_mux = &alc262_capture_source,
11659 .unsol_event = alc262_hippo_unsol_event,
11660 .setup = alc262_hippo1_setup,
11661 .init_hook = alc262_hippo_automute,
11663 [ALC262_FUJITSU] = {
11664 .mixers = { alc262_fujitsu_mixer },
11665 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11666 alc262_fujitsu_unsol_verbs },
11667 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11668 .dac_nids = alc262_dac_nids,
11670 .dig_out_nid = ALC262_DIGOUT_NID,
11671 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11672 .channel_mode = alc262_modes,
11673 .input_mux = &alc262_fujitsu_capture_source,
11674 .unsol_event = alc262_fujitsu_unsol_event,
11675 .init_hook = alc262_fujitsu_init_hook,
11677 [ALC262_HP_BPC] = {
11678 .mixers = { alc262_HP_BPC_mixer },
11679 .init_verbs = { alc262_HP_BPC_init_verbs },
11680 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11681 .dac_nids = alc262_dac_nids,
11683 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11684 .channel_mode = alc262_modes,
11685 .input_mux = &alc262_HP_capture_source,
11686 .unsol_event = alc262_hp_bpc_unsol_event,
11687 .init_hook = alc262_hp_bpc_automute,
11689 [ALC262_HP_BPC_D7000_WF] = {
11690 .mixers = { alc262_HP_BPC_WildWest_mixer },
11691 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11692 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11693 .dac_nids = alc262_dac_nids,
11695 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11696 .channel_mode = alc262_modes,
11697 .input_mux = &alc262_HP_D7000_capture_source,
11698 .unsol_event = alc262_hp_wildwest_unsol_event,
11699 .init_hook = alc262_hp_wildwest_automute,
11701 [ALC262_HP_BPC_D7000_WL] = {
11702 .mixers = { alc262_HP_BPC_WildWest_mixer,
11703 alc262_HP_BPC_WildWest_option_mixer },
11704 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11705 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11706 .dac_nids = alc262_dac_nids,
11708 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11709 .channel_mode = alc262_modes,
11710 .input_mux = &alc262_HP_D7000_capture_source,
11711 .unsol_event = alc262_hp_wildwest_unsol_event,
11712 .init_hook = alc262_hp_wildwest_automute,
11714 [ALC262_HP_TC_T5735] = {
11715 .mixers = { alc262_hp_t5735_mixer },
11716 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11717 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11718 .dac_nids = alc262_dac_nids,
11720 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11721 .channel_mode = alc262_modes,
11722 .input_mux = &alc262_capture_source,
11723 .unsol_event = alc_automute_amp_unsol_event,
11724 .setup = alc262_hp_t5735_setup,
11725 .init_hook = alc_automute_amp,
11727 [ALC262_HP_RP5700] = {
11728 .mixers = { alc262_hp_rp5700_mixer },
11729 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11730 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11731 .dac_nids = alc262_dac_nids,
11732 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11733 .channel_mode = alc262_modes,
11734 .input_mux = &alc262_hp_rp5700_capture_source,
11736 [ALC262_BENQ_ED8] = {
11737 .mixers = { alc262_base_mixer },
11738 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11739 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11740 .dac_nids = alc262_dac_nids,
11742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11743 .channel_mode = alc262_modes,
11744 .input_mux = &alc262_capture_source,
11746 [ALC262_SONY_ASSAMD] = {
11747 .mixers = { alc262_sony_mixer },
11748 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11749 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11750 .dac_nids = alc262_dac_nids,
11752 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11753 .channel_mode = alc262_modes,
11754 .input_mux = &alc262_capture_source,
11755 .unsol_event = alc262_hippo_unsol_event,
11756 .setup = alc262_hippo_setup,
11757 .init_hook = alc262_hippo_automute,
11759 [ALC262_BENQ_T31] = {
11760 .mixers = { alc262_benq_t31_mixer },
11761 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11762 alc_hp15_unsol_verbs },
11763 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11764 .dac_nids = alc262_dac_nids,
11766 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11767 .channel_mode = alc262_modes,
11768 .input_mux = &alc262_capture_source,
11769 .unsol_event = alc262_hippo_unsol_event,
11770 .setup = alc262_hippo_setup,
11771 .init_hook = alc262_hippo_automute,
11774 .mixers = { alc262_ultra_mixer },
11775 .cap_mixer = alc262_ultra_capture_mixer,
11776 .init_verbs = { alc262_ultra_verbs },
11777 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11778 .dac_nids = alc262_dac_nids,
11779 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11780 .channel_mode = alc262_modes,
11781 .input_mux = &alc262_ultra_capture_source,
11782 .adc_nids = alc262_adc_nids, /* ADC0 */
11783 .capsrc_nids = alc262_capsrc_nids,
11784 .num_adc_nids = 1, /* single ADC */
11785 .unsol_event = alc262_ultra_unsol_event,
11786 .init_hook = alc262_ultra_automute,
11788 [ALC262_LENOVO_3000] = {
11789 .mixers = { alc262_lenovo_3000_mixer },
11790 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11791 alc262_lenovo_3000_unsol_verbs,
11792 alc262_lenovo_3000_init_verbs },
11793 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11794 .dac_nids = alc262_dac_nids,
11796 .dig_out_nid = ALC262_DIGOUT_NID,
11797 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11798 .channel_mode = alc262_modes,
11799 .input_mux = &alc262_fujitsu_capture_source,
11800 .unsol_event = alc262_lenovo_3000_unsol_event,
11803 .mixers = { alc262_nec_mixer },
11804 .init_verbs = { alc262_nec_verbs },
11805 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11806 .dac_nids = alc262_dac_nids,
11808 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11809 .channel_mode = alc262_modes,
11810 .input_mux = &alc262_capture_source,
11812 [ALC262_TOSHIBA_S06] = {
11813 .mixers = { alc262_toshiba_s06_mixer },
11814 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11815 alc262_eapd_verbs },
11816 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11817 .capsrc_nids = alc262_dmic_capsrc_nids,
11818 .dac_nids = alc262_dac_nids,
11819 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11820 .num_adc_nids = 1, /* single ADC */
11821 .dig_out_nid = ALC262_DIGOUT_NID,
11822 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11823 .channel_mode = alc262_modes,
11824 .unsol_event = alc_sku_unsol_event,
11825 .setup = alc262_toshiba_s06_setup,
11826 .init_hook = alc_inithook,
11828 [ALC262_TOSHIBA_RX1] = {
11829 .mixers = { alc262_toshiba_rx1_mixer },
11830 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11831 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11832 .dac_nids = alc262_dac_nids,
11834 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11835 .channel_mode = alc262_modes,
11836 .input_mux = &alc262_capture_source,
11837 .unsol_event = alc262_hippo_unsol_event,
11838 .setup = alc262_hippo_setup,
11839 .init_hook = alc262_hippo_automute,
11842 .mixers = { alc262_tyan_mixer },
11843 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11844 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11845 .dac_nids = alc262_dac_nids,
11847 .dig_out_nid = ALC262_DIGOUT_NID,
11848 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11849 .channel_mode = alc262_modes,
11850 .input_mux = &alc262_capture_source,
11851 .unsol_event = alc_automute_amp_unsol_event,
11852 .setup = alc262_tyan_setup,
11853 .init_hook = alc_automute_amp,
11857 static int patch_alc262(struct hda_codec *codec)
11859 struct alc_spec *spec;
11863 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11867 codec->spec = spec;
11869 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11874 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11875 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11876 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11877 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11881 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11883 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11887 if (board_config < 0) {
11888 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11890 board_config = ALC262_AUTO;
11893 if (board_config == ALC262_AUTO) {
11894 /* automatic parse from the BIOS config */
11895 err = alc262_parse_auto_config(codec);
11901 "hda_codec: Cannot set up configuration "
11902 "from BIOS. Using base mode...\n");
11903 board_config = ALC262_BASIC;
11907 if (!spec->no_analog) {
11908 err = snd_hda_attach_beep_device(codec, 0x1);
11915 if (board_config != ALC262_AUTO)
11916 setup_preset(codec, &alc262_presets[board_config]);
11918 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11919 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11921 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11922 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11924 if (!spec->adc_nids && spec->input_mux) {
11926 /* check whether the digital-mic has to be supported */
11927 for (i = 0; i < spec->input_mux->num_items; i++) {
11928 if (spec->input_mux->items[i].index >= 9)
11931 if (i < spec->input_mux->num_items) {
11932 /* use only ADC0 */
11933 spec->adc_nids = alc262_dmic_adc_nids;
11934 spec->num_adc_nids = 1;
11935 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11937 /* all analog inputs */
11938 /* check whether NID 0x07 is valid */
11939 unsigned int wcap = get_wcaps(codec, 0x07);
11942 wcap = get_wcaps_type(wcap);
11943 if (wcap != AC_WID_AUD_IN) {
11944 spec->adc_nids = alc262_adc_nids_alt;
11945 spec->num_adc_nids =
11946 ARRAY_SIZE(alc262_adc_nids_alt);
11947 spec->capsrc_nids = alc262_capsrc_nids_alt;
11949 spec->adc_nids = alc262_adc_nids;
11950 spec->num_adc_nids =
11951 ARRAY_SIZE(alc262_adc_nids);
11952 spec->capsrc_nids = alc262_capsrc_nids;
11956 if (!spec->cap_mixer && !spec->no_analog)
11957 set_capture_mixer(codec);
11958 if (!spec->no_analog)
11959 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11961 spec->vmaster_nid = 0x0c;
11963 codec->patch_ops = alc_patch_ops;
11964 if (board_config == ALC262_AUTO)
11965 spec->init_hook = alc262_auto_init;
11966 #ifdef CONFIG_SND_HDA_POWER_SAVE
11967 if (!spec->loopback.amplist)
11968 spec->loopback.amplist = alc262_loopbacks;
11970 codec->proc_widget_hook = print_realtek_coef;
11976 * ALC268 channel source setting (2 channel)
11978 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11979 #define alc268_modes alc260_modes
11981 static hda_nid_t alc268_dac_nids[2] = {
11986 static hda_nid_t alc268_adc_nids[2] = {
11991 static hda_nid_t alc268_adc_nids_alt[1] = {
11996 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11998 static struct snd_kcontrol_new alc268_base_mixer[] = {
11999 /* output mixer control */
12000 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12001 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12002 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12003 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12004 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12005 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12006 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12010 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12011 /* output mixer control */
12012 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12013 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12014 ALC262_HIPPO_MASTER_SWITCH,
12015 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12016 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12017 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12021 /* bind Beep switches of both NID 0x0f and 0x10 */
12022 static struct hda_bind_ctls alc268_bind_beep_sw = {
12023 .ops = &snd_hda_bind_sw,
12025 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12026 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12031 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12032 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12033 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12037 static struct hda_verb alc268_eapd_verbs[] = {
12038 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12039 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12043 /* Toshiba specific */
12044 static struct hda_verb alc268_toshiba_verbs[] = {
12045 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12049 /* Acer specific */
12050 /* bind volumes of both NID 0x02 and 0x03 */
12051 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12052 .ops = &snd_hda_bind_vol,
12054 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12055 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12060 /* mute/unmute internal speaker according to the hp jack and mute state */
12061 static void alc268_acer_automute(struct hda_codec *codec, int force)
12063 struct alc_spec *spec = codec->spec;
12066 if (force || !spec->sense_updated) {
12067 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12068 spec->sense_updated = 1;
12070 if (spec->jack_present)
12071 mute = HDA_AMP_MUTE; /* mute internal speaker */
12072 else /* unmute internal speaker if necessary */
12073 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12074 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12075 HDA_AMP_MUTE, mute);
12079 /* bind hp and internal speaker mute (with plug check) */
12080 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12081 struct snd_ctl_elem_value *ucontrol)
12083 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12084 long *valp = ucontrol->value.integer.value;
12087 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12089 alc268_acer_automute(codec, 0);
12093 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12094 /* output mixer control */
12095 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12097 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12098 .name = "Master Playback Switch",
12099 .info = snd_hda_mixer_amp_switch_info,
12100 .get = snd_hda_mixer_amp_switch_get,
12101 .put = alc268_acer_master_sw_put,
12102 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12104 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12108 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12109 /* output mixer control */
12110 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12112 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12113 .name = "Master Playback Switch",
12114 .info = snd_hda_mixer_amp_switch_info,
12115 .get = snd_hda_mixer_amp_switch_get,
12116 .put = alc268_acer_master_sw_put,
12117 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12120 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12121 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12125 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12126 /* output mixer control */
12127 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12129 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12130 .name = "Master Playback Switch",
12131 .info = snd_hda_mixer_amp_switch_info,
12132 .get = snd_hda_mixer_amp_switch_get,
12133 .put = alc268_acer_master_sw_put,
12134 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12136 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12137 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12141 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12142 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12143 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12144 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12145 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12146 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12147 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12151 static struct hda_verb alc268_acer_verbs[] = {
12152 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12153 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12154 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12155 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12156 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12157 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12158 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12162 /* unsolicited event for HP jack sensing */
12163 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12164 #define alc268_toshiba_setup alc262_hippo_setup
12165 #define alc268_toshiba_automute alc262_hippo_automute
12167 static void alc268_acer_unsol_event(struct hda_codec *codec,
12170 if ((res >> 26) != ALC880_HP_EVENT)
12172 alc268_acer_automute(codec, 1);
12175 static void alc268_acer_init_hook(struct hda_codec *codec)
12177 alc268_acer_automute(codec, 1);
12180 /* toggle speaker-output according to the hp-jack state */
12181 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12183 unsigned int present;
12184 unsigned char bits;
12186 present = snd_hda_jack_detect(codec, 0x15);
12187 bits = present ? AMP_IN_MUTE(0) : 0;
12188 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12189 AMP_IN_MUTE(0), bits);
12190 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12191 AMP_IN_MUTE(0), bits);
12194 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12197 switch (res >> 26) {
12198 case ALC880_HP_EVENT:
12199 alc268_aspire_one_speaker_automute(codec);
12201 case ALC880_MIC_EVENT:
12202 alc_mic_automute(codec);
12207 static void alc268_acer_lc_setup(struct hda_codec *codec)
12209 struct alc_spec *spec = codec->spec;
12210 spec->ext_mic.pin = 0x18;
12211 spec->ext_mic.mux_idx = 0;
12212 spec->int_mic.pin = 0x12;
12213 spec->int_mic.mux_idx = 6;
12214 spec->auto_mic = 1;
12217 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12219 alc268_aspire_one_speaker_automute(codec);
12220 alc_mic_automute(codec);
12223 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12224 /* output mixer control */
12225 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12226 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12227 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12228 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12230 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12234 static struct hda_verb alc268_dell_verbs[] = {
12235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12237 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12238 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12242 /* mute/unmute internal speaker according to the hp jack and mute state */
12243 static void alc268_dell_setup(struct hda_codec *codec)
12245 struct alc_spec *spec = codec->spec;
12247 spec->autocfg.hp_pins[0] = 0x15;
12248 spec->autocfg.speaker_pins[0] = 0x14;
12249 spec->ext_mic.pin = 0x18;
12250 spec->ext_mic.mux_idx = 0;
12251 spec->int_mic.pin = 0x19;
12252 spec->int_mic.mux_idx = 1;
12253 spec->auto_mic = 1;
12256 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12257 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12258 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12259 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12261 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12262 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12263 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12264 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12268 static struct hda_verb alc267_quanta_il1_verbs[] = {
12269 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12270 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12274 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12276 struct alc_spec *spec = codec->spec;
12277 spec->autocfg.hp_pins[0] = 0x15;
12278 spec->autocfg.speaker_pins[0] = 0x14;
12279 spec->ext_mic.pin = 0x18;
12280 spec->ext_mic.mux_idx = 0;
12281 spec->int_mic.pin = 0x19;
12282 spec->int_mic.mux_idx = 1;
12283 spec->auto_mic = 1;
12287 * generic initialization of ADC, input mixers and output mixers
12289 static struct hda_verb alc268_base_init_verbs[] = {
12290 /* Unmute DAC0-1 and set vol = 0 */
12291 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12292 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12295 * Set up output mixers (0x0c - 0x0e)
12297 /* set vol=0 to output mixers */
12298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12299 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12301 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12302 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12304 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12305 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12306 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12307 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12308 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12309 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12310 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12311 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12313 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12314 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12315 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12316 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12317 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12319 /* set PCBEEP vol = 0, mute connections */
12320 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12321 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12322 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12324 /* Unmute Selector 23h,24h and set the default input to mic-in */
12326 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12328 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12335 * generic initialization of ADC, input mixers and output mixers
12337 static struct hda_verb alc268_volume_init_verbs[] = {
12338 /* set output DAC */
12339 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12340 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12342 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12343 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12344 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12345 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12346 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12349 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12350 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12353 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12355 /* set PCBEEP vol = 0, mute connections */
12356 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12358 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12363 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12364 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12365 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12369 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12370 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12371 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12376 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12377 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12378 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12379 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12380 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12385 static struct hda_input_mux alc268_capture_source = {
12389 { "Front Mic", 0x1 },
12395 static struct hda_input_mux alc268_acer_capture_source = {
12399 { "Internal Mic", 0x1 },
12404 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12408 { "Internal Mic", 0x6 },
12413 #ifdef CONFIG_SND_DEBUG
12414 static struct snd_kcontrol_new alc268_test_mixer[] = {
12415 /* Volume widgets */
12416 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12417 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12418 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12419 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12420 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12421 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12422 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12423 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12424 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12425 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12426 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12427 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12428 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12429 /* The below appears problematic on some hardwares */
12430 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12431 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12432 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12433 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12434 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12436 /* Modes for retasking pin widgets */
12437 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12438 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12439 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12440 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12442 /* Controls for GPIO pins, assuming they are configured as outputs */
12443 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12444 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12445 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12446 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12448 /* Switches to allow the digital SPDIF output pin to be enabled.
12449 * The ALC268 does not have an SPDIF input.
12451 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12453 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12454 * this output to turn on an external amplifier.
12456 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12457 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12463 /* create input playback/capture controls for the given pin */
12464 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12465 const char *ctlname, int idx)
12481 if (spec->multiout.dac_nids[0] != dac &&
12482 spec->multiout.dac_nids[1] != dac) {
12483 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12484 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12488 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12492 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12493 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12495 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12496 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12502 /* add playback controls from the parsed DAC table */
12503 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12504 const struct auto_pin_cfg *cfg)
12509 spec->multiout.dac_nids = spec->private_dac_nids;
12511 nid = cfg->line_out_pins[0];
12514 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12518 err = alc268_new_analog_output(spec, nid, name, 0);
12523 nid = cfg->speaker_pins[0];
12525 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12526 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12530 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12534 nid = cfg->hp_pins[0];
12536 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12541 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12543 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12544 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12551 /* create playback/capture controls for input pins */
12552 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12553 const struct auto_pin_cfg *cfg)
12555 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12558 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12559 hda_nid_t nid, int pin_type)
12563 alc_set_pin_output(codec, nid, pin_type);
12564 if (nid == 0x14 || nid == 0x16)
12568 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12571 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12573 struct alc_spec *spec = codec->spec;
12574 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12576 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12577 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12581 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12583 struct alc_spec *spec = codec->spec;
12586 pin = spec->autocfg.hp_pins[0];
12588 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12589 pin = spec->autocfg.speaker_pins[0];
12591 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12594 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12596 struct alc_spec *spec = codec->spec;
12597 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12598 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12599 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12600 unsigned int dac_vol1, dac_vol2;
12602 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12603 snd_hda_codec_write(codec, speaker_nid, 0,
12604 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12605 /* mute mixer inputs from 0x1d */
12606 snd_hda_codec_write(codec, 0x0f, 0,
12607 AC_VERB_SET_AMP_GAIN_MUTE,
12609 snd_hda_codec_write(codec, 0x10, 0,
12610 AC_VERB_SET_AMP_GAIN_MUTE,
12613 /* unmute mixer inputs from 0x1d */
12614 snd_hda_codec_write(codec, 0x0f, 0,
12615 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12616 snd_hda_codec_write(codec, 0x10, 0,
12617 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12620 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12621 if (line_nid == 0x14)
12622 dac_vol2 = AMP_OUT_ZERO;
12623 else if (line_nid == 0x15)
12624 dac_vol1 = AMP_OUT_ZERO;
12625 if (hp_nid == 0x14)
12626 dac_vol2 = AMP_OUT_ZERO;
12627 else if (hp_nid == 0x15)
12628 dac_vol1 = AMP_OUT_ZERO;
12629 if (line_nid != 0x16 || hp_nid != 0x16 ||
12630 spec->autocfg.line_out_pins[1] != 0x16 ||
12631 spec->autocfg.line_out_pins[2] != 0x16)
12632 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12634 snd_hda_codec_write(codec, 0x02, 0,
12635 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12636 snd_hda_codec_write(codec, 0x03, 0,
12637 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12640 /* pcm configuration: identical with ALC880 */
12641 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12642 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12643 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12644 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12647 * BIOS auto configuration
12649 static int alc268_parse_auto_config(struct hda_codec *codec)
12651 struct alc_spec *spec = codec->spec;
12653 static hda_nid_t alc268_ignore[] = { 0 };
12655 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12659 if (!spec->autocfg.line_outs) {
12660 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12661 spec->multiout.max_channels = 2;
12662 spec->no_analog = 1;
12665 return 0; /* can't find valid BIOS pin config */
12667 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12670 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12674 spec->multiout.max_channels = 2;
12677 /* digital only support output */
12678 if (spec->autocfg.dig_outs) {
12679 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12680 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12682 if (spec->kctls.list)
12683 add_mixer(spec, spec->kctls.list);
12685 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12686 add_mixer(spec, alc268_beep_mixer);
12688 add_verb(spec, alc268_volume_init_verbs);
12689 spec->num_mux_defs = 2;
12690 spec->input_mux = &spec->private_imux[0];
12692 err = alc_auto_add_mic_boost(codec);
12696 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12701 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12703 /* init callback for auto-configuration model -- overriding the default init */
12704 static void alc268_auto_init(struct hda_codec *codec)
12706 struct alc_spec *spec = codec->spec;
12707 alc268_auto_init_multi_out(codec);
12708 alc268_auto_init_hp_out(codec);
12709 alc268_auto_init_mono_speaker_out(codec);
12710 alc268_auto_init_analog_input(codec);
12711 if (spec->unsol_event)
12712 alc_inithook(codec);
12716 * configuration and preset
12718 static const char *alc268_models[ALC268_MODEL_LAST] = {
12719 [ALC267_QUANTA_IL1] = "quanta-il1",
12720 [ALC268_3ST] = "3stack",
12721 [ALC268_TOSHIBA] = "toshiba",
12722 [ALC268_ACER] = "acer",
12723 [ALC268_ACER_DMIC] = "acer-dmic",
12724 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12725 [ALC268_DELL] = "dell",
12726 [ALC268_ZEPTO] = "zepto",
12727 #ifdef CONFIG_SND_DEBUG
12728 [ALC268_TEST] = "test",
12730 [ALC268_AUTO] = "auto",
12733 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12734 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12735 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12736 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12737 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12738 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12739 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12740 ALC268_ACER_ASPIRE_ONE),
12741 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12742 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12743 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12744 /* almost compatible with toshiba but with optional digital outs;
12745 * auto-probing seems working fine
12747 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12749 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12750 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12751 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12752 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12753 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12754 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12758 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12759 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12760 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12761 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12762 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12767 static struct alc_config_preset alc268_presets[] = {
12768 [ALC267_QUANTA_IL1] = {
12769 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12770 alc268_capture_nosrc_mixer },
12771 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12772 alc267_quanta_il1_verbs },
12773 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12774 .dac_nids = alc268_dac_nids,
12775 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12776 .adc_nids = alc268_adc_nids_alt,
12778 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12779 .channel_mode = alc268_modes,
12780 .unsol_event = alc_sku_unsol_event,
12781 .setup = alc267_quanta_il1_setup,
12782 .init_hook = alc_inithook,
12785 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12786 alc268_beep_mixer },
12787 .init_verbs = { alc268_base_init_verbs },
12788 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12789 .dac_nids = alc268_dac_nids,
12790 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12791 .adc_nids = alc268_adc_nids_alt,
12792 .capsrc_nids = alc268_capsrc_nids,
12794 .dig_out_nid = ALC268_DIGOUT_NID,
12795 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12796 .channel_mode = alc268_modes,
12797 .input_mux = &alc268_capture_source,
12799 [ALC268_TOSHIBA] = {
12800 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12801 alc268_beep_mixer },
12802 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12803 alc268_toshiba_verbs },
12804 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12805 .dac_nids = alc268_dac_nids,
12806 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12807 .adc_nids = alc268_adc_nids_alt,
12808 .capsrc_nids = alc268_capsrc_nids,
12810 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12811 .channel_mode = alc268_modes,
12812 .input_mux = &alc268_capture_source,
12813 .unsol_event = alc268_toshiba_unsol_event,
12814 .setup = alc268_toshiba_setup,
12815 .init_hook = alc268_toshiba_automute,
12818 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12819 alc268_beep_mixer },
12820 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12821 alc268_acer_verbs },
12822 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12823 .dac_nids = alc268_dac_nids,
12824 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12825 .adc_nids = alc268_adc_nids_alt,
12826 .capsrc_nids = alc268_capsrc_nids,
12828 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12829 .channel_mode = alc268_modes,
12830 .input_mux = &alc268_acer_capture_source,
12831 .unsol_event = alc268_acer_unsol_event,
12832 .init_hook = alc268_acer_init_hook,
12834 [ALC268_ACER_DMIC] = {
12835 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12836 alc268_beep_mixer },
12837 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12838 alc268_acer_verbs },
12839 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12840 .dac_nids = alc268_dac_nids,
12841 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12842 .adc_nids = alc268_adc_nids_alt,
12843 .capsrc_nids = alc268_capsrc_nids,
12845 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12846 .channel_mode = alc268_modes,
12847 .input_mux = &alc268_acer_dmic_capture_source,
12848 .unsol_event = alc268_acer_unsol_event,
12849 .init_hook = alc268_acer_init_hook,
12851 [ALC268_ACER_ASPIRE_ONE] = {
12852 .mixers = { alc268_acer_aspire_one_mixer,
12854 alc268_capture_nosrc_mixer },
12855 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12856 alc268_acer_aspire_one_verbs },
12857 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12858 .dac_nids = alc268_dac_nids,
12859 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12860 .adc_nids = alc268_adc_nids_alt,
12861 .capsrc_nids = alc268_capsrc_nids,
12863 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12864 .channel_mode = alc268_modes,
12865 .unsol_event = alc268_acer_lc_unsol_event,
12866 .setup = alc268_acer_lc_setup,
12867 .init_hook = alc268_acer_lc_init_hook,
12870 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12871 alc268_capture_nosrc_mixer },
12872 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12873 alc268_dell_verbs },
12874 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12875 .dac_nids = alc268_dac_nids,
12876 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12877 .adc_nids = alc268_adc_nids_alt,
12878 .capsrc_nids = alc268_capsrc_nids,
12880 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12881 .channel_mode = alc268_modes,
12882 .unsol_event = alc_sku_unsol_event,
12883 .setup = alc268_dell_setup,
12884 .init_hook = alc_inithook,
12887 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12888 alc268_beep_mixer },
12889 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12890 alc268_toshiba_verbs },
12891 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12892 .dac_nids = alc268_dac_nids,
12893 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12894 .adc_nids = alc268_adc_nids_alt,
12895 .capsrc_nids = alc268_capsrc_nids,
12897 .dig_out_nid = ALC268_DIGOUT_NID,
12898 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12899 .channel_mode = alc268_modes,
12900 .input_mux = &alc268_capture_source,
12901 .setup = alc268_toshiba_setup,
12902 .init_hook = alc268_toshiba_automute,
12904 #ifdef CONFIG_SND_DEBUG
12906 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12907 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12908 alc268_volume_init_verbs },
12909 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12910 .dac_nids = alc268_dac_nids,
12911 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12912 .adc_nids = alc268_adc_nids_alt,
12913 .capsrc_nids = alc268_capsrc_nids,
12915 .dig_out_nid = ALC268_DIGOUT_NID,
12916 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12917 .channel_mode = alc268_modes,
12918 .input_mux = &alc268_capture_source,
12923 static int patch_alc268(struct hda_codec *codec)
12925 struct alc_spec *spec;
12927 int i, has_beep, err;
12929 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12933 codec->spec = spec;
12935 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12939 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12940 board_config = snd_hda_check_board_codec_sid_config(codec,
12941 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12943 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12944 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12946 board_config = ALC268_AUTO;
12949 if (board_config == ALC268_AUTO) {
12950 /* automatic parse from the BIOS config */
12951 err = alc268_parse_auto_config(codec);
12957 "hda_codec: Cannot set up configuration "
12958 "from BIOS. Using base mode...\n");
12959 board_config = ALC268_3ST;
12963 if (board_config != ALC268_AUTO)
12964 setup_preset(codec, &alc268_presets[board_config]);
12966 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12967 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12968 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12970 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12973 for (i = 0; i < spec->num_mixers; i++) {
12974 if (spec->mixers[i] == alc268_beep_mixer) {
12981 err = snd_hda_attach_beep_device(codec, 0x1);
12986 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12987 /* override the amp caps for beep generator */
12988 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12989 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12990 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12991 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12992 (0 << AC_AMPCAP_MUTE_SHIFT));
12995 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12996 /* check whether NID 0x07 is valid */
12997 unsigned int wcap = get_wcaps(codec, 0x07);
13000 spec->capsrc_nids = alc268_capsrc_nids;
13002 wcap = get_wcaps_type(wcap);
13003 if (spec->auto_mic ||
13004 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13005 spec->adc_nids = alc268_adc_nids_alt;
13006 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13007 if (spec->auto_mic)
13008 fixup_automic_adc(codec);
13009 if (spec->auto_mic || spec->input_mux->num_items == 1)
13010 add_mixer(spec, alc268_capture_nosrc_mixer);
13012 add_mixer(spec, alc268_capture_alt_mixer);
13014 spec->adc_nids = alc268_adc_nids;
13015 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13016 add_mixer(spec, alc268_capture_mixer);
13018 /* set default input source */
13019 for (i = 0; i < spec->num_adc_nids; i++)
13020 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13021 0, AC_VERB_SET_CONNECT_SEL,
13022 i < spec->num_mux_defs ?
13023 spec->input_mux[i].items[0].index :
13024 spec->input_mux->items[0].index);
13027 spec->vmaster_nid = 0x02;
13029 codec->patch_ops = alc_patch_ops;
13030 if (board_config == ALC268_AUTO)
13031 spec->init_hook = alc268_auto_init;
13033 codec->proc_widget_hook = print_realtek_coef;
13039 * ALC269 channel source setting (2 channel)
13041 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13043 #define alc269_dac_nids alc260_dac_nids
13045 static hda_nid_t alc269_adc_nids[1] = {
13050 static hda_nid_t alc269_capsrc_nids[1] = {
13054 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13058 #define alc269_modes alc260_modes
13059 #define alc269_capture_source alc880_lg_lw_capture_source
13061 static struct snd_kcontrol_new alc269_base_mixer[] = {
13062 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13063 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13064 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13065 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13068 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13069 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13070 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13071 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13072 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13073 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13077 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13078 /* output mixer control */
13079 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13081 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13082 .name = "Master Playback Switch",
13083 .info = snd_hda_mixer_amp_switch_info,
13084 .get = snd_hda_mixer_amp_switch_get,
13085 .put = alc268_acer_master_sw_put,
13086 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13089 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13090 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13091 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13092 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13093 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13097 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13098 /* output mixer control */
13099 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13101 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13102 .name = "Master Playback Switch",
13103 .info = snd_hda_mixer_amp_switch_info,
13104 .get = snd_hda_mixer_amp_switch_get,
13105 .put = alc268_acer_master_sw_put,
13106 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13110 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13111 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13112 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13113 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13114 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13115 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13116 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13120 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13121 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13122 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13123 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13124 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13128 /* capture mixer elements */
13129 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13130 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13131 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13132 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13137 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13139 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13140 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13141 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13143 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13144 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13145 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13149 static struct hda_verb alc269_lifebook_verbs[] = {
13150 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13151 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13152 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13153 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13154 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13155 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13157 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13158 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13159 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13163 /* toggle speaker-output according to the hp-jack state */
13164 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13166 unsigned int present;
13167 unsigned char bits;
13169 present = snd_hda_jack_detect(codec, 0x15);
13170 bits = present ? AMP_IN_MUTE(0) : 0;
13171 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13172 AMP_IN_MUTE(0), bits);
13173 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13174 AMP_IN_MUTE(0), bits);
13176 snd_hda_codec_write(codec, 0x20, 0,
13177 AC_VERB_SET_COEF_INDEX, 0x0c);
13178 snd_hda_codec_write(codec, 0x20, 0,
13179 AC_VERB_SET_PROC_COEF, 0x680);
13181 snd_hda_codec_write(codec, 0x20, 0,
13182 AC_VERB_SET_COEF_INDEX, 0x0c);
13183 snd_hda_codec_write(codec, 0x20, 0,
13184 AC_VERB_SET_PROC_COEF, 0x480);
13187 /* toggle speaker-output according to the hp-jacks state */
13188 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13190 unsigned int present;
13191 unsigned char bits;
13193 /* Check laptop headphone socket */
13194 present = snd_hda_jack_detect(codec, 0x15);
13196 /* Check port replicator headphone socket */
13197 present |= snd_hda_jack_detect(codec, 0x1a);
13199 bits = present ? AMP_IN_MUTE(0) : 0;
13200 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13201 AMP_IN_MUTE(0), bits);
13202 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13203 AMP_IN_MUTE(0), bits);
13205 snd_hda_codec_write(codec, 0x20, 0,
13206 AC_VERB_SET_COEF_INDEX, 0x0c);
13207 snd_hda_codec_write(codec, 0x20, 0,
13208 AC_VERB_SET_PROC_COEF, 0x680);
13210 snd_hda_codec_write(codec, 0x20, 0,
13211 AC_VERB_SET_COEF_INDEX, 0x0c);
13212 snd_hda_codec_write(codec, 0x20, 0,
13213 AC_VERB_SET_PROC_COEF, 0x480);
13216 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13218 unsigned int present_laptop;
13219 unsigned int present_dock;
13221 present_laptop = snd_hda_jack_detect(codec, 0x18);
13222 present_dock = snd_hda_jack_detect(codec, 0x1b);
13224 /* Laptop mic port overrides dock mic port, design decision */
13226 snd_hda_codec_write(codec, 0x23, 0,
13227 AC_VERB_SET_CONNECT_SEL, 0x3);
13228 if (present_laptop)
13229 snd_hda_codec_write(codec, 0x23, 0,
13230 AC_VERB_SET_CONNECT_SEL, 0x0);
13231 if (!present_dock && !present_laptop)
13232 snd_hda_codec_write(codec, 0x23, 0,
13233 AC_VERB_SET_CONNECT_SEL, 0x1);
13236 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13239 switch (res >> 26) {
13240 case ALC880_HP_EVENT:
13241 alc269_quanta_fl1_speaker_automute(codec);
13243 case ALC880_MIC_EVENT:
13244 alc_mic_automute(codec);
13249 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13252 if ((res >> 26) == ALC880_HP_EVENT)
13253 alc269_lifebook_speaker_automute(codec);
13254 if ((res >> 26) == ALC880_MIC_EVENT)
13255 alc269_lifebook_mic_autoswitch(codec);
13258 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13260 struct alc_spec *spec = codec->spec;
13261 spec->ext_mic.pin = 0x18;
13262 spec->ext_mic.mux_idx = 0;
13263 spec->int_mic.pin = 0x19;
13264 spec->int_mic.mux_idx = 1;
13265 spec->auto_mic = 1;
13268 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13270 alc269_quanta_fl1_speaker_automute(codec);
13271 alc_mic_automute(codec);
13274 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13276 alc269_lifebook_speaker_automute(codec);
13277 alc269_lifebook_mic_autoswitch(codec);
13280 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13281 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13282 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13283 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13284 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13285 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13286 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13287 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13291 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13292 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13293 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13294 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13295 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13296 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13297 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13301 /* toggle speaker-output according to the hp-jack state */
13302 static void alc269_speaker_automute(struct hda_codec *codec)
13304 struct alc_spec *spec = codec->spec;
13305 unsigned int nid = spec->autocfg.hp_pins[0];
13306 unsigned int present;
13307 unsigned char bits;
13309 present = snd_hda_jack_detect(codec, nid);
13310 bits = present ? AMP_IN_MUTE(0) : 0;
13311 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13312 AMP_IN_MUTE(0), bits);
13313 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13314 AMP_IN_MUTE(0), bits);
13317 /* unsolicited event for HP jack sensing */
13318 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13321 switch (res >> 26) {
13322 case ALC880_HP_EVENT:
13323 alc269_speaker_automute(codec);
13325 case ALC880_MIC_EVENT:
13326 alc_mic_automute(codec);
13331 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13333 struct alc_spec *spec = codec->spec;
13334 spec->ext_mic.pin = 0x18;
13335 spec->ext_mic.mux_idx = 0;
13336 spec->int_mic.pin = 0x12;
13337 spec->int_mic.mux_idx = 5;
13338 spec->auto_mic = 1;
13341 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13343 struct alc_spec *spec = codec->spec;
13344 spec->ext_mic.pin = 0x18;
13345 spec->ext_mic.mux_idx = 0;
13346 spec->int_mic.pin = 0x19;
13347 spec->int_mic.mux_idx = 1;
13348 spec->auto_mic = 1;
13351 static void alc269_eeepc_inithook(struct hda_codec *codec)
13353 alc269_speaker_automute(codec);
13354 alc_mic_automute(codec);
13358 * generic initialization of ADC, input mixers and output mixers
13360 static struct hda_verb alc269_init_verbs[] = {
13362 * Unmute ADC0 and set the default input to mic-in
13364 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13366 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13367 * analog-loopback mixer widget
13368 * Note: PASD motherboards uses the Line In 2 as the input for
13369 * front panel mic (mic 2)
13371 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13373 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13374 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13379 * Set up output mixers (0x0c - 0x0e)
13381 /* set vol=0 to output mixers */
13382 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13383 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13385 /* set up input amps for analog loopback */
13386 /* Amp Indices: DAC = 0, mixer = 1 */
13387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13388 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13389 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13390 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13391 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13392 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13394 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13395 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13396 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13397 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13398 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13399 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13400 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13402 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13403 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13404 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13405 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13406 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13408 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13410 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13411 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13413 /* FIXME: use matrix-type input source selection */
13414 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13415 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13422 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13423 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13427 #define alc269_auto_create_multi_out_ctls \
13428 alc268_auto_create_multi_out_ctls
13429 #define alc269_auto_create_input_ctls \
13430 alc268_auto_create_input_ctls
13432 #ifdef CONFIG_SND_HDA_POWER_SAVE
13433 #define alc269_loopbacks alc880_loopbacks
13436 /* pcm configuration: identical with ALC880 */
13437 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13438 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13439 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13440 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13442 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13446 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13447 /* NID is set in alc_build_pcms */
13449 .open = alc880_playback_pcm_open,
13450 .prepare = alc880_playback_pcm_prepare,
13451 .cleanup = alc880_playback_pcm_cleanup
13455 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13459 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13460 /* NID is set in alc_build_pcms */
13464 * BIOS auto configuration
13466 static int alc269_parse_auto_config(struct hda_codec *codec)
13468 struct alc_spec *spec = codec->spec;
13470 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13472 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13477 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13480 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13484 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13486 if (spec->autocfg.dig_outs)
13487 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13489 if (spec->kctls.list)
13490 add_mixer(spec, spec->kctls.list);
13492 add_verb(spec, alc269_init_verbs);
13493 spec->num_mux_defs = 1;
13494 spec->input_mux = &spec->private_imux[0];
13495 /* set default input source */
13496 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13497 0, AC_VERB_SET_CONNECT_SEL,
13498 spec->input_mux->items[0].index);
13500 err = alc_auto_add_mic_boost(codec);
13504 if (!spec->cap_mixer && !spec->no_analog)
13505 set_capture_mixer(codec);
13507 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13512 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13513 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13514 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13517 /* init callback for auto-configuration model -- overriding the default init */
13518 static void alc269_auto_init(struct hda_codec *codec)
13520 struct alc_spec *spec = codec->spec;
13521 alc269_auto_init_multi_out(codec);
13522 alc269_auto_init_hp_out(codec);
13523 alc269_auto_init_analog_input(codec);
13524 if (spec->unsol_event)
13525 alc_inithook(codec);
13529 * configuration and preset
13531 static const char *alc269_models[ALC269_MODEL_LAST] = {
13532 [ALC269_BASIC] = "basic",
13533 [ALC269_QUANTA_FL1] = "quanta",
13534 [ALC269_ASUS_AMIC] = "asus-amic",
13535 [ALC269_ASUS_DMIC] = "asus-dmic",
13536 [ALC269_FUJITSU] = "fujitsu",
13537 [ALC269_LIFEBOOK] = "lifebook",
13538 [ALC269_AUTO] = "auto",
13541 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13542 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13543 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13545 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13546 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13547 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13548 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13549 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13550 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13551 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13552 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13553 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13554 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13555 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13556 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13557 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13558 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13559 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13560 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13561 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13562 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13563 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13564 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13565 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13566 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13567 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13568 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13569 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13570 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13571 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13572 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13573 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13575 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13577 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13578 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13579 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13580 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13584 static struct alc_config_preset alc269_presets[] = {
13586 .mixers = { alc269_base_mixer },
13587 .init_verbs = { alc269_init_verbs },
13588 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13589 .dac_nids = alc269_dac_nids,
13591 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13592 .channel_mode = alc269_modes,
13593 .input_mux = &alc269_capture_source,
13595 [ALC269_QUANTA_FL1] = {
13596 .mixers = { alc269_quanta_fl1_mixer },
13597 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13598 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13599 .dac_nids = alc269_dac_nids,
13601 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13602 .channel_mode = alc269_modes,
13603 .input_mux = &alc269_capture_source,
13604 .unsol_event = alc269_quanta_fl1_unsol_event,
13605 .setup = alc269_quanta_fl1_setup,
13606 .init_hook = alc269_quanta_fl1_init_hook,
13608 [ALC269_ASUS_AMIC] = {
13609 .mixers = { alc269_eeepc_mixer },
13610 .cap_mixer = alc269_epc_capture_mixer,
13611 .init_verbs = { alc269_init_verbs,
13612 alc269_eeepc_amic_init_verbs },
13613 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13614 .dac_nids = alc269_dac_nids,
13616 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13617 .channel_mode = alc269_modes,
13618 .unsol_event = alc269_eeepc_unsol_event,
13619 .setup = alc269_eeepc_amic_setup,
13620 .init_hook = alc269_eeepc_inithook,
13622 [ALC269_ASUS_DMIC] = {
13623 .mixers = { alc269_eeepc_mixer },
13624 .cap_mixer = alc269_epc_capture_mixer,
13625 .init_verbs = { alc269_init_verbs,
13626 alc269_eeepc_dmic_init_verbs },
13627 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13628 .dac_nids = alc269_dac_nids,
13630 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13631 .channel_mode = alc269_modes,
13632 .unsol_event = alc269_eeepc_unsol_event,
13633 .setup = alc269_eeepc_dmic_setup,
13634 .init_hook = alc269_eeepc_inithook,
13636 [ALC269_FUJITSU] = {
13637 .mixers = { alc269_fujitsu_mixer },
13638 .cap_mixer = alc269_epc_capture_mixer,
13639 .init_verbs = { alc269_init_verbs,
13640 alc269_eeepc_dmic_init_verbs },
13641 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13642 .dac_nids = alc269_dac_nids,
13644 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13645 .channel_mode = alc269_modes,
13646 .unsol_event = alc269_eeepc_unsol_event,
13647 .setup = alc269_eeepc_dmic_setup,
13648 .init_hook = alc269_eeepc_inithook,
13650 [ALC269_LIFEBOOK] = {
13651 .mixers = { alc269_lifebook_mixer },
13652 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13653 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13654 .dac_nids = alc269_dac_nids,
13656 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13657 .channel_mode = alc269_modes,
13658 .input_mux = &alc269_capture_source,
13659 .unsol_event = alc269_lifebook_unsol_event,
13660 .init_hook = alc269_lifebook_init_hook,
13664 static int patch_alc269(struct hda_codec *codec)
13666 struct alc_spec *spec;
13670 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13674 codec->spec = spec;
13676 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13678 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13679 kfree(codec->chip_name);
13680 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13681 if (!codec->chip_name) {
13687 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13691 if (board_config < 0) {
13692 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13694 board_config = ALC269_AUTO;
13697 if (board_config == ALC269_AUTO) {
13698 /* automatic parse from the BIOS config */
13699 err = alc269_parse_auto_config(codec);
13705 "hda_codec: Cannot set up configuration "
13706 "from BIOS. Using base mode...\n");
13707 board_config = ALC269_BASIC;
13711 err = snd_hda_attach_beep_device(codec, 0x1);
13717 if (board_config != ALC269_AUTO)
13718 setup_preset(codec, &alc269_presets[board_config]);
13720 if (codec->subsystem_id == 0x17aa3bf8) {
13721 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13722 * fix the sample rate of analog I/O to 44.1kHz
13724 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13725 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13727 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13728 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13730 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13731 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13733 spec->adc_nids = alc269_adc_nids;
13734 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13735 spec->capsrc_nids = alc269_capsrc_nids;
13736 if (!spec->cap_mixer)
13737 set_capture_mixer(codec);
13738 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13740 spec->vmaster_nid = 0x02;
13742 codec->patch_ops = alc_patch_ops;
13743 if (board_config == ALC269_AUTO)
13744 spec->init_hook = alc269_auto_init;
13745 #ifdef CONFIG_SND_HDA_POWER_SAVE
13746 if (!spec->loopback.amplist)
13747 spec->loopback.amplist = alc269_loopbacks;
13749 codec->proc_widget_hook = print_realtek_coef;
13755 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13759 * set the path ways for 2 channel output
13760 * need to set the codec line out and mic 1 pin widgets to inputs
13762 static struct hda_verb alc861_threestack_ch2_init[] = {
13763 /* set pin widget 1Ah (line in) for input */
13764 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13765 /* set pin widget 18h (mic1/2) for input, for mic also enable
13768 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13770 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13772 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13773 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13779 * need to set the codec line out and mic 1 pin widgets to outputs
13781 static struct hda_verb alc861_threestack_ch6_init[] = {
13782 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13783 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13784 /* set pin widget 18h (mic1) for output (CLFE)*/
13785 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13787 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13788 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13790 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13792 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13793 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13798 static struct hda_channel_mode alc861_threestack_modes[2] = {
13799 { 2, alc861_threestack_ch2_init },
13800 { 6, alc861_threestack_ch6_init },
13802 /* Set mic1 as input and unmute the mixer */
13803 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13804 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13805 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13808 /* Set mic1 as output and mute mixer */
13809 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13810 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13811 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13815 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13816 { 2, alc861_uniwill_m31_ch2_init },
13817 { 4, alc861_uniwill_m31_ch4_init },
13820 /* Set mic1 and line-in as input and unmute the mixer */
13821 static struct hda_verb alc861_asus_ch2_init[] = {
13822 /* set pin widget 1Ah (line in) for input */
13823 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13824 /* set pin widget 18h (mic1/2) for input, for mic also enable
13827 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13829 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13831 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13832 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13836 /* Set mic1 nad line-in as output and mute mixer */
13837 static struct hda_verb alc861_asus_ch6_init[] = {
13838 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13839 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13840 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13841 /* set pin widget 18h (mic1) for output (CLFE)*/
13842 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13843 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13844 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13845 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13847 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13849 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13850 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13855 static struct hda_channel_mode alc861_asus_modes[2] = {
13856 { 2, alc861_asus_ch2_init },
13857 { 6, alc861_asus_ch6_init },
13862 static struct snd_kcontrol_new alc861_base_mixer[] = {
13863 /* output mixer control */
13864 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13865 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13866 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13867 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13868 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13870 /*Input mixer control */
13871 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13872 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13873 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13874 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13875 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13876 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13878 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13879 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13880 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13885 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13886 /* output mixer control */
13887 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13888 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13889 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13890 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13891 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13893 /* Input mixer control */
13894 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13895 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13896 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13897 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13898 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13899 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13901 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13902 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13903 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13906 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13907 .name = "Channel Mode",
13908 .info = alc_ch_mode_info,
13909 .get = alc_ch_mode_get,
13910 .put = alc_ch_mode_put,
13911 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13916 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13917 /* output mixer control */
13918 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13919 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13920 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13925 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13926 /* output mixer control */
13927 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13928 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13929 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13930 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13931 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13933 /* Input mixer control */
13934 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13935 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13936 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13937 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13938 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13939 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13941 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13942 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13943 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13946 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13947 .name = "Channel Mode",
13948 .info = alc_ch_mode_info,
13949 .get = alc_ch_mode_get,
13950 .put = alc_ch_mode_put,
13951 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13956 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13957 /* output mixer control */
13958 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13959 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13960 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13961 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13962 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13964 /* Input mixer control */
13965 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13966 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13967 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13968 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13969 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13970 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13972 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13973 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13974 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13977 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13978 .name = "Channel Mode",
13979 .info = alc_ch_mode_info,
13980 .get = alc_ch_mode_get,
13981 .put = alc_ch_mode_put,
13982 .private_value = ARRAY_SIZE(alc861_asus_modes),
13987 /* additional mixer */
13988 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13989 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13990 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13995 * generic initialization of ADC, input mixers and output mixers
13997 static struct hda_verb alc861_base_init_verbs[] = {
13999 * Unmute ADC0 and set the default input to mic-in
14001 /* port-A for surround (rear panel) */
14002 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14003 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14004 /* port-B for mic-in (rear panel) with vref */
14005 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14006 /* port-C for line-in (rear panel) */
14007 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14008 /* port-D for Front */
14009 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14010 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14011 /* port-E for HP out (front panel) */
14012 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14013 /* route front PCM to HP */
14014 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14015 /* port-F for mic-in (front panel) with vref */
14016 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14017 /* port-G for CLFE (rear panel) */
14018 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14019 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14020 /* port-H for side (rear panel) */
14021 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14022 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14024 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14025 /* route front mic to ADC1*/
14026 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14027 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14029 /* Unmute DAC0~3 & spdif out*/
14030 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14031 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14032 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14033 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14034 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14036 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14037 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14038 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14039 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14040 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14042 /* Unmute Stereo Mixer 15 */
14043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14044 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14045 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14046 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14048 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14049 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14050 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14051 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14052 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14054 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14055 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14056 /* hp used DAC 3 (Front) */
14057 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14058 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14063 static struct hda_verb alc861_threestack_init_verbs[] = {
14065 * Unmute ADC0 and set the default input to mic-in
14067 /* port-A for surround (rear panel) */
14068 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14069 /* port-B for mic-in (rear panel) with vref */
14070 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14071 /* port-C for line-in (rear panel) */
14072 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14073 /* port-D for Front */
14074 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14075 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14076 /* port-E for HP out (front panel) */
14077 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14078 /* route front PCM to HP */
14079 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14080 /* port-F for mic-in (front panel) with vref */
14081 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14082 /* port-G for CLFE (rear panel) */
14083 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14084 /* port-H for side (rear panel) */
14085 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14087 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14088 /* route front mic to ADC1*/
14089 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14090 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14091 /* Unmute DAC0~3 & spdif out*/
14092 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14093 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14094 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14095 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14098 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14099 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14100 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14101 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14102 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14104 /* Unmute Stereo Mixer 15 */
14105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14107 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14110 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14111 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14112 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14113 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14114 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14115 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14116 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14117 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14118 /* hp used DAC 3 (Front) */
14119 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14120 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14124 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14126 * Unmute ADC0 and set the default input to mic-in
14128 /* port-A for surround (rear panel) */
14129 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14130 /* port-B for mic-in (rear panel) with vref */
14131 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14132 /* port-C for line-in (rear panel) */
14133 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14134 /* port-D for Front */
14135 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14136 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14137 /* port-E for HP out (front panel) */
14138 /* this has to be set to VREF80 */
14139 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14140 /* route front PCM to HP */
14141 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14142 /* port-F for mic-in (front panel) with vref */
14143 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14144 /* port-G for CLFE (rear panel) */
14145 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14146 /* port-H for side (rear panel) */
14147 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14149 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14150 /* route front mic to ADC1*/
14151 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14152 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14153 /* Unmute DAC0~3 & spdif out*/
14154 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14155 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14156 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14157 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14160 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14161 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14162 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14163 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14164 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14166 /* Unmute Stereo Mixer 15 */
14167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14168 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14169 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14170 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14172 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14173 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14174 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14175 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14176 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14177 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14178 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14179 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14180 /* hp used DAC 3 (Front) */
14181 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14182 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14186 static struct hda_verb alc861_asus_init_verbs[] = {
14188 * Unmute ADC0 and set the default input to mic-in
14190 /* port-A for surround (rear panel)
14191 * according to codec#0 this is the HP jack
14193 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14194 /* route front PCM to HP */
14195 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14196 /* port-B for mic-in (rear panel) with vref */
14197 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14198 /* port-C for line-in (rear panel) */
14199 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14200 /* port-D for Front */
14201 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14202 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14203 /* port-E for HP out (front panel) */
14204 /* this has to be set to VREF80 */
14205 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14206 /* route front PCM to HP */
14207 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14208 /* port-F for mic-in (front panel) with vref */
14209 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14210 /* port-G for CLFE (rear panel) */
14211 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14212 /* port-H for side (rear panel) */
14213 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14215 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14216 /* route front mic to ADC1*/
14217 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14218 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14219 /* Unmute DAC0~3 & spdif out*/
14220 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14221 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14222 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14223 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14224 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14225 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14226 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14227 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14228 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14229 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14231 /* Unmute Stereo Mixer 15 */
14232 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14233 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14234 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14235 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14237 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14238 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14239 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14240 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14241 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14242 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14243 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14244 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14245 /* hp used DAC 3 (Front) */
14246 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14247 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14251 /* additional init verbs for ASUS laptops */
14252 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14253 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14254 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14259 * generic initialization of ADC, input mixers and output mixers
14261 static struct hda_verb alc861_auto_init_verbs[] = {
14263 * Unmute ADC0 and set the default input to mic-in
14265 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14266 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14268 /* Unmute DAC0~3 & spdif out*/
14269 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14270 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14271 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14272 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14275 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14276 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14277 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14278 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14279 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14281 /* Unmute Stereo Mixer 15 */
14282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14287 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14288 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14289 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14290 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14293 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14296 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14298 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14299 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14300 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14301 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14302 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14303 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14305 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14310 static struct hda_verb alc861_toshiba_init_verbs[] = {
14311 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14316 /* toggle speaker-output according to the hp-jack state */
14317 static void alc861_toshiba_automute(struct hda_codec *codec)
14319 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14321 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14322 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14323 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14324 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14327 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14330 if ((res >> 26) == ALC880_HP_EVENT)
14331 alc861_toshiba_automute(codec);
14334 /* pcm configuration: identical with ALC880 */
14335 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14336 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14337 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14338 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14341 #define ALC861_DIGOUT_NID 0x07
14343 static struct hda_channel_mode alc861_8ch_modes[1] = {
14347 static hda_nid_t alc861_dac_nids[4] = {
14348 /* front, surround, clfe, side */
14349 0x03, 0x06, 0x05, 0x04
14352 static hda_nid_t alc660_dac_nids[3] = {
14353 /* front, clfe, surround */
14357 static hda_nid_t alc861_adc_nids[1] = {
14362 static struct hda_input_mux alc861_capture_source = {
14366 { "Front Mic", 0x3 },
14373 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14375 struct alc_spec *spec = codec->spec;
14376 hda_nid_t mix, srcs[5];
14379 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14381 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14384 for (i = 0; i < num; i++) {
14386 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14387 if (type != AC_WID_AUD_OUT)
14389 for (j = 0; j < spec->multiout.num_dacs; j++)
14390 if (spec->multiout.dac_nids[j] == srcs[i])
14392 if (j >= spec->multiout.num_dacs)
14398 /* fill in the dac_nids table from the parsed pin configuration */
14399 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14400 const struct auto_pin_cfg *cfg)
14402 struct alc_spec *spec = codec->spec;
14404 hda_nid_t nid, dac;
14406 spec->multiout.dac_nids = spec->private_dac_nids;
14407 for (i = 0; i < cfg->line_outs; i++) {
14408 nid = cfg->line_out_pins[i];
14409 dac = alc861_look_for_dac(codec, nid);
14412 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14417 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14418 hda_nid_t nid, unsigned int chs)
14420 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14421 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14424 /* add playback controls from the parsed DAC table */
14425 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14426 const struct auto_pin_cfg *cfg)
14428 struct alc_spec *spec = codec->spec;
14429 static const char *chname[4] = {
14430 "Front", "Surround", NULL /*CLFE*/, "Side"
14435 if (cfg->line_outs == 1) {
14436 const char *pfx = NULL;
14439 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14442 nid = spec->multiout.dac_nids[0];
14443 return alc861_create_out_sw(codec, pfx, nid, 3);
14447 for (i = 0; i < cfg->line_outs; i++) {
14448 nid = spec->multiout.dac_nids[i];
14453 err = alc861_create_out_sw(codec, "Center", nid, 1);
14456 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14460 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14468 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14470 struct alc_spec *spec = codec->spec;
14477 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14478 nid = alc861_look_for_dac(codec, pin);
14480 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14483 spec->multiout.hp_nid = nid;
14489 /* create playback/capture controls for input pins */
14490 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14491 const struct auto_pin_cfg *cfg)
14493 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14496 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14498 int pin_type, hda_nid_t dac)
14500 hda_nid_t mix, srcs[5];
14503 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14505 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14507 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14509 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14512 for (i = 0; i < num; i++) {
14514 if (srcs[i] == dac || srcs[i] == 0x15)
14515 mute = AMP_IN_UNMUTE(i);
14517 mute = AMP_IN_MUTE(i);
14518 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14523 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14525 struct alc_spec *spec = codec->spec;
14528 for (i = 0; i < spec->autocfg.line_outs; i++) {
14529 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14530 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14532 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14533 spec->multiout.dac_nids[i]);
14537 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14539 struct alc_spec *spec = codec->spec;
14541 if (spec->autocfg.hp_outs)
14542 alc861_auto_set_output_and_unmute(codec,
14543 spec->autocfg.hp_pins[0],
14545 spec->multiout.hp_nid);
14546 if (spec->autocfg.speaker_outs)
14547 alc861_auto_set_output_and_unmute(codec,
14548 spec->autocfg.speaker_pins[0],
14550 spec->multiout.dac_nids[0]);
14553 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14555 struct alc_spec *spec = codec->spec;
14558 for (i = 0; i < AUTO_PIN_LAST; i++) {
14559 hda_nid_t nid = spec->autocfg.input_pins[i];
14560 if (nid >= 0x0c && nid <= 0x11)
14561 alc_set_input_pin(codec, nid, i);
14565 /* parse the BIOS configuration and set up the alc_spec */
14566 /* return 1 if successful, 0 if the proper config is not found,
14567 * or a negative error code
14569 static int alc861_parse_auto_config(struct hda_codec *codec)
14571 struct alc_spec *spec = codec->spec;
14573 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14575 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14579 if (!spec->autocfg.line_outs)
14580 return 0; /* can't find valid BIOS pin config */
14582 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14585 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14588 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14591 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14595 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14597 if (spec->autocfg.dig_outs)
14598 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14600 if (spec->kctls.list)
14601 add_mixer(spec, spec->kctls.list);
14603 add_verb(spec, alc861_auto_init_verbs);
14605 spec->num_mux_defs = 1;
14606 spec->input_mux = &spec->private_imux[0];
14608 spec->adc_nids = alc861_adc_nids;
14609 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14610 set_capture_mixer(codec);
14612 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14617 /* additional initialization for auto-configuration model */
14618 static void alc861_auto_init(struct hda_codec *codec)
14620 struct alc_spec *spec = codec->spec;
14621 alc861_auto_init_multi_out(codec);
14622 alc861_auto_init_hp_out(codec);
14623 alc861_auto_init_analog_input(codec);
14624 if (spec->unsol_event)
14625 alc_inithook(codec);
14628 #ifdef CONFIG_SND_HDA_POWER_SAVE
14629 static struct hda_amp_list alc861_loopbacks[] = {
14630 { 0x15, HDA_INPUT, 0 },
14631 { 0x15, HDA_INPUT, 1 },
14632 { 0x15, HDA_INPUT, 2 },
14633 { 0x15, HDA_INPUT, 3 },
14640 * configuration and preset
14642 static const char *alc861_models[ALC861_MODEL_LAST] = {
14643 [ALC861_3ST] = "3stack",
14644 [ALC660_3ST] = "3stack-660",
14645 [ALC861_3ST_DIG] = "3stack-dig",
14646 [ALC861_6ST_DIG] = "6stack-dig",
14647 [ALC861_UNIWILL_M31] = "uniwill-m31",
14648 [ALC861_TOSHIBA] = "toshiba",
14649 [ALC861_ASUS] = "asus",
14650 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14651 [ALC861_AUTO] = "auto",
14654 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14655 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14656 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14657 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14658 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14659 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14660 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14661 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14662 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14663 * Any other models that need this preset?
14665 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14666 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14667 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14668 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14669 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14670 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14671 /* FIXME: the below seems conflict */
14672 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14673 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14674 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14678 static struct alc_config_preset alc861_presets[] = {
14680 .mixers = { alc861_3ST_mixer },
14681 .init_verbs = { alc861_threestack_init_verbs },
14682 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14683 .dac_nids = alc861_dac_nids,
14684 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14685 .channel_mode = alc861_threestack_modes,
14687 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14688 .adc_nids = alc861_adc_nids,
14689 .input_mux = &alc861_capture_source,
14691 [ALC861_3ST_DIG] = {
14692 .mixers = { alc861_base_mixer },
14693 .init_verbs = { alc861_threestack_init_verbs },
14694 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14695 .dac_nids = alc861_dac_nids,
14696 .dig_out_nid = ALC861_DIGOUT_NID,
14697 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14698 .channel_mode = alc861_threestack_modes,
14700 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14701 .adc_nids = alc861_adc_nids,
14702 .input_mux = &alc861_capture_source,
14704 [ALC861_6ST_DIG] = {
14705 .mixers = { alc861_base_mixer },
14706 .init_verbs = { alc861_base_init_verbs },
14707 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14708 .dac_nids = alc861_dac_nids,
14709 .dig_out_nid = ALC861_DIGOUT_NID,
14710 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14711 .channel_mode = alc861_8ch_modes,
14712 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14713 .adc_nids = alc861_adc_nids,
14714 .input_mux = &alc861_capture_source,
14717 .mixers = { alc861_3ST_mixer },
14718 .init_verbs = { alc861_threestack_init_verbs },
14719 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14720 .dac_nids = alc660_dac_nids,
14721 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14722 .channel_mode = alc861_threestack_modes,
14724 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14725 .adc_nids = alc861_adc_nids,
14726 .input_mux = &alc861_capture_source,
14728 [ALC861_UNIWILL_M31] = {
14729 .mixers = { alc861_uniwill_m31_mixer },
14730 .init_verbs = { alc861_uniwill_m31_init_verbs },
14731 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14732 .dac_nids = alc861_dac_nids,
14733 .dig_out_nid = ALC861_DIGOUT_NID,
14734 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14735 .channel_mode = alc861_uniwill_m31_modes,
14737 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14738 .adc_nids = alc861_adc_nids,
14739 .input_mux = &alc861_capture_source,
14741 [ALC861_TOSHIBA] = {
14742 .mixers = { alc861_toshiba_mixer },
14743 .init_verbs = { alc861_base_init_verbs,
14744 alc861_toshiba_init_verbs },
14745 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14746 .dac_nids = alc861_dac_nids,
14747 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14748 .channel_mode = alc883_3ST_2ch_modes,
14749 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14750 .adc_nids = alc861_adc_nids,
14751 .input_mux = &alc861_capture_source,
14752 .unsol_event = alc861_toshiba_unsol_event,
14753 .init_hook = alc861_toshiba_automute,
14756 .mixers = { alc861_asus_mixer },
14757 .init_verbs = { alc861_asus_init_verbs },
14758 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14759 .dac_nids = alc861_dac_nids,
14760 .dig_out_nid = ALC861_DIGOUT_NID,
14761 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14762 .channel_mode = alc861_asus_modes,
14765 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14766 .adc_nids = alc861_adc_nids,
14767 .input_mux = &alc861_capture_source,
14769 [ALC861_ASUS_LAPTOP] = {
14770 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14771 .init_verbs = { alc861_asus_init_verbs,
14772 alc861_asus_laptop_init_verbs },
14773 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14774 .dac_nids = alc861_dac_nids,
14775 .dig_out_nid = ALC861_DIGOUT_NID,
14776 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14777 .channel_mode = alc883_3ST_2ch_modes,
14779 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14780 .adc_nids = alc861_adc_nids,
14781 .input_mux = &alc861_capture_source,
14785 /* Pin config fixes */
14787 PINFIX_FSC_AMILO_PI1505,
14790 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14791 { 0x0b, 0x0221101f }, /* HP */
14792 { 0x0f, 0x90170310 }, /* speaker */
14796 static const struct alc_fixup alc861_fixups[] = {
14797 [PINFIX_FSC_AMILO_PI1505] = {
14798 .pins = alc861_fsc_amilo_pi1505_pinfix
14802 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14803 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14807 static int patch_alc861(struct hda_codec *codec)
14809 struct alc_spec *spec;
14813 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14817 codec->spec = spec;
14819 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14823 if (board_config < 0) {
14824 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14826 board_config = ALC861_AUTO;
14829 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14831 if (board_config == ALC861_AUTO) {
14832 /* automatic parse from the BIOS config */
14833 err = alc861_parse_auto_config(codec);
14839 "hda_codec: Cannot set up configuration "
14840 "from BIOS. Using base mode...\n");
14841 board_config = ALC861_3ST_DIG;
14845 err = snd_hda_attach_beep_device(codec, 0x23);
14851 if (board_config != ALC861_AUTO)
14852 setup_preset(codec, &alc861_presets[board_config]);
14854 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14855 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14857 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14858 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14860 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14862 spec->vmaster_nid = 0x03;
14864 codec->patch_ops = alc_patch_ops;
14865 if (board_config == ALC861_AUTO)
14866 spec->init_hook = alc861_auto_init;
14867 #ifdef CONFIG_SND_HDA_POWER_SAVE
14868 if (!spec->loopback.amplist)
14869 spec->loopback.amplist = alc861_loopbacks;
14871 codec->proc_widget_hook = print_realtek_coef;
14877 * ALC861-VD support
14881 * In addition, an independent DAC
14883 #define ALC861VD_DIGOUT_NID 0x06
14885 static hda_nid_t alc861vd_dac_nids[4] = {
14886 /* front, surr, clfe, side surr */
14887 0x02, 0x03, 0x04, 0x05
14890 /* dac_nids for ALC660vd are in a different order - according to
14891 * Realtek's driver.
14892 * This should probably result in a different mixer for 6stack models
14893 * of ALC660vd codecs, but for now there is only 3stack mixer
14894 * - and it is the same as in 861vd.
14895 * adc_nids in ALC660vd are (is) the same as in 861vd
14897 static hda_nid_t alc660vd_dac_nids[3] = {
14898 /* front, rear, clfe, rear_surr */
14902 static hda_nid_t alc861vd_adc_nids[1] = {
14907 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14910 /* FIXME: should be a matrix-type input source selection */
14911 static struct hda_input_mux alc861vd_capture_source = {
14915 { "Front Mic", 0x1 },
14921 static struct hda_input_mux alc861vd_dallas_capture_source = {
14924 { "Ext Mic", 0x0 },
14925 { "Int Mic", 0x1 },
14929 static struct hda_input_mux alc861vd_hp_capture_source = {
14932 { "Front Mic", 0x0 },
14933 { "ATAPI Mic", 0x1 },
14940 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14947 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14948 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14949 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14950 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14951 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14958 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14959 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14960 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14961 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14962 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14966 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14967 { 6, alc861vd_6stack_ch6_init },
14968 { 8, alc861vd_6stack_ch8_init },
14971 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14973 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14974 .name = "Channel Mode",
14975 .info = alc_ch_mode_info,
14976 .get = alc_ch_mode_get,
14977 .put = alc_ch_mode_put,
14982 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14983 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14985 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14986 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14987 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14989 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14990 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14992 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14994 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14996 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14997 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14999 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15000 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15002 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15004 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15008 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15009 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15010 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15012 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15013 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15015 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15016 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15021 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15022 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15023 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15025 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15031 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15032 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15033 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15035 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15036 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15038 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15039 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15044 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15045 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15046 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15047 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15051 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15055 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15056 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15057 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15059 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15060 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15065 /* Pin assignment: Speaker=0x14, HP = 0x15,
15066 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15068 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15069 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15070 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15071 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15072 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15073 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15074 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15075 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15076 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15077 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15078 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15082 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15083 * Front Mic=0x18, ATAPI Mic = 0x19,
15085 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15086 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15087 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15088 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15089 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15090 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15091 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15092 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15093 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15099 * generic initialization of ADC, input mixers and output mixers
15101 static struct hda_verb alc861vd_volume_init_verbs[] = {
15103 * Unmute ADC0 and set the default input to mic-in
15105 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15108 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15109 * the analog-loopback mixer widget
15111 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15118 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15125 * Set up output mixers (0x02 - 0x05)
15127 /* set vol=0 to output mixers */
15128 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15129 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15130 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15131 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15133 /* set up input amps for analog loopback */
15134 /* Amp Indices: DAC = 0, mixer = 1 */
15135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15136 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15138 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15141 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15142 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15148 * 3-stack pin configuration:
15149 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15151 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15153 * Set pin mode and muting
15155 /* set front pin widgets 0x14 for output */
15156 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15157 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15158 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15160 /* Mic (rear) pin: input vref at 80% */
15161 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15162 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15163 /* Front Mic pin: input vref at 80% */
15164 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15165 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15166 /* Line In pin: input */
15167 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15168 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15169 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15170 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15171 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15172 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15173 /* CD pin widget for input */
15174 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15180 * 6-stack pin configuration:
15182 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15184 * Set pin mode and muting
15186 /* set front pin widgets 0x14 for output */
15187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15188 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15189 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15191 /* Rear Pin: output 1 (0x0d) */
15192 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15193 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15194 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15195 /* CLFE Pin: output 2 (0x0e) */
15196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15197 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15198 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15199 /* Side Pin: output 3 (0x0f) */
15200 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15201 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15202 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15204 /* Mic (rear) pin: input vref at 80% */
15205 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15207 /* Front Mic pin: input vref at 80% */
15208 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15209 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15210 /* Line In pin: input */
15211 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15213 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15215 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15216 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15217 /* CD pin widget for input */
15218 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15223 static struct hda_verb alc861vd_eapd_verbs[] = {
15224 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15228 static struct hda_verb alc660vd_eapd_verbs[] = {
15229 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15230 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15234 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15236 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15238 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15239 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15243 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15245 unsigned int present;
15246 unsigned char bits;
15248 present = snd_hda_jack_detect(codec, 0x18);
15249 bits = present ? HDA_AMP_MUTE : 0;
15251 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15252 HDA_AMP_MUTE, bits);
15255 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15257 struct alc_spec *spec = codec->spec;
15258 spec->autocfg.hp_pins[0] = 0x1b;
15259 spec->autocfg.speaker_pins[0] = 0x14;
15262 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15264 alc_automute_amp(codec);
15265 alc861vd_lenovo_mic_automute(codec);
15268 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15271 switch (res >> 26) {
15272 case ALC880_MIC_EVENT:
15273 alc861vd_lenovo_mic_automute(codec);
15276 alc_automute_amp_unsol_event(codec, res);
15281 static struct hda_verb alc861vd_dallas_verbs[] = {
15282 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15283 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15284 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15285 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15289 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15290 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15291 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15293 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15294 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15296 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15297 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15298 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15299 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15300 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15301 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15302 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15303 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15307 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15308 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15309 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15310 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15311 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15312 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15319 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15320 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15326 /* toggle speaker-output according to the hp-jack state */
15327 static void alc861vd_dallas_setup(struct hda_codec *codec)
15329 struct alc_spec *spec = codec->spec;
15331 spec->autocfg.hp_pins[0] = 0x15;
15332 spec->autocfg.speaker_pins[0] = 0x14;
15335 #ifdef CONFIG_SND_HDA_POWER_SAVE
15336 #define alc861vd_loopbacks alc880_loopbacks
15339 /* pcm configuration: identical with ALC880 */
15340 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15341 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15342 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15343 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15346 * configuration and preset
15348 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15349 [ALC660VD_3ST] = "3stack-660",
15350 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15351 [ALC660VD_ASUS_V1S] = "asus-v1s",
15352 [ALC861VD_3ST] = "3stack",
15353 [ALC861VD_3ST_DIG] = "3stack-digout",
15354 [ALC861VD_6ST_DIG] = "6stack-digout",
15355 [ALC861VD_LENOVO] = "lenovo",
15356 [ALC861VD_DALLAS] = "dallas",
15357 [ALC861VD_HP] = "hp",
15358 [ALC861VD_AUTO] = "auto",
15361 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15362 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15363 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15364 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15365 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15366 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15367 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15368 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15369 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15370 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15371 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15372 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15373 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15374 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15375 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15376 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15380 static struct alc_config_preset alc861vd_presets[] = {
15382 .mixers = { alc861vd_3st_mixer },
15383 .init_verbs = { alc861vd_volume_init_verbs,
15384 alc861vd_3stack_init_verbs },
15385 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15386 .dac_nids = alc660vd_dac_nids,
15387 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15388 .channel_mode = alc861vd_3stack_2ch_modes,
15389 .input_mux = &alc861vd_capture_source,
15391 [ALC660VD_3ST_DIG] = {
15392 .mixers = { alc861vd_3st_mixer },
15393 .init_verbs = { alc861vd_volume_init_verbs,
15394 alc861vd_3stack_init_verbs },
15395 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15396 .dac_nids = alc660vd_dac_nids,
15397 .dig_out_nid = ALC861VD_DIGOUT_NID,
15398 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15399 .channel_mode = alc861vd_3stack_2ch_modes,
15400 .input_mux = &alc861vd_capture_source,
15403 .mixers = { alc861vd_3st_mixer },
15404 .init_verbs = { alc861vd_volume_init_verbs,
15405 alc861vd_3stack_init_verbs },
15406 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15407 .dac_nids = alc861vd_dac_nids,
15408 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15409 .channel_mode = alc861vd_3stack_2ch_modes,
15410 .input_mux = &alc861vd_capture_source,
15412 [ALC861VD_3ST_DIG] = {
15413 .mixers = { alc861vd_3st_mixer },
15414 .init_verbs = { alc861vd_volume_init_verbs,
15415 alc861vd_3stack_init_verbs },
15416 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15417 .dac_nids = alc861vd_dac_nids,
15418 .dig_out_nid = ALC861VD_DIGOUT_NID,
15419 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15420 .channel_mode = alc861vd_3stack_2ch_modes,
15421 .input_mux = &alc861vd_capture_source,
15423 [ALC861VD_6ST_DIG] = {
15424 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15425 .init_verbs = { alc861vd_volume_init_verbs,
15426 alc861vd_6stack_init_verbs },
15427 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15428 .dac_nids = alc861vd_dac_nids,
15429 .dig_out_nid = ALC861VD_DIGOUT_NID,
15430 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15431 .channel_mode = alc861vd_6stack_modes,
15432 .input_mux = &alc861vd_capture_source,
15434 [ALC861VD_LENOVO] = {
15435 .mixers = { alc861vd_lenovo_mixer },
15436 .init_verbs = { alc861vd_volume_init_verbs,
15437 alc861vd_3stack_init_verbs,
15438 alc861vd_eapd_verbs,
15439 alc861vd_lenovo_unsol_verbs },
15440 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15441 .dac_nids = alc660vd_dac_nids,
15442 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15443 .channel_mode = alc861vd_3stack_2ch_modes,
15444 .input_mux = &alc861vd_capture_source,
15445 .unsol_event = alc861vd_lenovo_unsol_event,
15446 .setup = alc861vd_lenovo_setup,
15447 .init_hook = alc861vd_lenovo_init_hook,
15449 [ALC861VD_DALLAS] = {
15450 .mixers = { alc861vd_dallas_mixer },
15451 .init_verbs = { alc861vd_dallas_verbs },
15452 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15453 .dac_nids = alc861vd_dac_nids,
15454 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15455 .channel_mode = alc861vd_3stack_2ch_modes,
15456 .input_mux = &alc861vd_dallas_capture_source,
15457 .unsol_event = alc_automute_amp_unsol_event,
15458 .setup = alc861vd_dallas_setup,
15459 .init_hook = alc_automute_amp,
15462 .mixers = { alc861vd_hp_mixer },
15463 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15464 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15465 .dac_nids = alc861vd_dac_nids,
15466 .dig_out_nid = ALC861VD_DIGOUT_NID,
15467 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15468 .channel_mode = alc861vd_3stack_2ch_modes,
15469 .input_mux = &alc861vd_hp_capture_source,
15470 .unsol_event = alc_automute_amp_unsol_event,
15471 .setup = alc861vd_dallas_setup,
15472 .init_hook = alc_automute_amp,
15474 [ALC660VD_ASUS_V1S] = {
15475 .mixers = { alc861vd_lenovo_mixer },
15476 .init_verbs = { alc861vd_volume_init_verbs,
15477 alc861vd_3stack_init_verbs,
15478 alc861vd_eapd_verbs,
15479 alc861vd_lenovo_unsol_verbs },
15480 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15481 .dac_nids = alc660vd_dac_nids,
15482 .dig_out_nid = ALC861VD_DIGOUT_NID,
15483 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15484 .channel_mode = alc861vd_3stack_2ch_modes,
15485 .input_mux = &alc861vd_capture_source,
15486 .unsol_event = alc861vd_lenovo_unsol_event,
15487 .setup = alc861vd_lenovo_setup,
15488 .init_hook = alc861vd_lenovo_init_hook,
15493 * BIOS auto configuration
15495 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15496 const struct auto_pin_cfg *cfg)
15498 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15502 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15503 hda_nid_t nid, int pin_type, int dac_idx)
15505 alc_set_pin_output(codec, nid, pin_type);
15508 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15510 struct alc_spec *spec = codec->spec;
15513 for (i = 0; i <= HDA_SIDE; i++) {
15514 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15515 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15517 alc861vd_auto_set_output_and_unmute(codec, nid,
15523 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15525 struct alc_spec *spec = codec->spec;
15528 pin = spec->autocfg.hp_pins[0];
15529 if (pin) /* connect to front and use dac 0 */
15530 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15531 pin = spec->autocfg.speaker_pins[0];
15533 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15536 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15538 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15540 struct alc_spec *spec = codec->spec;
15543 for (i = 0; i < AUTO_PIN_LAST; i++) {
15544 hda_nid_t nid = spec->autocfg.input_pins[i];
15545 if (alc_is_input_pin(codec, nid)) {
15546 alc_set_input_pin(codec, nid, i);
15547 if (nid != ALC861VD_PIN_CD_NID &&
15548 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15549 snd_hda_codec_write(codec, nid, 0,
15550 AC_VERB_SET_AMP_GAIN_MUTE,
15556 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15558 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15559 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15561 /* add playback controls from the parsed DAC table */
15562 /* Based on ALC880 version. But ALC861VD has separate,
15563 * different NIDs for mute/unmute switch and volume control */
15564 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15565 const struct auto_pin_cfg *cfg)
15567 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15568 hda_nid_t nid_v, nid_s;
15571 for (i = 0; i < cfg->line_outs; i++) {
15572 if (!spec->multiout.dac_nids[i])
15574 nid_v = alc861vd_idx_to_mixer_vol(
15576 spec->multiout.dac_nids[i]));
15577 nid_s = alc861vd_idx_to_mixer_switch(
15579 spec->multiout.dac_nids[i]));
15583 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15585 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15589 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15591 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15595 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15597 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15601 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15603 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15609 if (cfg->line_outs == 1 &&
15610 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15617 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15618 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15622 if (cfg->line_outs == 1 &&
15623 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15625 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15626 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15635 /* add playback controls for speaker and HP outputs */
15636 /* Based on ALC880 version. But ALC861VD has separate,
15637 * different NIDs for mute/unmute switch and volume control */
15638 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15639 hda_nid_t pin, const char *pfx)
15641 hda_nid_t nid_v, nid_s;
15647 if (alc880_is_fixed_pin(pin)) {
15648 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15649 /* specify the DAC as the extra output */
15650 if (!spec->multiout.hp_nid)
15651 spec->multiout.hp_nid = nid_v;
15653 spec->multiout.extra_out_nid[0] = nid_v;
15654 /* control HP volume/switch on the output mixer amp */
15655 nid_v = alc861vd_idx_to_mixer_vol(
15656 alc880_fixed_pin_idx(pin));
15657 nid_s = alc861vd_idx_to_mixer_switch(
15658 alc880_fixed_pin_idx(pin));
15660 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15661 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15664 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15665 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15668 } else if (alc880_is_multi_pin(pin)) {
15669 /* set manual connection */
15670 /* we have only a switch on HP-out PIN */
15671 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15672 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15679 /* parse the BIOS configuration and set up the alc_spec
15680 * return 1 if successful, 0 if the proper config is not found,
15681 * or a negative error code
15682 * Based on ALC880 version - had to change it to override
15683 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15684 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15686 struct alc_spec *spec = codec->spec;
15688 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15690 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15694 if (!spec->autocfg.line_outs)
15695 return 0; /* can't find valid BIOS pin config */
15697 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15700 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15703 err = alc861vd_auto_create_extra_out(spec,
15704 spec->autocfg.speaker_pins[0],
15708 err = alc861vd_auto_create_extra_out(spec,
15709 spec->autocfg.hp_pins[0],
15713 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15717 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15719 if (spec->autocfg.dig_outs)
15720 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15722 if (spec->kctls.list)
15723 add_mixer(spec, spec->kctls.list);
15725 add_verb(spec, alc861vd_volume_init_verbs);
15727 spec->num_mux_defs = 1;
15728 spec->input_mux = &spec->private_imux[0];
15730 err = alc_auto_add_mic_boost(codec);
15734 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15739 /* additional initialization for auto-configuration model */
15740 static void alc861vd_auto_init(struct hda_codec *codec)
15742 struct alc_spec *spec = codec->spec;
15743 alc861vd_auto_init_multi_out(codec);
15744 alc861vd_auto_init_hp_out(codec);
15745 alc861vd_auto_init_analog_input(codec);
15746 alc861vd_auto_init_input_src(codec);
15747 if (spec->unsol_event)
15748 alc_inithook(codec);
15752 ALC660VD_FIX_ASUS_GPIO1
15756 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15757 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15758 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15759 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15763 static const struct alc_fixup alc861vd_fixups[] = {
15764 [ALC660VD_FIX_ASUS_GPIO1] = {
15765 .verbs = alc660vd_fix_asus_gpio1_verbs,
15769 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15770 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15774 static int patch_alc861vd(struct hda_codec *codec)
15776 struct alc_spec *spec;
15777 int err, board_config;
15779 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15783 codec->spec = spec;
15785 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15789 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15790 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15792 board_config = ALC861VD_AUTO;
15795 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15797 if (board_config == ALC861VD_AUTO) {
15798 /* automatic parse from the BIOS config */
15799 err = alc861vd_parse_auto_config(codec);
15805 "hda_codec: Cannot set up configuration "
15806 "from BIOS. Using base mode...\n");
15807 board_config = ALC861VD_3ST;
15811 err = snd_hda_attach_beep_device(codec, 0x23);
15817 if (board_config != ALC861VD_AUTO)
15818 setup_preset(codec, &alc861vd_presets[board_config]);
15820 if (codec->vendor_id == 0x10ec0660) {
15821 /* always turn on EAPD */
15822 add_verb(spec, alc660vd_eapd_verbs);
15825 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15826 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15828 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15829 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15831 if (!spec->adc_nids) {
15832 spec->adc_nids = alc861vd_adc_nids;
15833 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15835 if (!spec->capsrc_nids)
15836 spec->capsrc_nids = alc861vd_capsrc_nids;
15838 set_capture_mixer(codec);
15839 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15841 spec->vmaster_nid = 0x02;
15843 codec->patch_ops = alc_patch_ops;
15845 if (board_config == ALC861VD_AUTO)
15846 spec->init_hook = alc861vd_auto_init;
15847 #ifdef CONFIG_SND_HDA_POWER_SAVE
15848 if (!spec->loopback.amplist)
15849 spec->loopback.amplist = alc861vd_loopbacks;
15851 codec->proc_widget_hook = print_realtek_coef;
15859 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15860 * configuration. Each pin widget can choose any input DACs and a mixer.
15861 * Each ADC is connected from a mixer of all inputs. This makes possible
15862 * 6-channel independent captures.
15864 * In addition, an independent DAC for the multi-playback (not used in this
15867 #define ALC662_DIGOUT_NID 0x06
15868 #define ALC662_DIGIN_NID 0x0a
15870 static hda_nid_t alc662_dac_nids[4] = {
15871 /* front, rear, clfe, rear_surr */
15875 static hda_nid_t alc272_dac_nids[2] = {
15879 static hda_nid_t alc662_adc_nids[2] = {
15884 static hda_nid_t alc272_adc_nids[1] = {
15889 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15890 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15894 /* FIXME: should be a matrix-type input source selection */
15895 static struct hda_input_mux alc662_capture_source = {
15899 { "Front Mic", 0x1 },
15905 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15913 static struct hda_input_mux alc663_capture_source = {
15917 { "Front Mic", 0x1 },
15922 #if 0 /* set to 1 for testing other input sources below */
15923 static struct hda_input_mux alc272_nc10_capture_source = {
15926 { "Autoselect Mic", 0x0 },
15927 { "Internal Mic", 0x1 },
15928 { "In-0x02", 0x2 },
15929 { "In-0x03", 0x3 },
15930 { "In-0x04", 0x4 },
15931 { "In-0x05", 0x5 },
15932 { "In-0x06", 0x6 },
15933 { "In-0x07", 0x7 },
15934 { "In-0x08", 0x8 },
15935 { "In-0x09", 0x9 },
15936 { "In-0x0a", 0x0a },
15937 { "In-0x0b", 0x0b },
15938 { "In-0x0c", 0x0c },
15939 { "In-0x0d", 0x0d },
15940 { "In-0x0e", 0x0e },
15941 { "In-0x0f", 0x0f },
15949 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15956 static struct hda_verb alc662_3ST_ch2_init[] = {
15957 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15958 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15959 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15960 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15967 static struct hda_verb alc662_3ST_ch6_init[] = {
15968 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15969 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15970 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15971 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15972 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15973 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15977 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15978 { 2, alc662_3ST_ch2_init },
15979 { 6, alc662_3ST_ch6_init },
15985 static struct hda_verb alc662_sixstack_ch6_init[] = {
15986 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15987 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15988 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15995 static struct hda_verb alc662_sixstack_ch8_init[] = {
15996 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15997 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15998 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16002 static struct hda_channel_mode alc662_5stack_modes[2] = {
16003 { 2, alc662_sixstack_ch6_init },
16004 { 6, alc662_sixstack_ch8_init },
16007 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16008 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16011 static struct snd_kcontrol_new alc662_base_mixer[] = {
16012 /* output mixer control */
16013 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16014 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16015 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16016 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16017 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16018 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16019 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16020 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16023 /*Input mixer control */
16024 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16025 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16026 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16027 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16028 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16029 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16035 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16036 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16037 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16038 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16039 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16040 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16042 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16045 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16046 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16050 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16051 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16052 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16053 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16054 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16055 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16056 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16057 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16058 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16060 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16061 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16062 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16063 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16066 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16071 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16072 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16073 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16074 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16075 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16076 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16077 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16078 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16084 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16085 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16086 ALC262_HIPPO_MASTER_SWITCH,
16088 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16089 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16090 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16092 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16093 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16094 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16098 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16099 ALC262_HIPPO_MASTER_SWITCH,
16100 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16101 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16102 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16103 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16104 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16105 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16106 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16112 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16113 .ops = &snd_hda_bind_vol,
16115 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16116 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16121 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16122 .ops = &snd_hda_bind_sw,
16124 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16125 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16130 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16131 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16132 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16138 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16139 .ops = &snd_hda_bind_sw,
16141 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16142 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16143 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16148 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16149 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16150 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16153 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16154 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16159 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16160 .ops = &snd_hda_bind_sw,
16162 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16163 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16164 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16169 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16170 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16171 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16174 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16175 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16179 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16180 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16181 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16185 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16186 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16190 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16191 .ops = &snd_hda_bind_vol,
16193 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16194 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16199 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16200 .ops = &snd_hda_bind_sw,
16202 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16203 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16208 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16209 HDA_BIND_VOL("Master Playback Volume",
16210 &alc663_asus_two_bind_master_vol),
16211 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16212 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16213 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16215 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16219 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16220 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16221 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16222 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16223 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16229 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16230 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16231 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16232 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16233 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16234 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16238 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16239 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16243 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16244 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16245 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16246 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16250 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16251 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16252 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16253 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16257 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16258 .ops = &snd_hda_bind_sw,
16260 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16261 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16262 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16263 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16264 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16269 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16270 .ops = &snd_hda_bind_sw,
16272 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16273 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16278 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16279 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16280 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16281 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16282 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16283 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16284 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16285 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16286 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16287 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16291 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16292 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16293 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16294 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16295 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16296 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16303 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16305 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16306 .name = "Channel Mode",
16307 .info = alc_ch_mode_info,
16308 .get = alc_ch_mode_get,
16309 .put = alc_ch_mode_put,
16314 static struct hda_verb alc662_init_verbs[] = {
16315 /* ADC: mute amp left and right */
16316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16317 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16318 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16330 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16331 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16333 /* Front Pin: output 0 (0x0c) */
16334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16335 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16337 /* Rear Pin: output 1 (0x0d) */
16338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16341 /* CLFE Pin: output 2 (0x0e) */
16342 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16343 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16345 /* Mic (rear) pin: input vref at 80% */
16346 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16347 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16348 /* Front Mic pin: input vref at 80% */
16349 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16350 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16351 /* Line In pin: input */
16352 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16353 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16354 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16355 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16356 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16357 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16358 /* CD pin widget for input */
16359 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16361 /* FIXME: use matrix-type input source selection */
16362 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16367 /* always trun on EAPD */
16368 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16369 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16374 static struct hda_verb alc662_sue_init_verbs[] = {
16375 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16376 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16380 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16381 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16382 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16386 /* Set Unsolicited Event*/
16387 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16388 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16389 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16394 * generic initialization of ADC, input mixers and output mixers
16396 static struct hda_verb alc662_auto_init_verbs[] = {
16398 * Unmute ADC and set the default input to mic-in
16400 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16401 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16403 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16405 * Note: PASD motherboards uses the Line In 2 as the input for front
16406 * panel mic (mic 2)
16408 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16409 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16410 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16411 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16413 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16416 * Set up output mixers (0x0c - 0x0f)
16418 /* set vol=0 to output mixers */
16419 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16420 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16421 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16423 /* set up input amps for analog loopback */
16424 /* Amp Indices: DAC = 0, mixer = 1 */
16425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16427 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16433 /* FIXME: use matrix-type input source selection */
16434 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16437 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16441 /* additional verbs for ALC663 */
16442 static struct hda_verb alc663_auto_init_verbs[] = {
16443 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16444 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16448 static struct hda_verb alc663_m51va_init_verbs[] = {
16449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16450 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16451 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16452 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16453 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16456 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16457 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16461 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16462 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16463 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16464 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16467 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16468 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16472 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16473 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16475 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16476 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16479 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16480 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16484 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16486 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16490 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16491 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16495 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16496 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16497 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16498 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16499 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16501 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16502 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16505 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16506 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16507 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16511 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16513 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16514 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16515 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16519 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16520 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16521 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16522 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16523 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16527 static struct hda_verb alc663_g71v_init_verbs[] = {
16528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16529 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16530 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16532 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16533 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16534 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16536 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16537 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16538 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16542 static struct hda_verb alc663_g50v_init_verbs[] = {
16543 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16544 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16545 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16547 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16548 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16552 static struct hda_verb alc662_ecs_init_verbs[] = {
16553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16555 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16556 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16560 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16561 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16562 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16563 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16564 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16565 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16566 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16567 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16570 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16571 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16575 static struct hda_verb alc272_dell_init_verbs[] = {
16576 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16577 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16579 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16580 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16581 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16582 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16583 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16584 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16585 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16586 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16590 static struct hda_verb alc663_mode7_init_verbs[] = {
16591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16592 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16593 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16594 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16596 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16597 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16598 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16599 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16600 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16603 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16604 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16605 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16609 static struct hda_verb alc663_mode8_init_verbs[] = {
16610 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16613 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16614 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16615 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16616 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16617 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16618 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16619 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16620 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
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 snd_kcontrol_new alc662_auto_capture_mixer[] = {
16630 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16631 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16635 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16636 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16637 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16641 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16643 unsigned int present;
16644 unsigned char bits;
16646 present = snd_hda_jack_detect(codec, 0x14);
16647 bits = present ? HDA_AMP_MUTE : 0;
16649 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16650 HDA_AMP_MUTE, bits);
16653 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16655 unsigned int present;
16656 unsigned char bits;
16658 present = snd_hda_jack_detect(codec, 0x1b);
16659 bits = present ? HDA_AMP_MUTE : 0;
16661 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16662 HDA_AMP_MUTE, bits);
16663 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16664 HDA_AMP_MUTE, bits);
16667 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16670 if ((res >> 26) == ALC880_HP_EVENT)
16671 alc662_lenovo_101e_all_automute(codec);
16672 if ((res >> 26) == ALC880_FRONT_EVENT)
16673 alc662_lenovo_101e_ispeaker_automute(codec);
16676 /* unsolicited event for HP jack sensing */
16677 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16680 if ((res >> 26) == ALC880_MIC_EVENT)
16681 alc_mic_automute(codec);
16683 alc262_hippo_unsol_event(codec, res);
16686 static void alc662_eeepc_setup(struct hda_codec *codec)
16688 struct alc_spec *spec = codec->spec;
16690 alc262_hippo1_setup(codec);
16691 spec->ext_mic.pin = 0x18;
16692 spec->ext_mic.mux_idx = 0;
16693 spec->int_mic.pin = 0x19;
16694 spec->int_mic.mux_idx = 1;
16695 spec->auto_mic = 1;
16698 static void alc662_eeepc_inithook(struct hda_codec *codec)
16700 alc262_hippo_automute(codec);
16701 alc_mic_automute(codec);
16704 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16706 struct alc_spec *spec = codec->spec;
16708 spec->autocfg.hp_pins[0] = 0x14;
16709 spec->autocfg.speaker_pins[0] = 0x1b;
16712 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16714 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16716 unsigned int present;
16717 unsigned char bits;
16719 present = snd_hda_jack_detect(codec, 0x21);
16720 bits = present ? HDA_AMP_MUTE : 0;
16721 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16722 AMP_IN_MUTE(0), bits);
16723 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16724 AMP_IN_MUTE(0), bits);
16727 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16729 unsigned int present;
16730 unsigned char bits;
16732 present = snd_hda_jack_detect(codec, 0x21);
16733 bits = present ? HDA_AMP_MUTE : 0;
16734 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16735 AMP_IN_MUTE(0), bits);
16736 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16737 AMP_IN_MUTE(0), bits);
16738 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16739 AMP_IN_MUTE(0), bits);
16740 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16741 AMP_IN_MUTE(0), bits);
16744 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16746 unsigned int present;
16747 unsigned char bits;
16749 present = snd_hda_jack_detect(codec, 0x15);
16750 bits = present ? HDA_AMP_MUTE : 0;
16751 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16752 AMP_IN_MUTE(0), bits);
16753 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16754 AMP_IN_MUTE(0), bits);
16755 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16756 AMP_IN_MUTE(0), bits);
16757 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16758 AMP_IN_MUTE(0), bits);
16761 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16763 unsigned int present;
16764 unsigned char bits;
16766 present = snd_hda_jack_detect(codec, 0x1b);
16767 bits = present ? 0 : PIN_OUT;
16768 snd_hda_codec_write(codec, 0x14, 0,
16769 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16772 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16774 unsigned int present1, present2;
16776 present1 = snd_hda_jack_detect(codec, 0x21);
16777 present2 = snd_hda_jack_detect(codec, 0x15);
16779 if (present1 || present2) {
16780 snd_hda_codec_write_cache(codec, 0x14, 0,
16781 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16783 snd_hda_codec_write_cache(codec, 0x14, 0,
16784 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16788 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16790 unsigned int present1, present2;
16792 present1 = snd_hda_jack_detect(codec, 0x1b);
16793 present2 = snd_hda_jack_detect(codec, 0x15);
16795 if (present1 || present2) {
16796 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16797 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16798 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16799 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16801 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16802 AMP_IN_MUTE(0), 0);
16803 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16804 AMP_IN_MUTE(0), 0);
16808 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16810 unsigned int present1, present2;
16812 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16813 AC_VERB_GET_PIN_SENSE, 0)
16814 & AC_PINSENSE_PRESENCE;
16815 present2 = snd_hda_codec_read(codec, 0x21, 0,
16816 AC_VERB_GET_PIN_SENSE, 0)
16817 & AC_PINSENSE_PRESENCE;
16819 if (present1 || present2) {
16820 snd_hda_codec_write_cache(codec, 0x14, 0,
16821 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16822 snd_hda_codec_write_cache(codec, 0x17, 0,
16823 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16825 snd_hda_codec_write_cache(codec, 0x14, 0,
16826 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16827 snd_hda_codec_write_cache(codec, 0x17, 0,
16828 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16832 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16834 unsigned int present1, present2;
16836 present1 = snd_hda_codec_read(codec, 0x21, 0,
16837 AC_VERB_GET_PIN_SENSE, 0)
16838 & AC_PINSENSE_PRESENCE;
16839 present2 = snd_hda_codec_read(codec, 0x15, 0,
16840 AC_VERB_GET_PIN_SENSE, 0)
16841 & AC_PINSENSE_PRESENCE;
16843 if (present1 || present2) {
16844 snd_hda_codec_write_cache(codec, 0x14, 0,
16845 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16846 snd_hda_codec_write_cache(codec, 0x17, 0,
16847 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16849 snd_hda_codec_write_cache(codec, 0x14, 0,
16850 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16851 snd_hda_codec_write_cache(codec, 0x17, 0,
16852 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16856 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16859 switch (res >> 26) {
16860 case ALC880_HP_EVENT:
16861 alc663_m51va_speaker_automute(codec);
16863 case ALC880_MIC_EVENT:
16864 alc_mic_automute(codec);
16869 static void alc663_m51va_setup(struct hda_codec *codec)
16871 struct alc_spec *spec = codec->spec;
16872 spec->ext_mic.pin = 0x18;
16873 spec->ext_mic.mux_idx = 0;
16874 spec->int_mic.pin = 0x12;
16875 spec->int_mic.mux_idx = 9;
16876 spec->auto_mic = 1;
16879 static void alc663_m51va_inithook(struct hda_codec *codec)
16881 alc663_m51va_speaker_automute(codec);
16882 alc_mic_automute(codec);
16885 /* ***************** Mode1 ******************************/
16886 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16888 static void alc663_mode1_setup(struct hda_codec *codec)
16890 struct alc_spec *spec = codec->spec;
16891 spec->ext_mic.pin = 0x18;
16892 spec->ext_mic.mux_idx = 0;
16893 spec->int_mic.pin = 0x19;
16894 spec->int_mic.mux_idx = 1;
16895 spec->auto_mic = 1;
16898 #define alc663_mode1_inithook alc663_m51va_inithook
16900 /* ***************** Mode2 ******************************/
16901 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16904 switch (res >> 26) {
16905 case ALC880_HP_EVENT:
16906 alc662_f5z_speaker_automute(codec);
16908 case ALC880_MIC_EVENT:
16909 alc_mic_automute(codec);
16914 #define alc662_mode2_setup alc663_mode1_setup
16916 static void alc662_mode2_inithook(struct hda_codec *codec)
16918 alc662_f5z_speaker_automute(codec);
16919 alc_mic_automute(codec);
16921 /* ***************** Mode3 ******************************/
16922 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16925 switch (res >> 26) {
16926 case ALC880_HP_EVENT:
16927 alc663_two_hp_m1_speaker_automute(codec);
16929 case ALC880_MIC_EVENT:
16930 alc_mic_automute(codec);
16935 #define alc663_mode3_setup alc663_mode1_setup
16937 static void alc663_mode3_inithook(struct hda_codec *codec)
16939 alc663_two_hp_m1_speaker_automute(codec);
16940 alc_mic_automute(codec);
16942 /* ***************** Mode4 ******************************/
16943 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16946 switch (res >> 26) {
16947 case ALC880_HP_EVENT:
16948 alc663_21jd_two_speaker_automute(codec);
16950 case ALC880_MIC_EVENT:
16951 alc_mic_automute(codec);
16956 #define alc663_mode4_setup alc663_mode1_setup
16958 static void alc663_mode4_inithook(struct hda_codec *codec)
16960 alc663_21jd_two_speaker_automute(codec);
16961 alc_mic_automute(codec);
16963 /* ***************** Mode5 ******************************/
16964 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16967 switch (res >> 26) {
16968 case ALC880_HP_EVENT:
16969 alc663_15jd_two_speaker_automute(codec);
16971 case ALC880_MIC_EVENT:
16972 alc_mic_automute(codec);
16977 #define alc663_mode5_setup alc663_mode1_setup
16979 static void alc663_mode5_inithook(struct hda_codec *codec)
16981 alc663_15jd_two_speaker_automute(codec);
16982 alc_mic_automute(codec);
16984 /* ***************** Mode6 ******************************/
16985 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16988 switch (res >> 26) {
16989 case ALC880_HP_EVENT:
16990 alc663_two_hp_m2_speaker_automute(codec);
16992 case ALC880_MIC_EVENT:
16993 alc_mic_automute(codec);
16998 #define alc663_mode6_setup alc663_mode1_setup
17000 static void alc663_mode6_inithook(struct hda_codec *codec)
17002 alc663_two_hp_m2_speaker_automute(codec);
17003 alc_mic_automute(codec);
17006 /* ***************** Mode7 ******************************/
17007 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17010 switch (res >> 26) {
17011 case ALC880_HP_EVENT:
17012 alc663_two_hp_m7_speaker_automute(codec);
17014 case ALC880_MIC_EVENT:
17015 alc_mic_automute(codec);
17020 #define alc663_mode7_setup alc663_mode1_setup
17022 static void alc663_mode7_inithook(struct hda_codec *codec)
17024 alc663_two_hp_m7_speaker_automute(codec);
17025 alc_mic_automute(codec);
17028 /* ***************** Mode8 ******************************/
17029 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17032 switch (res >> 26) {
17033 case ALC880_HP_EVENT:
17034 alc663_two_hp_m8_speaker_automute(codec);
17036 case ALC880_MIC_EVENT:
17037 alc_mic_automute(codec);
17042 #define alc663_mode8_setup alc663_m51va_setup
17044 static void alc663_mode8_inithook(struct hda_codec *codec)
17046 alc663_two_hp_m8_speaker_automute(codec);
17047 alc_mic_automute(codec);
17050 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17052 unsigned int present;
17053 unsigned char bits;
17055 present = snd_hda_jack_detect(codec, 0x21);
17056 bits = present ? HDA_AMP_MUTE : 0;
17057 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17058 HDA_AMP_MUTE, bits);
17059 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17060 HDA_AMP_MUTE, bits);
17063 static void alc663_g71v_front_automute(struct hda_codec *codec)
17065 unsigned int present;
17066 unsigned char bits;
17068 present = snd_hda_jack_detect(codec, 0x15);
17069 bits = present ? HDA_AMP_MUTE : 0;
17070 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17071 HDA_AMP_MUTE, bits);
17074 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17077 switch (res >> 26) {
17078 case ALC880_HP_EVENT:
17079 alc663_g71v_hp_automute(codec);
17081 case ALC880_FRONT_EVENT:
17082 alc663_g71v_front_automute(codec);
17084 case ALC880_MIC_EVENT:
17085 alc_mic_automute(codec);
17090 #define alc663_g71v_setup alc663_m51va_setup
17092 static void alc663_g71v_inithook(struct hda_codec *codec)
17094 alc663_g71v_front_automute(codec);
17095 alc663_g71v_hp_automute(codec);
17096 alc_mic_automute(codec);
17099 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17102 switch (res >> 26) {
17103 case ALC880_HP_EVENT:
17104 alc663_m51va_speaker_automute(codec);
17106 case ALC880_MIC_EVENT:
17107 alc_mic_automute(codec);
17112 #define alc663_g50v_setup alc663_m51va_setup
17114 static void alc663_g50v_inithook(struct hda_codec *codec)
17116 alc663_m51va_speaker_automute(codec);
17117 alc_mic_automute(codec);
17120 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17121 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17122 ALC262_HIPPO_MASTER_SWITCH,
17124 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17125 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17126 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17128 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17129 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17130 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17134 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17135 /* Master Playback automatically created from Speaker and Headphone */
17136 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17137 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17138 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17141 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17142 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17143 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17145 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17146 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17147 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17151 #ifdef CONFIG_SND_HDA_POWER_SAVE
17152 #define alc662_loopbacks alc880_loopbacks
17156 /* pcm configuration: identical with ALC880 */
17157 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17158 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17159 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17160 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17163 * configuration and preset
17165 static const char *alc662_models[ALC662_MODEL_LAST] = {
17166 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17167 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17168 [ALC662_3ST_6ch] = "3stack-6ch",
17169 [ALC662_5ST_DIG] = "6stack-dig",
17170 [ALC662_LENOVO_101E] = "lenovo-101e",
17171 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17172 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17173 [ALC662_ECS] = "ecs",
17174 [ALC663_ASUS_M51VA] = "m51va",
17175 [ALC663_ASUS_G71V] = "g71v",
17176 [ALC663_ASUS_H13] = "h13",
17177 [ALC663_ASUS_G50V] = "g50v",
17178 [ALC663_ASUS_MODE1] = "asus-mode1",
17179 [ALC662_ASUS_MODE2] = "asus-mode2",
17180 [ALC663_ASUS_MODE3] = "asus-mode3",
17181 [ALC663_ASUS_MODE4] = "asus-mode4",
17182 [ALC663_ASUS_MODE5] = "asus-mode5",
17183 [ALC663_ASUS_MODE6] = "asus-mode6",
17184 [ALC663_ASUS_MODE7] = "asus-mode7",
17185 [ALC663_ASUS_MODE8] = "asus-mode8",
17186 [ALC272_DELL] = "dell",
17187 [ALC272_DELL_ZM1] = "dell-zm1",
17188 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17189 [ALC662_AUTO] = "auto",
17192 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17193 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17194 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17195 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17196 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17197 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17198 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17199 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17200 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17201 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17202 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17203 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17204 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17205 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17206 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17207 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17208 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17209 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17210 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17211 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17212 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17213 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17214 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17215 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17216 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17217 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17218 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17219 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17220 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17221 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17222 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17223 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17224 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17225 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17226 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17227 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17228 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17229 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17230 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17231 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17232 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17233 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17234 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17235 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17236 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17237 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17238 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17239 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17240 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17241 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17242 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17243 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17244 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17245 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17246 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17247 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17248 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17249 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17250 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17251 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17252 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17253 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17254 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17255 ALC662_3ST_6ch_DIG),
17256 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17257 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17258 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17259 ALC662_3ST_6ch_DIG),
17260 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17261 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17262 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17263 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17264 ALC662_3ST_6ch_DIG),
17265 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17267 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17271 static struct alc_config_preset alc662_presets[] = {
17272 [ALC662_3ST_2ch_DIG] = {
17273 .mixers = { alc662_3ST_2ch_mixer },
17274 .init_verbs = { alc662_init_verbs },
17275 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17276 .dac_nids = alc662_dac_nids,
17277 .dig_out_nid = ALC662_DIGOUT_NID,
17278 .dig_in_nid = ALC662_DIGIN_NID,
17279 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17280 .channel_mode = alc662_3ST_2ch_modes,
17281 .input_mux = &alc662_capture_source,
17283 [ALC662_3ST_6ch_DIG] = {
17284 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17285 .init_verbs = { alc662_init_verbs },
17286 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17287 .dac_nids = alc662_dac_nids,
17288 .dig_out_nid = ALC662_DIGOUT_NID,
17289 .dig_in_nid = ALC662_DIGIN_NID,
17290 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17291 .channel_mode = alc662_3ST_6ch_modes,
17293 .input_mux = &alc662_capture_source,
17295 [ALC662_3ST_6ch] = {
17296 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17297 .init_verbs = { alc662_init_verbs },
17298 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17299 .dac_nids = alc662_dac_nids,
17300 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17301 .channel_mode = alc662_3ST_6ch_modes,
17303 .input_mux = &alc662_capture_source,
17305 [ALC662_5ST_DIG] = {
17306 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17307 .init_verbs = { alc662_init_verbs },
17308 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17309 .dac_nids = alc662_dac_nids,
17310 .dig_out_nid = ALC662_DIGOUT_NID,
17311 .dig_in_nid = ALC662_DIGIN_NID,
17312 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17313 .channel_mode = alc662_5stack_modes,
17314 .input_mux = &alc662_capture_source,
17316 [ALC662_LENOVO_101E] = {
17317 .mixers = { alc662_lenovo_101e_mixer },
17318 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17319 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17320 .dac_nids = alc662_dac_nids,
17321 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17322 .channel_mode = alc662_3ST_2ch_modes,
17323 .input_mux = &alc662_lenovo_101e_capture_source,
17324 .unsol_event = alc662_lenovo_101e_unsol_event,
17325 .init_hook = alc662_lenovo_101e_all_automute,
17327 [ALC662_ASUS_EEEPC_P701] = {
17328 .mixers = { alc662_eeepc_p701_mixer },
17329 .init_verbs = { alc662_init_verbs,
17330 alc662_eeepc_sue_init_verbs },
17331 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17332 .dac_nids = alc662_dac_nids,
17333 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17334 .channel_mode = alc662_3ST_2ch_modes,
17335 .unsol_event = alc662_eeepc_unsol_event,
17336 .setup = alc662_eeepc_setup,
17337 .init_hook = alc662_eeepc_inithook,
17339 [ALC662_ASUS_EEEPC_EP20] = {
17340 .mixers = { alc662_eeepc_ep20_mixer,
17341 alc662_chmode_mixer },
17342 .init_verbs = { alc662_init_verbs,
17343 alc662_eeepc_ep20_sue_init_verbs },
17344 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17345 .dac_nids = alc662_dac_nids,
17346 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17347 .channel_mode = alc662_3ST_6ch_modes,
17348 .input_mux = &alc662_lenovo_101e_capture_source,
17349 .unsol_event = alc662_eeepc_unsol_event,
17350 .setup = alc662_eeepc_ep20_setup,
17351 .init_hook = alc662_eeepc_ep20_inithook,
17354 .mixers = { alc662_ecs_mixer },
17355 .init_verbs = { alc662_init_verbs,
17356 alc662_ecs_init_verbs },
17357 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17358 .dac_nids = alc662_dac_nids,
17359 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17360 .channel_mode = alc662_3ST_2ch_modes,
17361 .unsol_event = alc662_eeepc_unsol_event,
17362 .setup = alc662_eeepc_setup,
17363 .init_hook = alc662_eeepc_inithook,
17365 [ALC663_ASUS_M51VA] = {
17366 .mixers = { alc663_m51va_mixer },
17367 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17368 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17369 .dac_nids = alc662_dac_nids,
17370 .dig_out_nid = ALC662_DIGOUT_NID,
17371 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17372 .channel_mode = alc662_3ST_2ch_modes,
17373 .unsol_event = alc663_m51va_unsol_event,
17374 .setup = alc663_m51va_setup,
17375 .init_hook = alc663_m51va_inithook,
17377 [ALC663_ASUS_G71V] = {
17378 .mixers = { alc663_g71v_mixer },
17379 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17380 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17381 .dac_nids = alc662_dac_nids,
17382 .dig_out_nid = ALC662_DIGOUT_NID,
17383 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17384 .channel_mode = alc662_3ST_2ch_modes,
17385 .unsol_event = alc663_g71v_unsol_event,
17386 .setup = alc663_g71v_setup,
17387 .init_hook = alc663_g71v_inithook,
17389 [ALC663_ASUS_H13] = {
17390 .mixers = { alc663_m51va_mixer },
17391 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17392 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17393 .dac_nids = alc662_dac_nids,
17394 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17395 .channel_mode = alc662_3ST_2ch_modes,
17396 .unsol_event = alc663_m51va_unsol_event,
17397 .init_hook = alc663_m51va_inithook,
17399 [ALC663_ASUS_G50V] = {
17400 .mixers = { alc663_g50v_mixer },
17401 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17402 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17403 .dac_nids = alc662_dac_nids,
17404 .dig_out_nid = ALC662_DIGOUT_NID,
17405 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17406 .channel_mode = alc662_3ST_6ch_modes,
17407 .input_mux = &alc663_capture_source,
17408 .unsol_event = alc663_g50v_unsol_event,
17409 .setup = alc663_g50v_setup,
17410 .init_hook = alc663_g50v_inithook,
17412 [ALC663_ASUS_MODE1] = {
17413 .mixers = { alc663_m51va_mixer },
17414 .cap_mixer = alc662_auto_capture_mixer,
17415 .init_verbs = { alc662_init_verbs,
17416 alc663_21jd_amic_init_verbs },
17417 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17419 .dac_nids = alc662_dac_nids,
17420 .dig_out_nid = ALC662_DIGOUT_NID,
17421 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17422 .channel_mode = alc662_3ST_2ch_modes,
17423 .unsol_event = alc663_mode1_unsol_event,
17424 .setup = alc663_mode1_setup,
17425 .init_hook = alc663_mode1_inithook,
17427 [ALC662_ASUS_MODE2] = {
17428 .mixers = { alc662_1bjd_mixer },
17429 .cap_mixer = alc662_auto_capture_mixer,
17430 .init_verbs = { alc662_init_verbs,
17431 alc662_1bjd_amic_init_verbs },
17432 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17433 .dac_nids = alc662_dac_nids,
17434 .dig_out_nid = ALC662_DIGOUT_NID,
17435 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17436 .channel_mode = alc662_3ST_2ch_modes,
17437 .unsol_event = alc662_mode2_unsol_event,
17438 .setup = alc662_mode2_setup,
17439 .init_hook = alc662_mode2_inithook,
17441 [ALC663_ASUS_MODE3] = {
17442 .mixers = { alc663_two_hp_m1_mixer },
17443 .cap_mixer = alc662_auto_capture_mixer,
17444 .init_verbs = { alc662_init_verbs,
17445 alc663_two_hp_amic_m1_init_verbs },
17446 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17448 .dac_nids = alc662_dac_nids,
17449 .dig_out_nid = ALC662_DIGOUT_NID,
17450 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17451 .channel_mode = alc662_3ST_2ch_modes,
17452 .unsol_event = alc663_mode3_unsol_event,
17453 .setup = alc663_mode3_setup,
17454 .init_hook = alc663_mode3_inithook,
17456 [ALC663_ASUS_MODE4] = {
17457 .mixers = { alc663_asus_21jd_clfe_mixer },
17458 .cap_mixer = alc662_auto_capture_mixer,
17459 .init_verbs = { alc662_init_verbs,
17460 alc663_21jd_amic_init_verbs},
17461 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17463 .dac_nids = alc662_dac_nids,
17464 .dig_out_nid = ALC662_DIGOUT_NID,
17465 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17466 .channel_mode = alc662_3ST_2ch_modes,
17467 .unsol_event = alc663_mode4_unsol_event,
17468 .setup = alc663_mode4_setup,
17469 .init_hook = alc663_mode4_inithook,
17471 [ALC663_ASUS_MODE5] = {
17472 .mixers = { alc663_asus_15jd_clfe_mixer },
17473 .cap_mixer = alc662_auto_capture_mixer,
17474 .init_verbs = { alc662_init_verbs,
17475 alc663_15jd_amic_init_verbs },
17476 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17478 .dac_nids = alc662_dac_nids,
17479 .dig_out_nid = ALC662_DIGOUT_NID,
17480 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17481 .channel_mode = alc662_3ST_2ch_modes,
17482 .unsol_event = alc663_mode5_unsol_event,
17483 .setup = alc663_mode5_setup,
17484 .init_hook = alc663_mode5_inithook,
17486 [ALC663_ASUS_MODE6] = {
17487 .mixers = { alc663_two_hp_m2_mixer },
17488 .cap_mixer = alc662_auto_capture_mixer,
17489 .init_verbs = { alc662_init_verbs,
17490 alc663_two_hp_amic_m2_init_verbs },
17491 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17493 .dac_nids = alc662_dac_nids,
17494 .dig_out_nid = ALC662_DIGOUT_NID,
17495 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17496 .channel_mode = alc662_3ST_2ch_modes,
17497 .unsol_event = alc663_mode6_unsol_event,
17498 .setup = alc663_mode6_setup,
17499 .init_hook = alc663_mode6_inithook,
17501 [ALC663_ASUS_MODE7] = {
17502 .mixers = { alc663_mode7_mixer },
17503 .cap_mixer = alc662_auto_capture_mixer,
17504 .init_verbs = { alc662_init_verbs,
17505 alc663_mode7_init_verbs },
17506 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17508 .dac_nids = alc662_dac_nids,
17509 .dig_out_nid = ALC662_DIGOUT_NID,
17510 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17511 .channel_mode = alc662_3ST_2ch_modes,
17512 .unsol_event = alc663_mode7_unsol_event,
17513 .setup = alc663_mode7_setup,
17514 .init_hook = alc663_mode7_inithook,
17516 [ALC663_ASUS_MODE8] = {
17517 .mixers = { alc663_mode8_mixer },
17518 .cap_mixer = alc662_auto_capture_mixer,
17519 .init_verbs = { alc662_init_verbs,
17520 alc663_mode8_init_verbs },
17521 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17523 .dac_nids = alc662_dac_nids,
17524 .dig_out_nid = ALC662_DIGOUT_NID,
17525 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17526 .channel_mode = alc662_3ST_2ch_modes,
17527 .unsol_event = alc663_mode8_unsol_event,
17528 .setup = alc663_mode8_setup,
17529 .init_hook = alc663_mode8_inithook,
17532 .mixers = { alc663_m51va_mixer },
17533 .cap_mixer = alc272_auto_capture_mixer,
17534 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17535 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17536 .dac_nids = alc662_dac_nids,
17537 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17538 .adc_nids = alc272_adc_nids,
17539 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17540 .capsrc_nids = alc272_capsrc_nids,
17541 .channel_mode = alc662_3ST_2ch_modes,
17542 .unsol_event = alc663_m51va_unsol_event,
17543 .setup = alc663_m51va_setup,
17544 .init_hook = alc663_m51va_inithook,
17546 [ALC272_DELL_ZM1] = {
17547 .mixers = { alc663_m51va_mixer },
17548 .cap_mixer = alc662_auto_capture_mixer,
17549 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17550 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17551 .dac_nids = alc662_dac_nids,
17552 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17553 .adc_nids = alc662_adc_nids,
17555 .capsrc_nids = alc662_capsrc_nids,
17556 .channel_mode = alc662_3ST_2ch_modes,
17557 .unsol_event = alc663_m51va_unsol_event,
17558 .setup = alc663_m51va_setup,
17559 .init_hook = alc663_m51va_inithook,
17561 [ALC272_SAMSUNG_NC10] = {
17562 .mixers = { alc272_nc10_mixer },
17563 .init_verbs = { alc662_init_verbs,
17564 alc663_21jd_amic_init_verbs },
17565 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17566 .dac_nids = alc272_dac_nids,
17567 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17568 .channel_mode = alc662_3ST_2ch_modes,
17569 /*.input_mux = &alc272_nc10_capture_source,*/
17570 .unsol_event = alc663_mode4_unsol_event,
17571 .setup = alc663_mode4_setup,
17572 .init_hook = alc663_mode4_inithook,
17578 * BIOS auto configuration
17581 /* convert from MIX nid to DAC */
17582 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17586 else if (nid >= 0x0c && nid <= 0x0e)
17587 return nid - 0x0c + 0x02;
17592 /* get MIX nid connected to the given pin targeted to DAC */
17593 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17599 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17600 for (i = 0; i < num; i++) {
17601 if (alc662_mix_to_dac(mix[i]) == dac)
17607 /* look for an empty DAC slot */
17608 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17610 struct alc_spec *spec = codec->spec;
17614 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17617 for (i = 0; i < num; i++) {
17618 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17621 for (j = 0; j < spec->multiout.num_dacs; j++)
17622 if (spec->multiout.dac_nids[j] == nid)
17624 if (j >= spec->multiout.num_dacs)
17630 /* fill in the dac_nids table from the parsed pin configuration */
17631 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17632 const struct auto_pin_cfg *cfg)
17634 struct alc_spec *spec = codec->spec;
17638 spec->multiout.dac_nids = spec->private_dac_nids;
17639 for (i = 0; i < cfg->line_outs; i++) {
17640 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17643 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17648 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17649 hda_nid_t nid, unsigned int chs)
17651 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17652 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17655 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17656 hda_nid_t nid, unsigned int chs)
17658 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17659 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17662 #define alc662_add_stereo_vol(spec, pfx, nid) \
17663 alc662_add_vol_ctl(spec, pfx, nid, 3)
17664 #define alc662_add_stereo_sw(spec, pfx, nid) \
17665 alc662_add_sw_ctl(spec, pfx, nid, 3)
17667 /* add playback controls from the parsed DAC table */
17668 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17669 const struct auto_pin_cfg *cfg)
17671 struct alc_spec *spec = codec->spec;
17672 static const char *chname[4] = {
17673 "Front", "Surround", NULL /*CLFE*/, "Side"
17675 hda_nid_t nid, mix;
17678 for (i = 0; i < cfg->line_outs; i++) {
17679 nid = spec->multiout.dac_nids[i];
17682 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17687 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17690 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17693 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17696 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17701 if (cfg->line_outs == 1 &&
17702 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17709 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17712 if (cfg->line_outs == 1 &&
17713 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17715 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17723 /* add playback controls for speaker and HP outputs */
17724 /* return DAC nid if any new DAC is assigned */
17725 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17728 struct alc_spec *spec = codec->spec;
17729 hda_nid_t nid, mix;
17734 nid = alc662_look_for_dac(codec, pin);
17736 /* the corresponding DAC is already occupied */
17737 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17738 return 0; /* no way */
17739 /* create a switch only */
17740 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17741 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17744 mix = alc662_dac_to_mix(codec, pin, nid);
17747 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17750 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17756 /* create playback/capture controls for input pins */
17757 #define alc662_auto_create_input_ctls \
17758 alc882_auto_create_input_ctls
17760 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17761 hda_nid_t nid, int pin_type,
17767 alc_set_pin_output(codec, nid, pin_type);
17768 /* need the manual connection? */
17769 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17772 for (i = 0; i < num; i++) {
17773 if (alc662_mix_to_dac(srcs[i]) != dac)
17775 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17780 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17782 struct alc_spec *spec = codec->spec;
17783 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17786 for (i = 0; i <= HDA_SIDE; i++) {
17787 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17789 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17790 spec->multiout.dac_nids[i]);
17794 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17796 struct alc_spec *spec = codec->spec;
17799 pin = spec->autocfg.hp_pins[0];
17801 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17802 spec->multiout.hp_nid);
17803 pin = spec->autocfg.speaker_pins[0];
17805 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17806 spec->multiout.extra_out_nid[0]);
17809 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17811 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17813 struct alc_spec *spec = codec->spec;
17816 for (i = 0; i < AUTO_PIN_LAST; i++) {
17817 hda_nid_t nid = spec->autocfg.input_pins[i];
17818 if (alc_is_input_pin(codec, nid)) {
17819 alc_set_input_pin(codec, nid, i);
17820 if (nid != ALC662_PIN_CD_NID &&
17821 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17822 snd_hda_codec_write(codec, nid, 0,
17823 AC_VERB_SET_AMP_GAIN_MUTE,
17829 #define alc662_auto_init_input_src alc882_auto_init_input_src
17831 static int alc662_parse_auto_config(struct hda_codec *codec)
17833 struct alc_spec *spec = codec->spec;
17835 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17837 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17841 if (!spec->autocfg.line_outs)
17842 return 0; /* can't find valid BIOS pin config */
17844 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17847 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17850 err = alc662_auto_create_extra_out(codec,
17851 spec->autocfg.speaker_pins[0],
17856 spec->multiout.extra_out_nid[0] = err;
17857 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17862 spec->multiout.hp_nid = err;
17863 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17867 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17869 if (spec->autocfg.dig_outs)
17870 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17872 if (spec->kctls.list)
17873 add_mixer(spec, spec->kctls.list);
17875 spec->num_mux_defs = 1;
17876 spec->input_mux = &spec->private_imux[0];
17878 add_verb(spec, alc662_auto_init_verbs);
17879 if (codec->vendor_id == 0x10ec0663)
17880 add_verb(spec, alc663_auto_init_verbs);
17882 err = alc_auto_add_mic_boost(codec);
17886 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17891 /* additional initialization for auto-configuration model */
17892 static void alc662_auto_init(struct hda_codec *codec)
17894 struct alc_spec *spec = codec->spec;
17895 alc662_auto_init_multi_out(codec);
17896 alc662_auto_init_hp_out(codec);
17897 alc662_auto_init_analog_input(codec);
17898 alc662_auto_init_input_src(codec);
17899 if (spec->unsol_event)
17900 alc_inithook(codec);
17903 static int patch_alc662(struct hda_codec *codec)
17905 struct alc_spec *spec;
17906 int err, board_config;
17908 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17912 codec->spec = spec;
17914 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17916 if (alc_read_coef_idx(codec, 0)==0x8020){
17917 kfree(codec->chip_name);
17918 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17919 if (!codec->chip_name) {
17925 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17928 if (board_config < 0) {
17929 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17931 board_config = ALC662_AUTO;
17934 if (board_config == ALC662_AUTO) {
17935 /* automatic parse from the BIOS config */
17936 err = alc662_parse_auto_config(codec);
17942 "hda_codec: Cannot set up configuration "
17943 "from BIOS. Using base mode...\n");
17944 board_config = ALC662_3ST_2ch_DIG;
17948 err = snd_hda_attach_beep_device(codec, 0x1);
17954 if (board_config != ALC662_AUTO)
17955 setup_preset(codec, &alc662_presets[board_config]);
17957 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17958 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17960 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17961 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17963 if (!spec->adc_nids) {
17964 spec->adc_nids = alc662_adc_nids;
17965 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17967 if (!spec->capsrc_nids)
17968 spec->capsrc_nids = alc662_capsrc_nids;
17970 if (!spec->cap_mixer)
17971 set_capture_mixer(codec);
17972 if (codec->vendor_id == 0x10ec0662)
17973 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17975 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17977 spec->vmaster_nid = 0x02;
17979 codec->patch_ops = alc_patch_ops;
17980 if (board_config == ALC662_AUTO)
17981 spec->init_hook = alc662_auto_init;
17982 #ifdef CONFIG_SND_HDA_POWER_SAVE
17983 if (!spec->loopback.amplist)
17984 spec->loopback.amplist = alc662_loopbacks;
17986 codec->proc_widget_hook = print_realtek_coef;
17991 static int patch_alc888(struct hda_codec *codec)
17993 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
17994 kfree(codec->chip_name);
17995 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
17996 if (!codec->chip_name) {
18000 return patch_alc662(codec);
18002 return patch_alc882(codec);
18008 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18009 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18010 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18011 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18012 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18013 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18014 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18015 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18016 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18017 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18018 .patch = patch_alc861 },
18019 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18020 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18021 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18022 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18023 .patch = patch_alc882 },
18024 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18025 .patch = patch_alc662 },
18026 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18027 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18028 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18029 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18030 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18031 .patch = patch_alc882 },
18032 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18033 .patch = patch_alc882 },
18034 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18035 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18036 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18037 .patch = patch_alc882 },
18038 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18039 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18040 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18041 {} /* terminator */
18044 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18046 MODULE_LICENSE("GPL");
18047 MODULE_DESCRIPTION("Realtek HD-audio codec");
18049 static struct hda_codec_preset_list realtek_list = {
18050 .preset = snd_hda_preset_realtek,
18051 .owner = THIS_MODULE,
18054 static int __init patch_realtek_init(void)
18056 return snd_hda_add_codec_preset(&realtek_list);
18059 static void __exit patch_realtek_exit(void)
18061 snd_hda_delete_codec_preset(&realtek_list);
18064 module_init(patch_realtek_init)
18065 module_exit(patch_realtek_exit)