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 */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
222 ALC883_TARGA_2ch_DIG,
223 ALC883_TARGA_8ch_DIG,
226 ALC888_ACER_ASPIRE_4930G,
227 ALC888_ACER_ASPIRE_6530G,
228 ALC888_ACER_ASPIRE_8930G,
232 ALC883_LENOVO_101E_2ch,
233 ALC883_LENOVO_NB0763,
234 ALC888_LENOVO_MS7195_DIG,
241 ALC883_FUJITSU_PI2515,
242 ALC888_FUJITSU_XA3530,
243 ALC883_3ST_6ch_INTEL,
254 #define GPIO_MASK 0x03
256 /* extra amp-initialization sequence types */
266 /* codec parameterization */
267 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
268 unsigned int num_mixers;
269 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
270 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
272 const struct hda_verb *init_verbs[5]; /* initialization verbs
276 unsigned int num_init_verbs;
278 char stream_name_analog[16]; /* analog PCM stream */
279 struct hda_pcm_stream *stream_analog_playback;
280 struct hda_pcm_stream *stream_analog_capture;
281 struct hda_pcm_stream *stream_analog_alt_playback;
282 struct hda_pcm_stream *stream_analog_alt_capture;
284 char stream_name_digital[16]; /* digital PCM stream */
285 struct hda_pcm_stream *stream_digital_playback;
286 struct hda_pcm_stream *stream_digital_capture;
289 struct hda_multi_out multiout; /* playback set-up
290 * max_channels, dacs must be set
291 * dig_out_nid and hp_nid are optional
293 hda_nid_t alt_dac_nid;
294 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
298 unsigned int num_adc_nids;
300 hda_nid_t *capsrc_nids;
301 hda_nid_t dig_in_nid; /* digital-in NID; optional */
304 unsigned int num_mux_defs;
305 const struct hda_input_mux *input_mux;
306 unsigned int cur_mux[3];
309 const struct hda_channel_mode *channel_mode;
310 int num_channel_mode;
312 int const_channel_count;
313 int ext_channel_count;
315 /* PCM information */
316 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
318 /* dynamic controls, init_verbs and input_mux */
319 struct auto_pin_cfg autocfg;
320 struct snd_array kctls;
321 struct hda_input_mux private_imux[3];
322 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
325 void (*init_hook)(struct hda_codec *codec);
326 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
328 /* for pin sensing */
329 unsigned int sense_updated: 1;
330 unsigned int jack_present: 1;
331 unsigned int master_sw: 1;
334 unsigned int no_analog :1; /* digital I/O only */
337 /* for virtual master */
338 hda_nid_t vmaster_nid;
339 #ifdef CONFIG_SND_HDA_POWER_SAVE
340 struct hda_loopback_check loopback;
345 unsigned int pll_coef_idx, pll_coef_bit;
349 * configuration template - to be copied to the spec instance
351 struct alc_config_preset {
352 struct snd_kcontrol_new *mixers[5]; /* should be identical size
355 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
356 const struct hda_verb *init_verbs[5];
357 unsigned int num_dacs;
359 hda_nid_t dig_out_nid; /* optional */
360 hda_nid_t hp_nid; /* optional */
361 hda_nid_t *slave_dig_outs;
362 unsigned int num_adc_nids;
364 hda_nid_t *capsrc_nids;
365 hda_nid_t dig_in_nid;
366 unsigned int num_channel_mode;
367 const struct hda_channel_mode *channel_mode;
369 int const_channel_count;
370 unsigned int num_mux_defs;
371 const struct hda_input_mux *input_mux;
372 void (*unsol_event)(struct hda_codec *, unsigned int);
373 void (*init_hook)(struct hda_codec *);
374 #ifdef CONFIG_SND_HDA_POWER_SAVE
375 struct hda_amp_list *loopbacks;
383 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
384 struct snd_ctl_elem_info *uinfo)
386 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
387 struct alc_spec *spec = codec->spec;
388 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
389 if (mux_idx >= spec->num_mux_defs)
391 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
394 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
395 struct snd_ctl_elem_value *ucontrol)
397 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
398 struct alc_spec *spec = codec->spec;
399 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
401 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
405 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
406 struct snd_ctl_elem_value *ucontrol)
408 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
409 struct alc_spec *spec = codec->spec;
410 const struct hda_input_mux *imux;
411 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
412 unsigned int mux_idx;
413 hda_nid_t nid = spec->capsrc_nids ?
414 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
417 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
418 imux = &spec->input_mux[mux_idx];
420 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
421 if (type == AC_WID_AUD_MIX) {
422 /* Matrix-mixer style (e.g. ALC882) */
423 unsigned int *cur_val = &spec->cur_mux[adc_idx];
426 idx = ucontrol->value.enumerated.item[0];
427 if (idx >= imux->num_items)
428 idx = imux->num_items - 1;
431 for (i = 0; i < imux->num_items; i++) {
432 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
433 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
434 imux->items[i].index,
440 /* MUX style (e.g. ALC880) */
441 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
442 &spec->cur_mux[adc_idx]);
447 * channel mode setting
449 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
450 struct snd_ctl_elem_info *uinfo)
452 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
453 struct alc_spec *spec = codec->spec;
454 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
455 spec->num_channel_mode);
458 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_value *ucontrol)
461 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
462 struct alc_spec *spec = codec->spec;
463 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
464 spec->num_channel_mode,
465 spec->ext_channel_count);
468 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_value *ucontrol)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
474 spec->num_channel_mode,
475 &spec->ext_channel_count);
476 if (err >= 0 && !spec->const_channel_count) {
477 spec->multiout.max_channels = spec->ext_channel_count;
478 if (spec->need_dac_fix)
479 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
485 * Control the mode of pin widget settings via the mixer. "pc" is used
486 * instead of "%" to avoid consequences of accidently treating the % as
487 * being part of a format specifier. Maximum allowed length of a value is
488 * 63 characters plus NULL terminator.
490 * Note: some retasking pin complexes seem to ignore requests for input
491 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
492 * are requested. Therefore order this list so that this behaviour will not
493 * cause problems when mixer clients move through the enum sequentially.
494 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
497 static char *alc_pin_mode_names[] = {
498 "Mic 50pc bias", "Mic 80pc bias",
499 "Line in", "Line out", "Headphone out",
501 static unsigned char alc_pin_mode_values[] = {
502 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
504 /* The control can present all 5 options, or it can limit the options based
505 * in the pin being assumed to be exclusively an input or an output pin. In
506 * addition, "input" pins may or may not process the mic bias option
507 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
508 * accept requests for bias as of chip versions up to March 2006) and/or
509 * wiring in the computer.
511 #define ALC_PIN_DIR_IN 0x00
512 #define ALC_PIN_DIR_OUT 0x01
513 #define ALC_PIN_DIR_INOUT 0x02
514 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
515 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
517 /* Info about the pin modes supported by the different pin direction modes.
518 * For each direction the minimum and maximum values are given.
520 static signed char alc_pin_mode_dir_info[5][2] = {
521 { 0, 2 }, /* ALC_PIN_DIR_IN */
522 { 3, 4 }, /* ALC_PIN_DIR_OUT */
523 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
524 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
525 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
527 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
528 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
529 #define alc_pin_mode_n_items(_dir) \
530 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
532 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
533 struct snd_ctl_elem_info *uinfo)
535 unsigned int item_num = uinfo->value.enumerated.item;
536 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
538 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
540 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
542 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
543 item_num = alc_pin_mode_min(dir);
544 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
548 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
549 struct snd_ctl_elem_value *ucontrol)
552 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
553 hda_nid_t nid = kcontrol->private_value & 0xffff;
554 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
555 long *valp = ucontrol->value.integer.value;
556 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
557 AC_VERB_GET_PIN_WIDGET_CONTROL,
560 /* Find enumerated value for current pinctl setting */
561 i = alc_pin_mode_min(dir);
562 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
564 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
568 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
569 struct snd_ctl_elem_value *ucontrol)
572 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
573 hda_nid_t nid = kcontrol->private_value & 0xffff;
574 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
575 long val = *ucontrol->value.integer.value;
576 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
577 AC_VERB_GET_PIN_WIDGET_CONTROL,
580 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
581 val = alc_pin_mode_min(dir);
583 change = pinctl != alc_pin_mode_values[val];
585 /* Set pin mode to that requested */
586 snd_hda_codec_write_cache(codec, nid, 0,
587 AC_VERB_SET_PIN_WIDGET_CONTROL,
588 alc_pin_mode_values[val]);
590 /* Also enable the retasking pin's input/output as required
591 * for the requested pin mode. Enum values of 2 or less are
594 * Dynamically switching the input/output buffers probably
595 * reduces noise slightly (particularly on input) so we'll
596 * do it. However, having both input and output buffers
597 * enabled simultaneously doesn't seem to be problematic if
598 * this turns out to be necessary in the future.
601 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
602 HDA_AMP_MUTE, HDA_AMP_MUTE);
603 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
606 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
607 HDA_AMP_MUTE, HDA_AMP_MUTE);
608 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
615 #define ALC_PIN_MODE(xname, nid, dir) \
616 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
617 .info = alc_pin_mode_info, \
618 .get = alc_pin_mode_get, \
619 .put = alc_pin_mode_put, \
620 .private_value = nid | (dir<<16) }
622 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
623 * together using a mask with more than one bit set. This control is
624 * currently used only by the ALC260 test model. At this stage they are not
625 * needed for any "production" models.
627 #ifdef CONFIG_SND_DEBUG
628 #define alc_gpio_data_info snd_ctl_boolean_mono_info
630 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
631 struct snd_ctl_elem_value *ucontrol)
633 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
634 hda_nid_t nid = kcontrol->private_value & 0xffff;
635 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
636 long *valp = ucontrol->value.integer.value;
637 unsigned int val = snd_hda_codec_read(codec, nid, 0,
638 AC_VERB_GET_GPIO_DATA, 0x00);
640 *valp = (val & mask) != 0;
643 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
644 struct snd_ctl_elem_value *ucontrol)
647 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
648 hda_nid_t nid = kcontrol->private_value & 0xffff;
649 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
650 long val = *ucontrol->value.integer.value;
651 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
652 AC_VERB_GET_GPIO_DATA,
655 /* Set/unset the masked GPIO bit(s) as needed */
656 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
661 snd_hda_codec_write_cache(codec, nid, 0,
662 AC_VERB_SET_GPIO_DATA, gpio_data);
666 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
667 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
668 .info = alc_gpio_data_info, \
669 .get = alc_gpio_data_get, \
670 .put = alc_gpio_data_put, \
671 .private_value = nid | (mask<<16) }
672 #endif /* CONFIG_SND_DEBUG */
674 /* A switch control to allow the enabling of the digital IO pins on the
675 * ALC260. This is incredibly simplistic; the intention of this control is
676 * to provide something in the test model allowing digital outputs to be
677 * identified if present. If models are found which can utilise these
678 * outputs a more complete mixer control can be devised for those models if
681 #ifdef CONFIG_SND_DEBUG
682 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
684 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
685 struct snd_ctl_elem_value *ucontrol)
687 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
688 hda_nid_t nid = kcontrol->private_value & 0xffff;
689 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
690 long *valp = ucontrol->value.integer.value;
691 unsigned int val = snd_hda_codec_read(codec, nid, 0,
692 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
694 *valp = (val & mask) != 0;
697 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
698 struct snd_ctl_elem_value *ucontrol)
701 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
702 hda_nid_t nid = kcontrol->private_value & 0xffff;
703 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
704 long val = *ucontrol->value.integer.value;
705 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
706 AC_VERB_GET_DIGI_CONVERT_1,
709 /* Set/unset the masked control bit(s) as needed */
710 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
715 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
720 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
721 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
722 .info = alc_spdif_ctrl_info, \
723 .get = alc_spdif_ctrl_get, \
724 .put = alc_spdif_ctrl_put, \
725 .private_value = nid | (mask<<16) }
726 #endif /* CONFIG_SND_DEBUG */
728 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
729 * Again, this is only used in the ALC26x test models to help identify when
730 * the EAPD line must be asserted for features to work.
732 #ifdef CONFIG_SND_DEBUG
733 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
735 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
736 struct snd_ctl_elem_value *ucontrol)
738 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
739 hda_nid_t nid = kcontrol->private_value & 0xffff;
740 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
741 long *valp = ucontrol->value.integer.value;
742 unsigned int val = snd_hda_codec_read(codec, nid, 0,
743 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
745 *valp = (val & mask) != 0;
749 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
750 struct snd_ctl_elem_value *ucontrol)
753 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
754 hda_nid_t nid = kcontrol->private_value & 0xffff;
755 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
756 long val = *ucontrol->value.integer.value;
757 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
758 AC_VERB_GET_EAPD_BTLENABLE,
761 /* Set/unset the masked control bit(s) as needed */
762 change = (!val ? 0 : mask) != (ctrl_data & mask);
767 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
773 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
774 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
775 .info = alc_eapd_ctrl_info, \
776 .get = alc_eapd_ctrl_get, \
777 .put = alc_eapd_ctrl_put, \
778 .private_value = nid | (mask<<16) }
779 #endif /* CONFIG_SND_DEBUG */
782 * set up the input pin config (depending on the given auto-pin type)
784 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
787 unsigned int val = PIN_IN;
789 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
791 pincap = snd_hda_query_pin_caps(codec, nid);
792 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
793 if (pincap & AC_PINCAP_VREF_80)
795 else if (pincap & AC_PINCAP_VREF_50)
797 else if (pincap & AC_PINCAP_VREF_100)
799 else if (pincap & AC_PINCAP_VREF_GRD)
802 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
807 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
809 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
811 spec->mixers[spec->num_mixers++] = mix;
814 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
816 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
818 spec->init_verbs[spec->num_init_verbs++] = verb;
821 #ifdef CONFIG_PROC_FS
825 static void print_realtek_coef(struct snd_info_buffer *buffer,
826 struct hda_codec *codec, hda_nid_t nid)
832 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
833 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
834 coeff = snd_hda_codec_read(codec, nid, 0,
835 AC_VERB_GET_COEF_INDEX, 0);
836 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
839 #define print_realtek_coef NULL
843 * set up from the preset table
845 static void setup_preset(struct alc_spec *spec,
846 const struct alc_config_preset *preset)
850 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
851 add_mixer(spec, preset->mixers[i]);
852 spec->cap_mixer = preset->cap_mixer;
853 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
855 add_verb(spec, preset->init_verbs[i]);
857 spec->channel_mode = preset->channel_mode;
858 spec->num_channel_mode = preset->num_channel_mode;
859 spec->need_dac_fix = preset->need_dac_fix;
860 spec->const_channel_count = preset->const_channel_count;
862 if (preset->const_channel_count)
863 spec->multiout.max_channels = preset->const_channel_count;
865 spec->multiout.max_channels = spec->channel_mode[0].channels;
866 spec->ext_channel_count = spec->channel_mode[0].channels;
868 spec->multiout.num_dacs = preset->num_dacs;
869 spec->multiout.dac_nids = preset->dac_nids;
870 spec->multiout.dig_out_nid = preset->dig_out_nid;
871 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
872 spec->multiout.hp_nid = preset->hp_nid;
874 spec->num_mux_defs = preset->num_mux_defs;
875 if (!spec->num_mux_defs)
876 spec->num_mux_defs = 1;
877 spec->input_mux = preset->input_mux;
879 spec->num_adc_nids = preset->num_adc_nids;
880 spec->adc_nids = preset->adc_nids;
881 spec->capsrc_nids = preset->capsrc_nids;
882 spec->dig_in_nid = preset->dig_in_nid;
884 spec->unsol_event = preset->unsol_event;
885 spec->init_hook = preset->init_hook;
886 #ifdef CONFIG_SND_HDA_POWER_SAVE
887 spec->loopback.amplist = preset->loopbacks;
891 /* Enable GPIO mask and set output */
892 static struct hda_verb alc_gpio1_init_verbs[] = {
893 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
894 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
895 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
899 static struct hda_verb alc_gpio2_init_verbs[] = {
900 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
901 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
902 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
906 static struct hda_verb alc_gpio3_init_verbs[] = {
907 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
908 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
909 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
914 * Fix hardware PLL issue
915 * On some codecs, the analog PLL gating control must be off while
916 * the default value is 1.
918 static void alc_fix_pll(struct hda_codec *codec)
920 struct alc_spec *spec = codec->spec;
925 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
927 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
928 AC_VERB_GET_PROC_COEF, 0);
929 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
931 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
932 val & ~(1 << spec->pll_coef_bit));
935 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
936 unsigned int coef_idx, unsigned int coef_bit)
938 struct alc_spec *spec = codec->spec;
940 spec->pll_coef_idx = coef_idx;
941 spec->pll_coef_bit = coef_bit;
945 static void alc_automute_pin(struct hda_codec *codec)
947 struct alc_spec *spec = codec->spec;
948 unsigned int present, pincap;
949 unsigned int nid = spec->autocfg.hp_pins[0];
952 pincap = snd_hda_query_pin_caps(codec, nid);
953 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
954 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
955 present = snd_hda_codec_read(codec, nid, 0,
956 AC_VERB_GET_PIN_SENSE, 0);
957 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
958 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
959 nid = spec->autocfg.speaker_pins[i];
962 snd_hda_codec_write(codec, nid, 0,
963 AC_VERB_SET_PIN_WIDGET_CONTROL,
964 spec->jack_present ? 0 : PIN_OUT);
968 #if 0 /* it's broken in some cases -- temporarily disabled */
969 static void alc_mic_automute(struct hda_codec *codec)
971 struct alc_spec *spec = codec->spec;
972 unsigned int present;
973 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
974 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
975 unsigned int mix_nid = spec->capsrc_nids[0];
976 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
978 capsrc_idx_mic = mic_nid - 0x18;
979 capsrc_idx_fmic = fmic_nid - 0x18;
980 present = snd_hda_codec_read(codec, mic_nid, 0,
981 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
982 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
983 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
984 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
985 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
986 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
987 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
990 #define alc_mic_automute(codec) do {} while(0) /* NOP */
991 #endif /* disabled */
993 /* unsolicited event for HP jack sensing */
994 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
996 if (codec->vendor_id == 0x10ec0880)
1001 case ALC880_HP_EVENT:
1002 alc_automute_pin(codec);
1004 case ALC880_MIC_EVENT:
1005 alc_mic_automute(codec);
1010 static void alc_inithook(struct hda_codec *codec)
1012 alc_automute_pin(codec);
1013 alc_mic_automute(codec);
1016 /* additional initialization for ALC888 variants */
1017 static void alc888_coef_init(struct hda_codec *codec)
1021 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1022 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1023 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1024 if ((tmp & 0xf0) == 0x20)
1026 snd_hda_codec_read(codec, 0x20, 0,
1027 AC_VERB_SET_PROC_COEF, 0x830);
1030 snd_hda_codec_read(codec, 0x20, 0,
1031 AC_VERB_SET_PROC_COEF, 0x3030);
1034 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1039 case ALC_INIT_GPIO1:
1040 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1042 case ALC_INIT_GPIO2:
1043 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1045 case ALC_INIT_GPIO3:
1046 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1048 case ALC_INIT_DEFAULT:
1049 switch (codec->vendor_id) {
1051 snd_hda_codec_write(codec, 0x0f, 0,
1052 AC_VERB_SET_EAPD_BTLENABLE, 2);
1053 snd_hda_codec_write(codec, 0x10, 0,
1054 AC_VERB_SET_EAPD_BTLENABLE, 2);
1066 snd_hda_codec_write(codec, 0x14, 0,
1067 AC_VERB_SET_EAPD_BTLENABLE, 2);
1068 snd_hda_codec_write(codec, 0x15, 0,
1069 AC_VERB_SET_EAPD_BTLENABLE, 2);
1072 switch (codec->vendor_id) {
1074 snd_hda_codec_write(codec, 0x1a, 0,
1075 AC_VERB_SET_COEF_INDEX, 7);
1076 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1077 AC_VERB_GET_PROC_COEF, 0);
1078 snd_hda_codec_write(codec, 0x1a, 0,
1079 AC_VERB_SET_COEF_INDEX, 7);
1080 snd_hda_codec_write(codec, 0x1a, 0,
1081 AC_VERB_SET_PROC_COEF,
1091 snd_hda_codec_write(codec, 0x20, 0,
1092 AC_VERB_SET_COEF_INDEX, 7);
1093 tmp = snd_hda_codec_read(codec, 0x20, 0,
1094 AC_VERB_GET_PROC_COEF, 0);
1095 snd_hda_codec_write(codec, 0x20, 0,
1096 AC_VERB_SET_COEF_INDEX, 7);
1097 snd_hda_codec_write(codec, 0x20, 0,
1098 AC_VERB_SET_PROC_COEF,
1102 alc888_coef_init(codec);
1106 snd_hda_codec_write(codec, 0x20, 0,
1107 AC_VERB_SET_COEF_INDEX, 7);
1108 tmp = snd_hda_codec_read(codec, 0x20, 0,
1109 AC_VERB_GET_PROC_COEF, 0);
1110 snd_hda_codec_write(codec, 0x20, 0,
1111 AC_VERB_SET_COEF_INDEX, 7);
1112 snd_hda_codec_write(codec, 0x20, 0,
1113 AC_VERB_SET_PROC_COEF,
1121 static void alc_init_auto_hp(struct hda_codec *codec)
1123 struct alc_spec *spec = codec->spec;
1125 if (!spec->autocfg.hp_pins[0])
1128 if (!spec->autocfg.speaker_pins[0]) {
1129 if (spec->autocfg.line_out_pins[0] &&
1130 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1131 spec->autocfg.speaker_pins[0] =
1132 spec->autocfg.line_out_pins[0];
1137 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1138 spec->autocfg.hp_pins[0]);
1139 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1140 AC_VERB_SET_UNSOLICITED_ENABLE,
1141 AC_USRSP_EN | ALC880_HP_EVENT);
1142 spec->unsol_event = alc_sku_unsol_event;
1145 /* check subsystem ID and set up device-specific initialization;
1146 * return 1 if initialized, 0 if invalid SSID
1148 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1149 * 31 ~ 16 : Manufacture ID
1151 * 7 ~ 0 : Assembly ID
1152 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1154 static int alc_subsystem_id(struct hda_codec *codec,
1155 hda_nid_t porta, hda_nid_t porte,
1158 unsigned int ass, tmp, i;
1160 struct alc_spec *spec = codec->spec;
1162 ass = codec->subsystem_id & 0xffff;
1163 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1166 /* invalid SSID, check the special NID pin defcfg instead */
1168 * 31~30 : port connectivity
1171 * 19~16 : Check sum (15:1)
1176 if (codec->vendor_id == 0x10ec0260)
1178 ass = snd_hda_codec_get_pincfg(codec, nid);
1179 snd_printd("realtek: No valid SSID, "
1180 "checking pincfg 0x%08x for NID 0x%x\n",
1182 if (!(ass & 1) && !(ass & 0x100000))
1184 if ((ass >> 30) != 1) /* no physical connection */
1189 for (i = 1; i < 16; i++) {
1193 if (((ass >> 16) & 0xf) != tmp)
1196 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1197 ass & 0xffff, codec->vendor_id);
1201 * 2 : 0 --> Desktop, 1 --> Laptop
1202 * 3~5 : External Amplifier control
1205 tmp = (ass & 0x38) >> 3; /* external Amp control */
1208 spec->init_amp = ALC_INIT_GPIO1;
1211 spec->init_amp = ALC_INIT_GPIO2;
1214 spec->init_amp = ALC_INIT_GPIO3;
1217 spec->init_amp = ALC_INIT_DEFAULT;
1221 /* is laptop or Desktop and enable the function "Mute internal speaker
1222 * when the external headphone out jack is plugged"
1224 if (!(ass & 0x8000))
1227 * 10~8 : Jack location
1228 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1230 * 15 : 1 --> enable the function "Mute internal speaker
1231 * when the external headphone out jack is plugged"
1233 if (!spec->autocfg.hp_pins[0]) {
1234 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1236 spec->autocfg.hp_pins[0] = porta;
1238 spec->autocfg.hp_pins[0] = porte;
1240 spec->autocfg.hp_pins[0] = portd;
1245 alc_init_auto_hp(codec);
1249 static void alc_ssid_check(struct hda_codec *codec,
1250 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1252 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1253 struct alc_spec *spec = codec->spec;
1254 snd_printd("realtek: "
1255 "Enable default setup for auto mode as fallback\n");
1256 spec->init_amp = ALC_INIT_DEFAULT;
1257 alc_init_auto_hp(codec);
1262 * Fix-up pin default configurations
1270 static void alc_fix_pincfg(struct hda_codec *codec,
1271 const struct snd_pci_quirk *quirk,
1272 const struct alc_pincfg **pinfix)
1274 const struct alc_pincfg *cfg;
1276 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1280 cfg = pinfix[quirk->value];
1281 for (; cfg->nid; cfg++)
1282 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1292 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1293 /* Mic-in jack as mic in */
1294 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1295 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1296 /* Line-in jack as Line in */
1297 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1298 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1299 /* Line-Out as Front */
1300 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1307 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1308 /* Mic-in jack as mic in */
1309 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1310 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1311 /* Line-in jack as Surround */
1312 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1313 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1314 /* Line-Out as Front */
1315 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1322 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1323 /* Mic-in jack as CLFE */
1324 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1325 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1326 /* Line-in jack as Surround */
1327 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1328 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1329 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1330 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1337 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1338 /* Mic-in jack as CLFE */
1339 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1340 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1341 /* Line-in jack as Surround */
1342 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1343 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1344 /* Line-Out as Side */
1345 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1349 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1350 { 2, alc888_4ST_ch2_intel_init },
1351 { 4, alc888_4ST_ch4_intel_init },
1352 { 6, alc888_4ST_ch6_intel_init },
1353 { 8, alc888_4ST_ch8_intel_init },
1357 * ALC888 Fujitsu Siemens Amillo xa3530
1360 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1361 /* Front Mic: set to PIN_IN (empty by default) */
1362 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1363 /* Connect Internal HP to Front */
1364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1365 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1366 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1367 /* Connect Bass HP to Front */
1368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1370 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1371 /* Connect Line-Out side jack (SPDIF) to Side */
1372 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1373 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1374 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1375 /* Connect Mic jack to CLFE */
1376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1378 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1379 /* Connect Line-in jack to Surround */
1380 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1382 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1383 /* Connect HP out jack to Front */
1384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1385 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1386 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1387 /* Enable unsolicited event for HP jack and Line-out jack */
1388 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1389 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1393 static void alc_automute_amp(struct hda_codec *codec)
1395 struct alc_spec *spec = codec->spec;
1396 unsigned int val, mute, pincap;
1400 spec->jack_present = 0;
1401 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1402 nid = spec->autocfg.hp_pins[i];
1405 pincap = snd_hda_query_pin_caps(codec, nid);
1406 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1407 snd_hda_codec_read(codec, nid, 0,
1408 AC_VERB_SET_PIN_SENSE, 0);
1409 val = snd_hda_codec_read(codec, nid, 0,
1410 AC_VERB_GET_PIN_SENSE, 0);
1411 if (val & AC_PINSENSE_PRESENCE) {
1412 spec->jack_present = 1;
1417 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1418 /* Toggle internal speakers muting */
1419 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1420 nid = spec->autocfg.speaker_pins[i];
1423 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1424 HDA_AMP_MUTE, mute);
1428 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1431 if (codec->vendor_id == 0x10ec0880)
1435 if (res == ALC880_HP_EVENT)
1436 alc_automute_amp(codec);
1439 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1441 struct alc_spec *spec = codec->spec;
1443 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1444 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1445 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1446 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1447 alc_automute_amp(codec);
1451 * ALC888 Acer Aspire 4930G model
1454 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1455 /* Front Mic: set to PIN_IN (empty by default) */
1456 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1457 /* Unselect Front Mic by default in input mixer 3 */
1458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1459 /* Enable unsolicited event for HP jack */
1460 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1461 /* Connect Internal HP to front */
1462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1464 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1465 /* Connect HP out to front */
1466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1468 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1473 * ALC888 Acer Aspire 6530G model
1476 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1477 /* Bias voltage on for external mic port */
1478 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1479 /* Enable unsolicited event for HP jack */
1480 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1481 /* Enable speaker output */
1482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1484 /* Enable headphone output */
1485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1486 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1492 * ALC889 Acer Aspire 8930G model
1495 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1496 /* Front Mic: set to PIN_IN (empty by default) */
1497 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1498 /* Unselect Front Mic by default in input mixer 3 */
1499 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1500 /* Enable unsolicited event for HP jack */
1501 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1502 /* Connect Internal Front to Front */
1503 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1505 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1506 /* Connect Internal Rear to Rear */
1507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1510 /* Connect Internal CLFE to CLFE */
1511 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1514 /* Connect HP out to Front */
1515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1517 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1518 /* Enable all DACs */
1519 /* DAC DISABLE/MUTE 1? */
1520 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1521 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1522 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1523 /* DAC DISABLE/MUTE 2? */
1524 /* some bit here disables the other DACs. Init=0x4900 */
1525 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1526 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1527 /* Enable amplifiers */
1528 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1529 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1531 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1532 * which makes the stereo useless. However, either the mic or the ALC889
1533 * makes the signal become a difference/sum signal instead of standard
1534 * stereo, which is annoying. So instead we flip this bit which makes the
1535 * codec replicate the sum signal to both channels, turning it into a
1538 /* DMIC_CONTROL? Init value = 0x0001 */
1539 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1540 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1544 static struct hda_input_mux alc888_2_capture_sources[2] = {
1545 /* Front mic only available on one ADC */
1552 { "Front Mic", 0xb },
1565 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1566 /* Interal mic only available on one ADC */
1584 static struct hda_input_mux alc889_capture_sources[3] = {
1585 /* Digital mic only available on first "ADC" */
1592 { "Front Mic", 0xb },
1593 { "Input Mix", 0xa },
1602 { "Input Mix", 0xa },
1611 { "Input Mix", 0xa },
1616 static struct snd_kcontrol_new alc888_base_mixer[] = {
1617 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1618 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1619 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1620 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1621 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1623 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1624 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1625 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1626 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1627 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1628 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1629 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1630 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1631 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1633 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1634 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1638 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1640 struct alc_spec *spec = codec->spec;
1642 spec->autocfg.hp_pins[0] = 0x15;
1643 spec->autocfg.speaker_pins[0] = 0x14;
1644 alc_automute_amp(codec);
1647 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1649 struct alc_spec *spec = codec->spec;
1651 spec->autocfg.hp_pins[0] = 0x15;
1652 spec->autocfg.speaker_pins[0] = 0x14;
1653 spec->autocfg.speaker_pins[1] = 0x16;
1654 spec->autocfg.speaker_pins[2] = 0x1b;
1655 alc_automute_amp(codec);
1659 * ALC880 3-stack model
1661 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1662 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1663 * F-Mic = 0x1b, HP = 0x19
1666 static hda_nid_t alc880_dac_nids[4] = {
1667 /* front, rear, clfe, rear_surr */
1668 0x02, 0x05, 0x04, 0x03
1671 static hda_nid_t alc880_adc_nids[3] = {
1676 /* The datasheet says the node 0x07 is connected from inputs,
1677 * but it shows zero connection in the real implementation on some devices.
1678 * Note: this is a 915GAV bug, fixed on 915GLV
1680 static hda_nid_t alc880_adc_nids_alt[2] = {
1685 #define ALC880_DIGOUT_NID 0x06
1686 #define ALC880_DIGIN_NID 0x0a
1688 static struct hda_input_mux alc880_capture_source = {
1692 { "Front Mic", 0x3 },
1698 /* channel source setting (2/6 channel selection for 3-stack) */
1700 static struct hda_verb alc880_threestack_ch2_init[] = {
1701 /* set line-in to input, mute it */
1702 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1703 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1704 /* set mic-in to input vref 80%, mute it */
1705 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1706 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1711 static struct hda_verb alc880_threestack_ch6_init[] = {
1712 /* set line-in to output, unmute it */
1713 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1714 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1715 /* set mic-in to output, unmute it */
1716 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1717 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1721 static struct hda_channel_mode alc880_threestack_modes[2] = {
1722 { 2, alc880_threestack_ch2_init },
1723 { 6, alc880_threestack_ch6_init },
1726 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1727 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1728 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1729 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1730 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1731 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1732 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1733 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1734 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1735 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1736 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1737 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1738 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1740 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1741 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1742 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1743 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1746 .name = "Channel Mode",
1747 .info = alc_ch_mode_info,
1748 .get = alc_ch_mode_get,
1749 .put = alc_ch_mode_put,
1754 /* capture mixer elements */
1755 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1756 struct snd_ctl_elem_info *uinfo)
1758 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1759 struct alc_spec *spec = codec->spec;
1762 mutex_lock(&codec->control_mutex);
1763 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1765 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1766 mutex_unlock(&codec->control_mutex);
1770 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1771 unsigned int size, unsigned int __user *tlv)
1773 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1774 struct alc_spec *spec = codec->spec;
1777 mutex_lock(&codec->control_mutex);
1778 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1780 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1781 mutex_unlock(&codec->control_mutex);
1785 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1786 struct snd_ctl_elem_value *ucontrol);
1788 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1789 struct snd_ctl_elem_value *ucontrol,
1792 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1793 struct alc_spec *spec = codec->spec;
1794 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1797 mutex_lock(&codec->control_mutex);
1798 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1800 err = func(kcontrol, ucontrol);
1801 mutex_unlock(&codec->control_mutex);
1805 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1806 struct snd_ctl_elem_value *ucontrol)
1808 return alc_cap_getput_caller(kcontrol, ucontrol,
1809 snd_hda_mixer_amp_volume_get);
1812 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1813 struct snd_ctl_elem_value *ucontrol)
1815 return alc_cap_getput_caller(kcontrol, ucontrol,
1816 snd_hda_mixer_amp_volume_put);
1819 /* capture mixer elements */
1820 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1822 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1823 struct snd_ctl_elem_value *ucontrol)
1825 return alc_cap_getput_caller(kcontrol, ucontrol,
1826 snd_hda_mixer_amp_switch_get);
1829 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1830 struct snd_ctl_elem_value *ucontrol)
1832 return alc_cap_getput_caller(kcontrol, ucontrol,
1833 snd_hda_mixer_amp_switch_put);
1836 #define _DEFINE_CAPMIX(num) \
1838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1839 .name = "Capture Switch", \
1840 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1842 .info = alc_cap_sw_info, \
1843 .get = alc_cap_sw_get, \
1844 .put = alc_cap_sw_put, \
1847 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1848 .name = "Capture Volume", \
1849 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1850 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1851 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1853 .info = alc_cap_vol_info, \
1854 .get = alc_cap_vol_get, \
1855 .put = alc_cap_vol_put, \
1856 .tlv = { .c = alc_cap_vol_tlv }, \
1859 #define _DEFINE_CAPSRC(num) \
1861 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1862 /* .name = "Capture Source", */ \
1863 .name = "Input Source", \
1865 .info = alc_mux_enum_info, \
1866 .get = alc_mux_enum_get, \
1867 .put = alc_mux_enum_put, \
1870 #define DEFINE_CAPMIX(num) \
1871 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1872 _DEFINE_CAPMIX(num), \
1873 _DEFINE_CAPSRC(num), \
1877 #define DEFINE_CAPMIX_NOSRC(num) \
1878 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1879 _DEFINE_CAPMIX(num), \
1883 /* up to three ADCs */
1887 DEFINE_CAPMIX_NOSRC(1);
1888 DEFINE_CAPMIX_NOSRC(2);
1889 DEFINE_CAPMIX_NOSRC(3);
1892 * ALC880 5-stack model
1894 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1896 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1897 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1900 /* additional mixers to alc880_three_stack_mixer */
1901 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1902 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1903 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1907 /* channel source setting (6/8 channel selection for 5-stack) */
1909 static struct hda_verb alc880_fivestack_ch6_init[] = {
1910 /* set line-in to input, mute it */
1911 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1912 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1917 static struct hda_verb alc880_fivestack_ch8_init[] = {
1918 /* set line-in to output, unmute it */
1919 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1920 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1924 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1925 { 6, alc880_fivestack_ch6_init },
1926 { 8, alc880_fivestack_ch8_init },
1931 * ALC880 6-stack model
1933 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1934 * Side = 0x05 (0x0f)
1935 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1936 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1939 static hda_nid_t alc880_6st_dac_nids[4] = {
1940 /* front, rear, clfe, rear_surr */
1941 0x02, 0x03, 0x04, 0x05
1944 static struct hda_input_mux alc880_6stack_capture_source = {
1948 { "Front Mic", 0x1 },
1954 /* fixed 8-channels */
1955 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1959 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1963 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1965 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1966 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1967 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1968 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1969 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1970 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1971 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1972 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1973 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1976 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1977 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1979 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1980 .name = "Channel Mode",
1981 .info = alc_ch_mode_info,
1982 .get = alc_ch_mode_get,
1983 .put = alc_ch_mode_put,
1992 * W810 has rear IO for:
1995 * Center/LFE (DAC 04)
1998 * The system also has a pair of internal speakers, and a headphone jack.
1999 * These are both connected to Line2 on the codec, hence to DAC 02.
2001 * There is a variable resistor to control the speaker or headphone
2002 * volume. This is a hardware-only device without a software API.
2004 * Plugging headphones in will disable the internal speakers. This is
2005 * implemented in hardware, not via the driver using jack sense. In
2006 * a similar fashion, plugging into the rear socket marked "front" will
2007 * disable both the speakers and headphones.
2009 * For input, there's a microphone jack, and an "audio in" jack.
2010 * These may not do anything useful with this driver yet, because I
2011 * haven't setup any initialization verbs for these yet...
2014 static hda_nid_t alc880_w810_dac_nids[3] = {
2015 /* front, rear/surround, clfe */
2019 /* fixed 6 channels */
2020 static struct hda_channel_mode alc880_w810_modes[1] = {
2024 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2025 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2026 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2027 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2028 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2029 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2030 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2031 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2032 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2033 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2034 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2042 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2043 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2047 static hda_nid_t alc880_z71v_dac_nids[1] = {
2050 #define ALC880_Z71V_HP_DAC 0x03
2052 /* fixed 2 channels */
2053 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2057 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2058 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2059 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2060 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2061 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2062 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2063 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2071 * ALC880 F1734 model
2073 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2074 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2077 static hda_nid_t alc880_f1734_dac_nids[1] = {
2080 #define ALC880_F1734_HP_DAC 0x02
2082 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2083 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2084 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2085 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2086 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2088 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2090 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2094 static struct hda_input_mux alc880_f1734_capture_source = {
2106 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2107 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2108 * Mic = 0x18, Line = 0x1a
2111 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2112 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2114 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2115 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2116 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2117 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2118 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2119 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2120 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2121 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2122 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2123 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2124 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2130 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2131 .name = "Channel Mode",
2132 .info = alc_ch_mode_info,
2133 .get = alc_ch_mode_get,
2134 .put = alc_ch_mode_put,
2140 * ALC880 ASUS W1V model
2142 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2143 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2144 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2147 /* additional mixers to alc880_asus_mixer */
2148 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2149 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2150 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2155 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2156 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2157 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2159 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2160 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2162 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2163 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2164 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2169 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2170 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2171 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2172 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2173 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2174 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2175 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2176 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2177 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2178 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2179 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2180 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2181 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2184 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2185 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2187 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2188 .name = "Channel Mode",
2189 .info = alc_ch_mode_info,
2190 .get = alc_ch_mode_get,
2191 .put = alc_ch_mode_put,
2196 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2197 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2198 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2200 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2201 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2202 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2203 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2204 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2205 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2206 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2210 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2211 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2212 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2214 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2221 * virtual master controls
2225 * slave controls for virtual master
2227 static const char *alc_slave_vols[] = {
2228 "Front Playback Volume",
2229 "Surround Playback Volume",
2230 "Center Playback Volume",
2231 "LFE Playback Volume",
2232 "Side Playback Volume",
2233 "Headphone Playback Volume",
2234 "Speaker Playback Volume",
2235 "Mono Playback Volume",
2236 "Line-Out Playback Volume",
2237 "PCM Playback Volume",
2241 static const char *alc_slave_sws[] = {
2242 "Front Playback Switch",
2243 "Surround Playback Switch",
2244 "Center Playback Switch",
2245 "LFE Playback Switch",
2246 "Side Playback Switch",
2247 "Headphone Playback Switch",
2248 "Speaker Playback Switch",
2249 "Mono Playback Switch",
2250 "IEC958 Playback Switch",
2255 * build control elements
2258 static void alc_free_kctls(struct hda_codec *codec);
2260 /* additional beep mixers; the actual parameters are overwritten at build */
2261 static struct snd_kcontrol_new alc_beep_mixer[] = {
2262 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2263 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2267 static int alc_build_controls(struct hda_codec *codec)
2269 struct alc_spec *spec = codec->spec;
2273 for (i = 0; i < spec->num_mixers; i++) {
2274 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2278 if (spec->cap_mixer) {
2279 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2283 if (spec->multiout.dig_out_nid) {
2284 err = snd_hda_create_spdif_out_ctls(codec,
2285 spec->multiout.dig_out_nid);
2288 if (!spec->no_analog) {
2289 err = snd_hda_create_spdif_share_sw(codec,
2293 spec->multiout.share_spdif = 1;
2296 if (spec->dig_in_nid) {
2297 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2302 /* create beep controls if needed */
2303 if (spec->beep_amp) {
2304 struct snd_kcontrol_new *knew;
2305 for (knew = alc_beep_mixer; knew->name; knew++) {
2306 struct snd_kcontrol *kctl;
2307 kctl = snd_ctl_new1(knew, codec);
2310 kctl->private_value = spec->beep_amp;
2311 err = snd_hda_ctl_add(codec, kctl);
2317 /* if we have no master control, let's create it */
2318 if (!spec->no_analog &&
2319 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2320 unsigned int vmaster_tlv[4];
2321 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2322 HDA_OUTPUT, vmaster_tlv);
2323 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2324 vmaster_tlv, alc_slave_vols);
2328 if (!spec->no_analog &&
2329 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2330 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2331 NULL, alc_slave_sws);
2336 alc_free_kctls(codec); /* no longer needed */
2342 * initialize the codec volumes, etc
2346 * generic initialization of ADC, input mixers and output mixers
2348 static struct hda_verb alc880_volume_init_verbs[] = {
2350 * Unmute ADC0-2 and set the default input to mic-in
2352 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2354 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2356 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2357 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2359 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2361 * Note: PASD motherboards uses the Line In 2 as the input for front
2364 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2374 * Set up output mixers (0x0c - 0x0f)
2376 /* set vol=0 to output mixers */
2377 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2378 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2379 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2380 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2381 /* set up input amps for analog loopback */
2382 /* Amp Indices: DAC = 0, mixer = 1 */
2383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2385 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2386 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2387 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2388 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2390 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2396 * 3-stack pin configuration:
2397 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2399 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2401 * preset connection lists of input pins
2402 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2404 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2405 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2406 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2409 * Set pin mode and muting
2411 /* set front pin widgets 0x14 for output */
2412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2413 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2414 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2415 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2416 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2417 /* Mic2 (as headphone out) for HP output */
2418 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2419 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2420 /* Line In pin widget for input */
2421 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2422 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2423 /* Line2 (as front mic) pin widget for input and vref at 80% */
2424 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2425 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2426 /* CD pin widget for input */
2427 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2433 * 5-stack pin configuration:
2434 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2435 * line-in/side = 0x1a, f-mic = 0x1b
2437 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2439 * preset connection lists of input pins
2440 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2442 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2443 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2446 * Set pin mode and muting
2448 /* set pin widgets 0x14-0x17 for output */
2449 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2450 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2451 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2452 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2453 /* unmute pins for output (no gain on this amp) */
2454 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2456 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2457 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2459 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2460 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2461 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2462 /* Mic2 (as headphone out) for HP output */
2463 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2464 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2465 /* Line In pin widget for input */
2466 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2467 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2468 /* Line2 (as front mic) pin widget for input and vref at 80% */
2469 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2470 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2471 /* CD pin widget for input */
2472 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2478 * W810 pin configuration:
2479 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2481 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2482 /* hphone/speaker input selector: front DAC */
2483 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2488 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2489 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2490 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2492 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2493 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2499 * Z71V pin configuration:
2500 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2502 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2503 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2506 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2509 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2511 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2517 * 6-stack pin configuration:
2518 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2519 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2521 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2522 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2524 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2525 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2527 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2528 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2529 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2530 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2531 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2533 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2534 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2535 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2536 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2537 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2538 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2539 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2540 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2541 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2547 * Uniwill pin configuration:
2548 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2551 static struct hda_verb alc880_uniwill_init_verbs[] = {
2552 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2554 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2555 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2558 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2559 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2560 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2561 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2569 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2570 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2571 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2572 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2573 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2574 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2575 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2576 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2577 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2579 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2580 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2587 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2589 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2590 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2595 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2596 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2597 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2599 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2600 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2601 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2602 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2603 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2605 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2606 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2608 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2609 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2610 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2612 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2613 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2618 static struct hda_verb alc880_beep_init_verbs[] = {
2619 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2623 /* auto-toggle front mic */
2624 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2626 unsigned int present;
2629 present = snd_hda_codec_read(codec, 0x18, 0,
2630 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2631 bits = present ? HDA_AMP_MUTE : 0;
2632 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2635 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2637 struct alc_spec *spec = codec->spec;
2639 spec->autocfg.hp_pins[0] = 0x14;
2640 spec->autocfg.speaker_pins[0] = 0x15;
2641 spec->autocfg.speaker_pins[0] = 0x16;
2642 alc_automute_amp(codec);
2643 alc880_uniwill_mic_automute(codec);
2646 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2649 /* Looks like the unsol event is incompatible with the standard
2650 * definition. 4bit tag is placed at 28 bit!
2652 switch (res >> 28) {
2653 case ALC880_MIC_EVENT:
2654 alc880_uniwill_mic_automute(codec);
2657 alc_automute_amp_unsol_event(codec, res);
2662 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2664 struct alc_spec *spec = codec->spec;
2666 spec->autocfg.hp_pins[0] = 0x14;
2667 spec->autocfg.speaker_pins[0] = 0x15;
2668 alc_automute_amp(codec);
2671 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2673 unsigned int present;
2675 present = snd_hda_codec_read(codec, 0x21, 0,
2676 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2677 present &= HDA_AMP_VOLMASK;
2678 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2679 HDA_AMP_VOLMASK, present);
2680 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2681 HDA_AMP_VOLMASK, present);
2684 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2687 /* Looks like the unsol event is incompatible with the standard
2688 * definition. 4bit tag is placed at 28 bit!
2690 if ((res >> 28) == ALC880_DCVOL_EVENT)
2691 alc880_uniwill_p53_dcvol_automute(codec);
2693 alc_automute_amp_unsol_event(codec, res);
2697 * F1734 pin configuration:
2698 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2700 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2701 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2702 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2703 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2704 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2705 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2708 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2710 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2712 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2713 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2714 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2715 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2716 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2717 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2718 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2719 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2720 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2722 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2723 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2729 * ASUS pin configuration:
2730 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2732 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2733 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2734 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2735 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2736 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2740 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2742 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2743 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2744 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2750 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2752 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2753 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2760 /* Enable GPIO mask and set output */
2761 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2762 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2763 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2765 /* Clevo m520g init */
2766 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2767 /* headphone output */
2768 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2770 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2773 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2774 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2776 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2777 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2778 /* Mic1 (rear panel) */
2779 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2780 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2781 /* Mic2 (front panel) */
2782 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2783 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2786 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2787 /* change to EAPD mode */
2788 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2789 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2794 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2795 /* change to EAPD mode */
2796 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2797 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2799 /* Headphone output */
2800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2802 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2803 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2805 /* Line In pin widget for input */
2806 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2807 /* CD pin widget for input */
2808 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2809 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2812 /* change to EAPD mode */
2813 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2814 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2820 * LG m1 express dual
2823 * Rear Line-In/Out (blue): 0x14
2824 * Build-in Mic-In: 0x15
2826 * HP-Out (green): 0x1b
2827 * Mic-In/Out (red): 0x19
2831 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2832 static hda_nid_t alc880_lg_dac_nids[3] = {
2836 /* seems analog CD is not working */
2837 static struct hda_input_mux alc880_lg_capture_source = {
2842 { "Internal Mic", 0x6 },
2846 /* 2,4,6 channel modes */
2847 static struct hda_verb alc880_lg_ch2_init[] = {
2848 /* set line-in and mic-in to input */
2849 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2850 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2854 static struct hda_verb alc880_lg_ch4_init[] = {
2855 /* set line-in to out and mic-in to input */
2856 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2857 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2861 static struct hda_verb alc880_lg_ch6_init[] = {
2862 /* set line-in and mic-in to output */
2863 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2864 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2868 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2869 { 2, alc880_lg_ch2_init },
2870 { 4, alc880_lg_ch4_init },
2871 { 6, alc880_lg_ch6_init },
2874 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2875 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2876 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2877 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2878 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2879 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2880 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2881 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2882 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2884 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2885 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2886 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2887 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2888 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2890 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2891 .name = "Channel Mode",
2892 .info = alc_ch_mode_info,
2893 .get = alc_ch_mode_get,
2894 .put = alc_ch_mode_put,
2899 static struct hda_verb alc880_lg_init_verbs[] = {
2900 /* set capture source to mic-in */
2901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2902 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2903 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2904 /* mute all amp mixer inputs */
2905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2908 /* line-in to input */
2909 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2912 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2916 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 /* mic-in to input */
2918 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2919 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2920 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2922 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2923 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2924 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2926 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2930 /* toggle speaker-output according to the hp-jack state */
2931 static void alc880_lg_init_hook(struct hda_codec *codec)
2933 struct alc_spec *spec = codec->spec;
2935 spec->autocfg.hp_pins[0] = 0x1b;
2936 spec->autocfg.speaker_pins[0] = 0x17;
2937 alc_automute_amp(codec);
2946 * Built-in Mic-In: 0x19
2952 static struct hda_input_mux alc880_lg_lw_capture_source = {
2956 { "Internal Mic", 0x1 },
2961 #define alc880_lg_lw_modes alc880_threestack_modes
2963 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2964 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2965 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2966 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2967 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2968 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2969 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2970 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2971 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2972 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2973 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2976 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2977 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2979 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2980 .name = "Channel Mode",
2981 .info = alc_ch_mode_info,
2982 .get = alc_ch_mode_get,
2983 .put = alc_ch_mode_put,
2988 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2989 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2990 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2991 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2993 /* set capture source to mic-in */
2994 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2995 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2999 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3002 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3003 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3004 /* mic-in to input */
3005 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3006 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3008 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3009 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3011 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3015 /* toggle speaker-output according to the hp-jack state */
3016 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3018 struct alc_spec *spec = codec->spec;
3020 spec->autocfg.hp_pins[0] = 0x1b;
3021 spec->autocfg.speaker_pins[0] = 0x14;
3022 alc_automute_amp(codec);
3025 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3026 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3027 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3030 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3031 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3035 static struct hda_input_mux alc880_medion_rim_capture_source = {
3039 { "Internal Mic", 0x1 },
3043 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3044 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3049 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3050 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3051 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3052 /* Mic2 (as headphone out) for HP output */
3053 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3054 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3055 /* Internal Speaker */
3056 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3057 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3060 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3062 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3066 /* toggle speaker-output according to the hp-jack state */
3067 static void alc880_medion_rim_automute(struct hda_codec *codec)
3069 struct alc_spec *spec = codec->spec;
3070 alc_automute_amp(codec);
3072 if (spec->jack_present)
3073 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3075 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3078 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3081 /* Looks like the unsol event is incompatible with the standard
3082 * definition. 4bit tag is placed at 28 bit!
3084 if ((res >> 28) == ALC880_HP_EVENT)
3085 alc880_medion_rim_automute(codec);
3088 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3090 struct alc_spec *spec = codec->spec;
3092 spec->autocfg.hp_pins[0] = 0x14;
3093 spec->autocfg.speaker_pins[0] = 0x1b;
3094 alc880_medion_rim_automute(codec);
3097 #ifdef CONFIG_SND_HDA_POWER_SAVE
3098 static struct hda_amp_list alc880_loopbacks[] = {
3099 { 0x0b, HDA_INPUT, 0 },
3100 { 0x0b, HDA_INPUT, 1 },
3101 { 0x0b, HDA_INPUT, 2 },
3102 { 0x0b, HDA_INPUT, 3 },
3103 { 0x0b, HDA_INPUT, 4 },
3107 static struct hda_amp_list alc880_lg_loopbacks[] = {
3108 { 0x0b, HDA_INPUT, 1 },
3109 { 0x0b, HDA_INPUT, 6 },
3110 { 0x0b, HDA_INPUT, 7 },
3119 static int alc_init(struct hda_codec *codec)
3121 struct alc_spec *spec = codec->spec;
3125 alc_auto_init_amp(codec, spec->init_amp);
3127 for (i = 0; i < spec->num_init_verbs; i++)
3128 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3130 if (spec->init_hook)
3131 spec->init_hook(codec);
3136 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3138 struct alc_spec *spec = codec->spec;
3140 if (spec->unsol_event)
3141 spec->unsol_event(codec, res);
3144 #ifdef CONFIG_SND_HDA_POWER_SAVE
3145 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3147 struct alc_spec *spec = codec->spec;
3148 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3153 * Analog playback callbacks
3155 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3156 struct hda_codec *codec,
3157 struct snd_pcm_substream *substream)
3159 struct alc_spec *spec = codec->spec;
3160 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3164 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3165 struct hda_codec *codec,
3166 unsigned int stream_tag,
3167 unsigned int format,
3168 struct snd_pcm_substream *substream)
3170 struct alc_spec *spec = codec->spec;
3171 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3172 stream_tag, format, substream);
3175 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3176 struct hda_codec *codec,
3177 struct snd_pcm_substream *substream)
3179 struct alc_spec *spec = codec->spec;
3180 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3186 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3187 struct hda_codec *codec,
3188 struct snd_pcm_substream *substream)
3190 struct alc_spec *spec = codec->spec;
3191 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3194 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3195 struct hda_codec *codec,
3196 unsigned int stream_tag,
3197 unsigned int format,
3198 struct snd_pcm_substream *substream)
3200 struct alc_spec *spec = codec->spec;
3201 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3202 stream_tag, format, substream);
3205 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3206 struct hda_codec *codec,
3207 struct snd_pcm_substream *substream)
3209 struct alc_spec *spec = codec->spec;
3210 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3213 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3214 struct hda_codec *codec,
3215 struct snd_pcm_substream *substream)
3217 struct alc_spec *spec = codec->spec;
3218 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3224 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3225 struct hda_codec *codec,
3226 unsigned int stream_tag,
3227 unsigned int format,
3228 struct snd_pcm_substream *substream)
3230 struct alc_spec *spec = codec->spec;
3232 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3233 stream_tag, 0, format);
3237 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3238 struct hda_codec *codec,
3239 struct snd_pcm_substream *substream)
3241 struct alc_spec *spec = codec->spec;
3243 snd_hda_codec_cleanup_stream(codec,
3244 spec->adc_nids[substream->number + 1]);
3251 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3255 /* NID is set in alc_build_pcms */
3257 .open = alc880_playback_pcm_open,
3258 .prepare = alc880_playback_pcm_prepare,
3259 .cleanup = alc880_playback_pcm_cleanup
3263 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3267 /* NID is set in alc_build_pcms */
3270 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3274 /* NID is set in alc_build_pcms */
3277 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3278 .substreams = 2, /* can be overridden */
3281 /* NID is set in alc_build_pcms */
3283 .prepare = alc880_alt_capture_pcm_prepare,
3284 .cleanup = alc880_alt_capture_pcm_cleanup
3288 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3292 /* NID is set in alc_build_pcms */
3294 .open = alc880_dig_playback_pcm_open,
3295 .close = alc880_dig_playback_pcm_close,
3296 .prepare = alc880_dig_playback_pcm_prepare,
3297 .cleanup = alc880_dig_playback_pcm_cleanup
3301 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3305 /* NID is set in alc_build_pcms */
3308 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3309 static struct hda_pcm_stream alc_pcm_null_stream = {
3315 static int alc_build_pcms(struct hda_codec *codec)
3317 struct alc_spec *spec = codec->spec;
3318 struct hda_pcm *info = spec->pcm_rec;
3321 codec->num_pcms = 1;
3322 codec->pcm_info = info;
3324 if (spec->no_analog)
3327 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3328 "%s Analog", codec->chip_name);
3329 info->name = spec->stream_name_analog;
3331 if (spec->stream_analog_playback) {
3332 if (snd_BUG_ON(!spec->multiout.dac_nids))
3334 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3335 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3337 if (spec->stream_analog_capture) {
3338 if (snd_BUG_ON(!spec->adc_nids))
3340 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3341 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3344 if (spec->channel_mode) {
3345 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3346 for (i = 0; i < spec->num_channel_mode; i++) {
3347 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3348 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3354 /* SPDIF for stream index #1 */
3355 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3356 snprintf(spec->stream_name_digital,
3357 sizeof(spec->stream_name_digital),
3358 "%s Digital", codec->chip_name);
3359 codec->num_pcms = 2;
3360 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3361 info = spec->pcm_rec + 1;
3362 info->name = spec->stream_name_digital;
3363 if (spec->dig_out_type)
3364 info->pcm_type = spec->dig_out_type;
3366 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3367 if (spec->multiout.dig_out_nid &&
3368 spec->stream_digital_playback) {
3369 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3370 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3372 if (spec->dig_in_nid &&
3373 spec->stream_digital_capture) {
3374 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3375 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3377 /* FIXME: do we need this for all Realtek codec models? */
3378 codec->spdif_status_reset = 1;
3381 if (spec->no_analog)
3384 /* If the use of more than one ADC is requested for the current
3385 * model, configure a second analog capture-only PCM.
3387 /* Additional Analaog capture for index #2 */
3388 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3389 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3390 codec->num_pcms = 3;
3391 info = spec->pcm_rec + 2;
3392 info->name = spec->stream_name_analog;
3393 if (spec->alt_dac_nid) {
3394 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3395 *spec->stream_analog_alt_playback;
3396 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3399 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3400 alc_pcm_null_stream;
3401 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3403 if (spec->num_adc_nids > 1) {
3404 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3405 *spec->stream_analog_alt_capture;
3406 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3408 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3409 spec->num_adc_nids - 1;
3411 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3412 alc_pcm_null_stream;
3413 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3420 static void alc_free_kctls(struct hda_codec *codec)
3422 struct alc_spec *spec = codec->spec;
3424 if (spec->kctls.list) {
3425 struct snd_kcontrol_new *kctl = spec->kctls.list;
3427 for (i = 0; i < spec->kctls.used; i++)
3428 kfree(kctl[i].name);
3430 snd_array_free(&spec->kctls);
3433 static void alc_free(struct hda_codec *codec)
3435 struct alc_spec *spec = codec->spec;
3440 alc_free_kctls(codec);
3442 snd_hda_detach_beep_device(codec);
3445 #ifdef SND_HDA_NEEDS_RESUME
3446 static int alc_resume(struct hda_codec *codec)
3448 codec->patch_ops.init(codec);
3449 snd_hda_codec_resume_amp(codec);
3450 snd_hda_codec_resume_cache(codec);
3457 static struct hda_codec_ops alc_patch_ops = {
3458 .build_controls = alc_build_controls,
3459 .build_pcms = alc_build_pcms,
3462 .unsol_event = alc_unsol_event,
3463 #ifdef SND_HDA_NEEDS_RESUME
3464 .resume = alc_resume,
3466 #ifdef CONFIG_SND_HDA_POWER_SAVE
3467 .check_power_status = alc_check_power_status,
3473 * Test configuration for debugging
3475 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3478 #ifdef CONFIG_SND_DEBUG
3479 static hda_nid_t alc880_test_dac_nids[4] = {
3480 0x02, 0x03, 0x04, 0x05
3483 static struct hda_input_mux alc880_test_capture_source = {
3492 { "Surround", 0x6 },
3496 static struct hda_channel_mode alc880_test_modes[4] = {
3503 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3504 struct snd_ctl_elem_info *uinfo)
3506 static char *texts[] = {
3507 "N/A", "Line Out", "HP Out",
3508 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3510 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3512 uinfo->value.enumerated.items = 8;
3513 if (uinfo->value.enumerated.item >= 8)
3514 uinfo->value.enumerated.item = 7;
3515 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3519 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3520 struct snd_ctl_elem_value *ucontrol)
3522 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3523 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3524 unsigned int pin_ctl, item = 0;
3526 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3527 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3528 if (pin_ctl & AC_PINCTL_OUT_EN) {
3529 if (pin_ctl & AC_PINCTL_HP_EN)
3533 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3534 switch (pin_ctl & AC_PINCTL_VREFEN) {
3535 case AC_PINCTL_VREF_HIZ: item = 3; break;
3536 case AC_PINCTL_VREF_50: item = 4; break;
3537 case AC_PINCTL_VREF_GRD: item = 5; break;
3538 case AC_PINCTL_VREF_80: item = 6; break;
3539 case AC_PINCTL_VREF_100: item = 7; break;
3542 ucontrol->value.enumerated.item[0] = item;
3546 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3547 struct snd_ctl_elem_value *ucontrol)
3549 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3550 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3551 static unsigned int ctls[] = {
3552 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3553 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3554 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3555 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3556 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3557 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3559 unsigned int old_ctl, new_ctl;
3561 old_ctl = snd_hda_codec_read(codec, nid, 0,
3562 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3563 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3564 if (old_ctl != new_ctl) {
3566 snd_hda_codec_write_cache(codec, nid, 0,
3567 AC_VERB_SET_PIN_WIDGET_CONTROL,
3569 val = ucontrol->value.enumerated.item[0] >= 3 ?
3571 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3578 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3579 struct snd_ctl_elem_info *uinfo)
3581 static char *texts[] = {
3582 "Front", "Surround", "CLFE", "Side"
3584 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3586 uinfo->value.enumerated.items = 4;
3587 if (uinfo->value.enumerated.item >= 4)
3588 uinfo->value.enumerated.item = 3;
3589 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3593 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3594 struct snd_ctl_elem_value *ucontrol)
3596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3597 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3600 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3601 ucontrol->value.enumerated.item[0] = sel & 3;
3605 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3606 struct snd_ctl_elem_value *ucontrol)
3608 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3609 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3612 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3613 if (ucontrol->value.enumerated.item[0] != sel) {
3614 sel = ucontrol->value.enumerated.item[0] & 3;
3615 snd_hda_codec_write_cache(codec, nid, 0,
3616 AC_VERB_SET_CONNECT_SEL, sel);
3622 #define PIN_CTL_TEST(xname,nid) { \
3623 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3625 .info = alc_test_pin_ctl_info, \
3626 .get = alc_test_pin_ctl_get, \
3627 .put = alc_test_pin_ctl_put, \
3628 .private_value = nid \
3631 #define PIN_SRC_TEST(xname,nid) { \
3632 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3634 .info = alc_test_pin_src_info, \
3635 .get = alc_test_pin_src_get, \
3636 .put = alc_test_pin_src_put, \
3637 .private_value = nid \
3640 static struct snd_kcontrol_new alc880_test_mixer[] = {
3641 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3642 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3643 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3644 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3645 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3646 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3647 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3648 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3649 PIN_CTL_TEST("Front Pin Mode", 0x14),
3650 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3651 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3652 PIN_CTL_TEST("Side Pin Mode", 0x17),
3653 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3654 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3655 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3656 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3657 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3658 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3659 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3660 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3661 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3662 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3663 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3664 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3665 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3666 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3667 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3668 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3669 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3670 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3672 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3673 .name = "Channel Mode",
3674 .info = alc_ch_mode_info,
3675 .get = alc_ch_mode_get,
3676 .put = alc_ch_mode_put,
3681 static struct hda_verb alc880_test_init_verbs[] = {
3682 /* Unmute inputs of 0x0c - 0x0f */
3683 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3685 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3686 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3687 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3688 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3689 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3690 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3691 /* Vol output for 0x0c-0x0f */
3692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3693 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3694 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3695 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3696 /* Set output pins 0x14-0x17 */
3697 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3699 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3700 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3701 /* Unmute output pins 0x14-0x17 */
3702 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3704 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3705 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3706 /* Set input pins 0x18-0x1c */
3707 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3708 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3709 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3712 /* Mute input pins 0x18-0x1b */
3713 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3714 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3716 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3719 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3720 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3721 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3722 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3723 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3724 /* Analog input/passthru */
3725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3737 static const char *alc880_models[ALC880_MODEL_LAST] = {
3738 [ALC880_3ST] = "3stack",
3739 [ALC880_TCL_S700] = "tcl",
3740 [ALC880_3ST_DIG] = "3stack-digout",
3741 [ALC880_CLEVO] = "clevo",
3742 [ALC880_5ST] = "5stack",
3743 [ALC880_5ST_DIG] = "5stack-digout",
3744 [ALC880_W810] = "w810",
3745 [ALC880_Z71V] = "z71v",
3746 [ALC880_6ST] = "6stack",
3747 [ALC880_6ST_DIG] = "6stack-digout",
3748 [ALC880_ASUS] = "asus",
3749 [ALC880_ASUS_W1V] = "asus-w1v",
3750 [ALC880_ASUS_DIG] = "asus-dig",
3751 [ALC880_ASUS_DIG2] = "asus-dig2",
3752 [ALC880_UNIWILL_DIG] = "uniwill",
3753 [ALC880_UNIWILL_P53] = "uniwill-p53",
3754 [ALC880_FUJITSU] = "fujitsu",
3755 [ALC880_F1734] = "F1734",
3757 [ALC880_LG_LW] = "lg-lw",
3758 [ALC880_MEDION_RIM] = "medion",
3759 #ifdef CONFIG_SND_DEBUG
3760 [ALC880_TEST] = "test",
3762 [ALC880_AUTO] = "auto",
3765 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3766 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3767 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3768 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3769 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3770 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3771 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3772 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3773 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3774 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3775 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3776 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3777 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3778 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3779 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3780 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3781 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3782 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3783 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3784 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3785 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3786 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3787 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3788 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3789 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3790 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3791 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3792 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3793 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3794 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3795 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3796 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3797 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3798 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3799 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3800 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3801 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3802 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3803 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3804 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3805 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3806 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3807 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3808 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3809 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3810 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3811 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3812 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3813 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3814 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3815 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3816 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3817 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3818 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3819 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3820 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3821 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3822 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3823 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3824 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3825 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3826 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3827 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3828 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3829 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3830 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3831 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3832 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3833 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3835 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3836 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3837 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3842 * ALC880 codec presets
3844 static struct alc_config_preset alc880_presets[] = {
3846 .mixers = { alc880_three_stack_mixer },
3847 .init_verbs = { alc880_volume_init_verbs,
3848 alc880_pin_3stack_init_verbs },
3849 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3850 .dac_nids = alc880_dac_nids,
3851 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3852 .channel_mode = alc880_threestack_modes,
3854 .input_mux = &alc880_capture_source,
3856 [ALC880_3ST_DIG] = {
3857 .mixers = { alc880_three_stack_mixer },
3858 .init_verbs = { alc880_volume_init_verbs,
3859 alc880_pin_3stack_init_verbs },
3860 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3861 .dac_nids = alc880_dac_nids,
3862 .dig_out_nid = ALC880_DIGOUT_NID,
3863 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3864 .channel_mode = alc880_threestack_modes,
3866 .input_mux = &alc880_capture_source,
3868 [ALC880_TCL_S700] = {
3869 .mixers = { alc880_tcl_s700_mixer },
3870 .init_verbs = { alc880_volume_init_verbs,
3871 alc880_pin_tcl_S700_init_verbs,
3872 alc880_gpio2_init_verbs },
3873 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3874 .dac_nids = alc880_dac_nids,
3875 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3876 .num_adc_nids = 1, /* single ADC */
3878 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3879 .channel_mode = alc880_2_jack_modes,
3880 .input_mux = &alc880_capture_source,
3883 .mixers = { alc880_three_stack_mixer,
3884 alc880_five_stack_mixer},
3885 .init_verbs = { alc880_volume_init_verbs,
3886 alc880_pin_5stack_init_verbs },
3887 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3888 .dac_nids = alc880_dac_nids,
3889 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3890 .channel_mode = alc880_fivestack_modes,
3891 .input_mux = &alc880_capture_source,
3893 [ALC880_5ST_DIG] = {
3894 .mixers = { alc880_three_stack_mixer,
3895 alc880_five_stack_mixer },
3896 .init_verbs = { alc880_volume_init_verbs,
3897 alc880_pin_5stack_init_verbs },
3898 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3899 .dac_nids = alc880_dac_nids,
3900 .dig_out_nid = ALC880_DIGOUT_NID,
3901 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3902 .channel_mode = alc880_fivestack_modes,
3903 .input_mux = &alc880_capture_source,
3906 .mixers = { alc880_six_stack_mixer },
3907 .init_verbs = { alc880_volume_init_verbs,
3908 alc880_pin_6stack_init_verbs },
3909 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3910 .dac_nids = alc880_6st_dac_nids,
3911 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3912 .channel_mode = alc880_sixstack_modes,
3913 .input_mux = &alc880_6stack_capture_source,
3915 [ALC880_6ST_DIG] = {
3916 .mixers = { alc880_six_stack_mixer },
3917 .init_verbs = { alc880_volume_init_verbs,
3918 alc880_pin_6stack_init_verbs },
3919 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3920 .dac_nids = alc880_6st_dac_nids,
3921 .dig_out_nid = ALC880_DIGOUT_NID,
3922 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3923 .channel_mode = alc880_sixstack_modes,
3924 .input_mux = &alc880_6stack_capture_source,
3927 .mixers = { alc880_w810_base_mixer },
3928 .init_verbs = { alc880_volume_init_verbs,
3929 alc880_pin_w810_init_verbs,
3930 alc880_gpio2_init_verbs },
3931 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3932 .dac_nids = alc880_w810_dac_nids,
3933 .dig_out_nid = ALC880_DIGOUT_NID,
3934 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3935 .channel_mode = alc880_w810_modes,
3936 .input_mux = &alc880_capture_source,
3939 .mixers = { alc880_z71v_mixer },
3940 .init_verbs = { alc880_volume_init_verbs,
3941 alc880_pin_z71v_init_verbs },
3942 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3943 .dac_nids = alc880_z71v_dac_nids,
3944 .dig_out_nid = ALC880_DIGOUT_NID,
3946 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3947 .channel_mode = alc880_2_jack_modes,
3948 .input_mux = &alc880_capture_source,
3951 .mixers = { alc880_f1734_mixer },
3952 .init_verbs = { alc880_volume_init_verbs,
3953 alc880_pin_f1734_init_verbs },
3954 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3955 .dac_nids = alc880_f1734_dac_nids,
3957 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3958 .channel_mode = alc880_2_jack_modes,
3959 .input_mux = &alc880_f1734_capture_source,
3960 .unsol_event = alc880_uniwill_p53_unsol_event,
3961 .init_hook = alc880_uniwill_p53_init_hook,
3964 .mixers = { alc880_asus_mixer },
3965 .init_verbs = { alc880_volume_init_verbs,
3966 alc880_pin_asus_init_verbs,
3967 alc880_gpio1_init_verbs },
3968 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3969 .dac_nids = alc880_asus_dac_nids,
3970 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3971 .channel_mode = alc880_asus_modes,
3973 .input_mux = &alc880_capture_source,
3975 [ALC880_ASUS_DIG] = {
3976 .mixers = { alc880_asus_mixer },
3977 .init_verbs = { alc880_volume_init_verbs,
3978 alc880_pin_asus_init_verbs,
3979 alc880_gpio1_init_verbs },
3980 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3981 .dac_nids = alc880_asus_dac_nids,
3982 .dig_out_nid = ALC880_DIGOUT_NID,
3983 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3984 .channel_mode = alc880_asus_modes,
3986 .input_mux = &alc880_capture_source,
3988 [ALC880_ASUS_DIG2] = {
3989 .mixers = { alc880_asus_mixer },
3990 .init_verbs = { alc880_volume_init_verbs,
3991 alc880_pin_asus_init_verbs,
3992 alc880_gpio2_init_verbs }, /* use GPIO2 */
3993 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3994 .dac_nids = alc880_asus_dac_nids,
3995 .dig_out_nid = ALC880_DIGOUT_NID,
3996 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3997 .channel_mode = alc880_asus_modes,
3999 .input_mux = &alc880_capture_source,
4001 [ALC880_ASUS_W1V] = {
4002 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4003 .init_verbs = { alc880_volume_init_verbs,
4004 alc880_pin_asus_init_verbs,
4005 alc880_gpio1_init_verbs },
4006 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4007 .dac_nids = alc880_asus_dac_nids,
4008 .dig_out_nid = ALC880_DIGOUT_NID,
4009 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4010 .channel_mode = alc880_asus_modes,
4012 .input_mux = &alc880_capture_source,
4014 [ALC880_UNIWILL_DIG] = {
4015 .mixers = { alc880_asus_mixer },
4016 .init_verbs = { alc880_volume_init_verbs,
4017 alc880_pin_asus_init_verbs },
4018 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4019 .dac_nids = alc880_asus_dac_nids,
4020 .dig_out_nid = ALC880_DIGOUT_NID,
4021 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4022 .channel_mode = alc880_asus_modes,
4024 .input_mux = &alc880_capture_source,
4026 [ALC880_UNIWILL] = {
4027 .mixers = { alc880_uniwill_mixer },
4028 .init_verbs = { alc880_volume_init_verbs,
4029 alc880_uniwill_init_verbs },
4030 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4031 .dac_nids = alc880_asus_dac_nids,
4032 .dig_out_nid = ALC880_DIGOUT_NID,
4033 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4034 .channel_mode = alc880_threestack_modes,
4036 .input_mux = &alc880_capture_source,
4037 .unsol_event = alc880_uniwill_unsol_event,
4038 .init_hook = alc880_uniwill_init_hook,
4040 [ALC880_UNIWILL_P53] = {
4041 .mixers = { alc880_uniwill_p53_mixer },
4042 .init_verbs = { alc880_volume_init_verbs,
4043 alc880_uniwill_p53_init_verbs },
4044 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4045 .dac_nids = alc880_asus_dac_nids,
4046 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4047 .channel_mode = alc880_threestack_modes,
4048 .input_mux = &alc880_capture_source,
4049 .unsol_event = alc880_uniwill_p53_unsol_event,
4050 .init_hook = alc880_uniwill_p53_init_hook,
4052 [ALC880_FUJITSU] = {
4053 .mixers = { alc880_fujitsu_mixer },
4054 .init_verbs = { alc880_volume_init_verbs,
4055 alc880_uniwill_p53_init_verbs,
4056 alc880_beep_init_verbs },
4057 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4058 .dac_nids = alc880_dac_nids,
4059 .dig_out_nid = ALC880_DIGOUT_NID,
4060 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4061 .channel_mode = alc880_2_jack_modes,
4062 .input_mux = &alc880_capture_source,
4063 .unsol_event = alc880_uniwill_p53_unsol_event,
4064 .init_hook = alc880_uniwill_p53_init_hook,
4067 .mixers = { alc880_three_stack_mixer },
4068 .init_verbs = { alc880_volume_init_verbs,
4069 alc880_pin_clevo_init_verbs },
4070 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4071 .dac_nids = alc880_dac_nids,
4073 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4074 .channel_mode = alc880_threestack_modes,
4076 .input_mux = &alc880_capture_source,
4079 .mixers = { alc880_lg_mixer },
4080 .init_verbs = { alc880_volume_init_verbs,
4081 alc880_lg_init_verbs },
4082 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4083 .dac_nids = alc880_lg_dac_nids,
4084 .dig_out_nid = ALC880_DIGOUT_NID,
4085 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4086 .channel_mode = alc880_lg_ch_modes,
4088 .input_mux = &alc880_lg_capture_source,
4089 .unsol_event = alc_automute_amp_unsol_event,
4090 .init_hook = alc880_lg_init_hook,
4091 #ifdef CONFIG_SND_HDA_POWER_SAVE
4092 .loopbacks = alc880_lg_loopbacks,
4096 .mixers = { alc880_lg_lw_mixer },
4097 .init_verbs = { alc880_volume_init_verbs,
4098 alc880_lg_lw_init_verbs },
4099 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4100 .dac_nids = alc880_dac_nids,
4101 .dig_out_nid = ALC880_DIGOUT_NID,
4102 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4103 .channel_mode = alc880_lg_lw_modes,
4104 .input_mux = &alc880_lg_lw_capture_source,
4105 .unsol_event = alc_automute_amp_unsol_event,
4106 .init_hook = alc880_lg_lw_init_hook,
4108 [ALC880_MEDION_RIM] = {
4109 .mixers = { alc880_medion_rim_mixer },
4110 .init_verbs = { alc880_volume_init_verbs,
4111 alc880_medion_rim_init_verbs,
4112 alc_gpio2_init_verbs },
4113 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4114 .dac_nids = alc880_dac_nids,
4115 .dig_out_nid = ALC880_DIGOUT_NID,
4116 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4117 .channel_mode = alc880_2_jack_modes,
4118 .input_mux = &alc880_medion_rim_capture_source,
4119 .unsol_event = alc880_medion_rim_unsol_event,
4120 .init_hook = alc880_medion_rim_init_hook,
4122 #ifdef CONFIG_SND_DEBUG
4124 .mixers = { alc880_test_mixer },
4125 .init_verbs = { alc880_test_init_verbs },
4126 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4127 .dac_nids = alc880_test_dac_nids,
4128 .dig_out_nid = ALC880_DIGOUT_NID,
4129 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4130 .channel_mode = alc880_test_modes,
4131 .input_mux = &alc880_test_capture_source,
4137 * Automatic parse of I/O pins from the BIOS configuration
4142 ALC_CTL_WIDGET_MUTE,
4145 static struct snd_kcontrol_new alc880_control_templates[] = {
4146 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4147 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4148 HDA_BIND_MUTE(NULL, 0, 0, 0),
4151 /* add dynamic controls */
4152 static int add_control(struct alc_spec *spec, int type, const char *name,
4155 struct snd_kcontrol_new *knew;
4157 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4158 knew = snd_array_new(&spec->kctls);
4161 *knew = alc880_control_templates[type];
4162 knew->name = kstrdup(name, GFP_KERNEL);
4165 knew->private_value = val;
4169 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4170 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4171 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4172 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4173 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4174 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4175 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4176 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4177 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4178 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4179 #define ALC880_PIN_CD_NID 0x1c
4181 /* fill in the dac_nids table from the parsed pin configuration */
4182 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4183 const struct auto_pin_cfg *cfg)
4189 memset(assigned, 0, sizeof(assigned));
4190 spec->multiout.dac_nids = spec->private_dac_nids;
4192 /* check the pins hardwired to audio widget */
4193 for (i = 0; i < cfg->line_outs; i++) {
4194 nid = cfg->line_out_pins[i];
4195 if (alc880_is_fixed_pin(nid)) {
4196 int idx = alc880_fixed_pin_idx(nid);
4197 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4201 /* left pins can be connect to any audio widget */
4202 for (i = 0; i < cfg->line_outs; i++) {
4203 nid = cfg->line_out_pins[i];
4204 if (alc880_is_fixed_pin(nid))
4206 /* search for an empty channel */
4207 for (j = 0; j < cfg->line_outs; j++) {
4209 spec->multiout.dac_nids[i] =
4210 alc880_idx_to_dac(j);
4216 spec->multiout.num_dacs = cfg->line_outs;
4220 /* add playback controls from the parsed DAC table */
4221 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4222 const struct auto_pin_cfg *cfg)
4225 static const char *chname[4] = {
4226 "Front", "Surround", NULL /*CLFE*/, "Side"
4231 for (i = 0; i < cfg->line_outs; i++) {
4232 if (!spec->multiout.dac_nids[i])
4234 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4237 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4238 "Center Playback Volume",
4239 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4243 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4244 "LFE Playback Volume",
4245 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4249 err = add_control(spec, ALC_CTL_BIND_MUTE,
4250 "Center Playback Switch",
4251 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4255 err = add_control(spec, ALC_CTL_BIND_MUTE,
4256 "LFE Playback Switch",
4257 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4262 sprintf(name, "%s Playback Volume", chname[i]);
4263 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4264 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4268 sprintf(name, "%s Playback Switch", chname[i]);
4269 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4270 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4279 /* add playback controls for speaker and HP outputs */
4280 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4290 if (alc880_is_fixed_pin(pin)) {
4291 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4292 /* specify the DAC as the extra output */
4293 if (!spec->multiout.hp_nid)
4294 spec->multiout.hp_nid = nid;
4296 spec->multiout.extra_out_nid[0] = nid;
4297 /* control HP volume/switch on the output mixer amp */
4298 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4299 sprintf(name, "%s Playback Volume", pfx);
4300 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4301 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4304 sprintf(name, "%s Playback Switch", pfx);
4305 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4306 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4309 } else if (alc880_is_multi_pin(pin)) {
4310 /* set manual connection */
4311 /* we have only a switch on HP-out PIN */
4312 sprintf(name, "%s Playback Switch", pfx);
4313 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4314 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4321 /* create input playback/capture controls for the given pin */
4322 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4323 const char *ctlname,
4324 int idx, hda_nid_t mix_nid)
4329 sprintf(name, "%s Playback Volume", ctlname);
4330 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4331 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4334 sprintf(name, "%s Playback Switch", ctlname);
4335 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4336 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4342 /* create playback/capture controls for input pins */
4343 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4344 const struct auto_pin_cfg *cfg)
4346 struct hda_input_mux *imux = &spec->private_imux[0];
4349 for (i = 0; i < AUTO_PIN_LAST; i++) {
4350 if (alc880_is_input_pin(cfg->input_pins[i])) {
4351 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4352 err = new_analog_input(spec, cfg->input_pins[i],
4353 auto_pin_cfg_labels[i],
4357 imux->items[imux->num_items].label =
4358 auto_pin_cfg_labels[i];
4359 imux->items[imux->num_items].index =
4360 alc880_input_pin_idx(cfg->input_pins[i]);
4367 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4368 unsigned int pin_type)
4370 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4373 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4377 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4378 hda_nid_t nid, int pin_type,
4381 alc_set_pin_output(codec, nid, pin_type);
4382 /* need the manual connection? */
4383 if (alc880_is_multi_pin(nid)) {
4384 struct alc_spec *spec = codec->spec;
4385 int idx = alc880_multi_pin_idx(nid);
4386 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4387 AC_VERB_SET_CONNECT_SEL,
4388 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4392 static int get_pin_type(int line_out_type)
4394 if (line_out_type == AUTO_PIN_HP_OUT)
4400 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4402 struct alc_spec *spec = codec->spec;
4405 for (i = 0; i < spec->autocfg.line_outs; i++) {
4406 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4407 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4408 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4412 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4414 struct alc_spec *spec = codec->spec;
4417 pin = spec->autocfg.speaker_pins[0];
4418 if (pin) /* connect to front */
4419 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4420 pin = spec->autocfg.hp_pins[0];
4421 if (pin) /* connect to front */
4422 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4425 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4427 struct alc_spec *spec = codec->spec;
4430 for (i = 0; i < AUTO_PIN_LAST; i++) {
4431 hda_nid_t nid = spec->autocfg.input_pins[i];
4432 if (alc880_is_input_pin(nid)) {
4433 alc_set_input_pin(codec, nid, i);
4434 if (nid != ALC880_PIN_CD_NID &&
4435 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4436 snd_hda_codec_write(codec, nid, 0,
4437 AC_VERB_SET_AMP_GAIN_MUTE,
4443 /* parse the BIOS configuration and set up the alc_spec */
4444 /* return 1 if successful, 0 if the proper config is not found,
4445 * or a negative error code
4447 static int alc880_parse_auto_config(struct hda_codec *codec)
4449 struct alc_spec *spec = codec->spec;
4451 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4453 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4457 if (!spec->autocfg.line_outs)
4458 return 0; /* can't find valid BIOS pin config */
4460 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4463 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4466 err = alc880_auto_create_extra_out(spec,
4467 spec->autocfg.speaker_pins[0],
4471 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4475 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4479 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4481 /* check multiple SPDIF-out (for recent codecs) */
4482 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4484 err = snd_hda_get_connections(codec,
4485 spec->autocfg.dig_out_pins[i],
4490 spec->multiout.dig_out_nid = dig_nid;
4492 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4493 spec->slave_dig_outs[i - 1] = dig_nid;
4494 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4498 if (spec->autocfg.dig_in_pin)
4499 spec->dig_in_nid = ALC880_DIGIN_NID;
4501 if (spec->kctls.list)
4502 add_mixer(spec, spec->kctls.list);
4504 add_verb(spec, alc880_volume_init_verbs);
4506 spec->num_mux_defs = 1;
4507 spec->input_mux = &spec->private_imux[0];
4509 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4514 /* additional initialization for auto-configuration model */
4515 static void alc880_auto_init(struct hda_codec *codec)
4517 struct alc_spec *spec = codec->spec;
4518 alc880_auto_init_multi_out(codec);
4519 alc880_auto_init_extra_out(codec);
4520 alc880_auto_init_analog_input(codec);
4521 if (spec->unsol_event)
4522 alc_inithook(codec);
4525 static void set_capture_mixer(struct alc_spec *spec)
4527 static struct snd_kcontrol_new *caps[2][3] = {
4528 { alc_capture_mixer_nosrc1,
4529 alc_capture_mixer_nosrc2,
4530 alc_capture_mixer_nosrc3 },
4531 { alc_capture_mixer1,
4533 alc_capture_mixer3 },
4535 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4537 if (spec->input_mux && spec->input_mux->num_items > 1)
4541 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4545 #define set_beep_amp(spec, nid, idx, dir) \
4546 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4549 * OK, here we have finally the patch for ALC880
4552 static int patch_alc880(struct hda_codec *codec)
4554 struct alc_spec *spec;
4558 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4564 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4567 if (board_config < 0) {
4568 printk(KERN_INFO "hda_codec: Unknown model for %s, "
4569 "trying auto-probe from BIOS...\n", codec->chip_name);
4570 board_config = ALC880_AUTO;
4573 if (board_config == ALC880_AUTO) {
4574 /* automatic parse from the BIOS config */
4575 err = alc880_parse_auto_config(codec);
4581 "hda_codec: Cannot set up configuration "
4582 "from BIOS. Using 3-stack mode...\n");
4583 board_config = ALC880_3ST;
4587 err = snd_hda_attach_beep_device(codec, 0x1);
4593 if (board_config != ALC880_AUTO)
4594 setup_preset(spec, &alc880_presets[board_config]);
4596 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4597 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4598 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4600 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4601 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4603 if (!spec->adc_nids && spec->input_mux) {
4604 /* check whether NID 0x07 is valid */
4605 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4607 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4608 if (wcap != AC_WID_AUD_IN) {
4609 spec->adc_nids = alc880_adc_nids_alt;
4610 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4612 spec->adc_nids = alc880_adc_nids;
4613 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4616 set_capture_mixer(spec);
4617 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4619 spec->vmaster_nid = 0x0c;
4621 codec->patch_ops = alc_patch_ops;
4622 if (board_config == ALC880_AUTO)
4623 spec->init_hook = alc880_auto_init;
4624 #ifdef CONFIG_SND_HDA_POWER_SAVE
4625 if (!spec->loopback.amplist)
4626 spec->loopback.amplist = alc880_loopbacks;
4628 codec->proc_widget_hook = print_realtek_coef;
4638 static hda_nid_t alc260_dac_nids[1] = {
4643 static hda_nid_t alc260_adc_nids[1] = {
4648 static hda_nid_t alc260_adc_nids_alt[1] = {
4653 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4654 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4656 static hda_nid_t alc260_dual_adc_nids[2] = {
4661 #define ALC260_DIGOUT_NID 0x03
4662 #define ALC260_DIGIN_NID 0x06
4664 static struct hda_input_mux alc260_capture_source = {
4668 { "Front Mic", 0x1 },
4674 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4675 * headphone jack and the internal CD lines since these are the only pins at
4676 * which audio can appear. For flexibility, also allow the option of
4677 * recording the mixer output on the second ADC (ADC0 doesn't have a
4678 * connection to the mixer output).
4680 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4684 { "Mic/Line", 0x0 },
4686 { "Headphone", 0x2 },
4692 { "Mic/Line", 0x0 },
4694 { "Headphone", 0x2 },
4701 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4702 * the Fujitsu S702x, but jacks are marked differently.
4704 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4711 { "Headphone", 0x5 },
4720 { "Headphone", 0x6 },
4726 /* Maxdata Favorit 100XS */
4727 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4731 { "Line/Mic", 0x0 },
4738 { "Line/Mic", 0x0 },
4746 * This is just place-holder, so there's something for alc_build_pcms to look
4747 * at when it calculates the maximum number of channels. ALC260 has no mixer
4748 * element which allows changing the channel mode, so the verb list is
4751 static struct hda_channel_mode alc260_modes[1] = {
4756 /* Mixer combinations
4758 * basic: base_output + input + pc_beep + capture
4759 * HP: base_output + input + capture_alt
4760 * HP_3013: hp_3013 + input + capture
4761 * fujitsu: fujitsu + capture
4762 * acer: acer + capture
4765 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4766 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4767 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4768 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4769 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4770 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4771 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4775 static struct snd_kcontrol_new alc260_input_mixer[] = {
4776 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4777 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4778 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4779 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4780 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4781 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4782 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4783 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4787 /* update HP, line and mono out pins according to the master switch */
4788 static void alc260_hp_master_update(struct hda_codec *codec,
4789 hda_nid_t hp, hda_nid_t line,
4792 struct alc_spec *spec = codec->spec;
4793 unsigned int val = spec->master_sw ? PIN_HP : 0;
4794 /* change HP and line-out pins */
4795 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4797 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4799 /* mono (speaker) depending on the HP jack sense */
4800 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4801 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4805 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4806 struct snd_ctl_elem_value *ucontrol)
4808 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4809 struct alc_spec *spec = codec->spec;
4810 *ucontrol->value.integer.value = spec->master_sw;
4814 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4815 struct snd_ctl_elem_value *ucontrol)
4817 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4818 struct alc_spec *spec = codec->spec;
4819 int val = !!*ucontrol->value.integer.value;
4820 hda_nid_t hp, line, mono;
4822 if (val == spec->master_sw)
4824 spec->master_sw = val;
4825 hp = (kcontrol->private_value >> 16) & 0xff;
4826 line = (kcontrol->private_value >> 8) & 0xff;
4827 mono = kcontrol->private_value & 0xff;
4828 alc260_hp_master_update(codec, hp, line, mono);
4832 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4834 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4835 .name = "Master Playback Switch",
4836 .info = snd_ctl_boolean_mono_info,
4837 .get = alc260_hp_master_sw_get,
4838 .put = alc260_hp_master_sw_put,
4839 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4841 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4842 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4843 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4844 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4845 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4847 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4851 static struct hda_verb alc260_hp_unsol_verbs[] = {
4852 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4856 static void alc260_hp_automute(struct hda_codec *codec)
4858 struct alc_spec *spec = codec->spec;
4859 unsigned int present;
4861 present = snd_hda_codec_read(codec, 0x10, 0,
4862 AC_VERB_GET_PIN_SENSE, 0);
4863 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4864 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4867 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4869 if ((res >> 26) == ALC880_HP_EVENT)
4870 alc260_hp_automute(codec);
4873 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4875 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4876 .name = "Master Playback Switch",
4877 .info = snd_ctl_boolean_mono_info,
4878 .get = alc260_hp_master_sw_get,
4879 .put = alc260_hp_master_sw_put,
4880 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4882 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4883 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4884 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4885 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4886 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4887 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4888 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4889 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4893 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4894 .ops = &snd_hda_bind_vol,
4896 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4897 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4898 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4903 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4904 .ops = &snd_hda_bind_sw,
4906 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4907 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4912 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4913 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4914 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4915 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4916 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4920 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4921 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4925 static void alc260_hp_3013_automute(struct hda_codec *codec)
4927 struct alc_spec *spec = codec->spec;
4928 unsigned int present;
4930 present = snd_hda_codec_read(codec, 0x15, 0,
4931 AC_VERB_GET_PIN_SENSE, 0);
4932 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4933 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4936 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4939 if ((res >> 26) == ALC880_HP_EVENT)
4940 alc260_hp_3013_automute(codec);
4943 static void alc260_hp_3012_automute(struct hda_codec *codec)
4945 unsigned int present, bits;
4947 present = snd_hda_codec_read(codec, 0x10, 0,
4948 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4950 bits = present ? 0 : PIN_OUT;
4951 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4953 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4955 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4959 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4962 if ((res >> 26) == ALC880_HP_EVENT)
4963 alc260_hp_3012_automute(codec);
4966 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4967 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4969 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4970 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4971 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4972 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4973 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4974 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4975 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4976 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4977 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4978 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4979 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4983 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4984 * versions of the ALC260 don't act on requests to enable mic bias from NID
4985 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4986 * datasheet doesn't mention this restriction. At this stage it's not clear
4987 * whether this behaviour is intentional or is a hardware bug in chip
4988 * revisions available in early 2006. Therefore for now allow the
4989 * "Headphone Jack Mode" control to span all choices, but if it turns out
4990 * that the lack of mic bias for this NID is intentional we could change the
4991 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4993 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4994 * don't appear to make the mic bias available from the "line" jack, even
4995 * though the NID used for this jack (0x14) can supply it. The theory is
4996 * that perhaps Acer have included blocking capacitors between the ALC260
4997 * and the output jack. If this turns out to be the case for all such
4998 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4999 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5001 * The C20x Tablet series have a mono internal speaker which is controlled
5002 * via the chip's Mono sum widget and pin complex, so include the necessary
5003 * controls for such models. On models without a "mono speaker" the control
5004 * won't do anything.
5006 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5007 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5008 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5009 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5010 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5012 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5014 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5015 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5017 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5018 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5019 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5020 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5021 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5025 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5027 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5028 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5029 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5030 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5031 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5032 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5033 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5037 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5038 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5040 static struct snd_kcontrol_new alc260_will_mixer[] = {
5041 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5042 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5044 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5045 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5046 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5047 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5048 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5049 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5050 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5054 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5055 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5057 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5058 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5059 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5061 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5062 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5063 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5064 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5065 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5066 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5067 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5072 * initialization verbs
5074 static struct hda_verb alc260_init_verbs[] = {
5075 /* Line In pin widget for input */
5076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5077 /* CD pin widget for input */
5078 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5079 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5080 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5081 /* Mic2 (front panel) pin widget for input and vref at 80% */
5082 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5083 /* LINE-2 is used for line-out in rear */
5084 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5085 /* select line-out */
5086 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5088 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5090 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5092 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5093 /* mute capture amp left and right */
5094 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5095 /* set connection select to line in (default select for this ADC) */
5096 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5097 /* mute capture amp left and right */
5098 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5099 /* set connection select to line in (default select for this ADC) */
5100 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5101 /* set vol=0 Line-Out mixer amp left and right */
5102 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5103 /* unmute pin widget amp left and right (no gain on this amp) */
5104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5105 /* set vol=0 HP mixer amp left and right */
5106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5107 /* unmute pin widget amp left and right (no gain on this amp) */
5108 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5109 /* set vol=0 Mono mixer amp left and right */
5110 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5111 /* unmute pin widget amp left and right (no gain on this amp) */
5112 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5113 /* unmute LINE-2 out pin */
5114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5115 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5118 /* mute analog inputs */
5119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5123 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5124 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5125 /* mute Front out path */
5126 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5127 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5128 /* mute Headphone out path */
5129 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5130 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5131 /* mute Mono out path */
5132 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5133 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5137 #if 0 /* should be identical with alc260_init_verbs? */
5138 static struct hda_verb alc260_hp_init_verbs[] = {
5139 /* Headphone and output */
5140 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5142 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5143 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5144 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5145 /* Mic2 (front panel) pin widget for input and vref at 80% */
5146 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5147 /* Line In pin widget for input */
5148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5149 /* Line-2 pin widget for output */
5150 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5151 /* CD pin widget for input */
5152 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5153 /* unmute amp left and right */
5154 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5155 /* set connection select to line in (default select for this ADC) */
5156 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5157 /* unmute Line-Out mixer amp left and right (volume = 0) */
5158 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5159 /* mute pin widget amp left and right (no gain on this amp) */
5160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5161 /* unmute HP mixer amp left and right (volume = 0) */
5162 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5163 /* mute pin widget amp left and right (no gain on this amp) */
5164 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5165 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5168 /* mute analog inputs */
5169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5174 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5175 /* Unmute Front out path */
5176 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5177 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5178 /* Unmute Headphone out path */
5179 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5180 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5181 /* Unmute Mono out path */
5182 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5183 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5188 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5189 /* Line out and output */
5190 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5192 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5193 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5194 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5195 /* Mic2 (front panel) pin widget for input and vref at 80% */
5196 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5197 /* Line In pin widget for input */
5198 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5199 /* Headphone pin widget for output */
5200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5201 /* CD pin widget for input */
5202 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5203 /* unmute amp left and right */
5204 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5205 /* set connection select to line in (default select for this ADC) */
5206 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5207 /* unmute Line-Out mixer amp left and right (volume = 0) */
5208 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5209 /* mute pin widget amp left and right (no gain on this amp) */
5210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5211 /* unmute HP mixer amp left and right (volume = 0) */
5212 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5213 /* mute pin widget amp left and right (no gain on this amp) */
5214 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5215 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5218 /* mute analog inputs */
5219 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5220 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5221 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5223 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5224 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5225 /* Unmute Front out path */
5226 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5227 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5228 /* Unmute Headphone out path */
5229 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5230 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5231 /* Unmute Mono out path */
5232 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5233 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5237 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5238 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5239 * audio = 0x16, internal speaker = 0x10.
5241 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5242 /* Disable all GPIOs */
5243 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5244 /* Internal speaker is connected to headphone pin */
5245 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5246 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5248 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5249 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5250 /* Ensure all other unused pins are disabled and muted. */
5251 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5252 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5253 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5254 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5255 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5256 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5258 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5260 /* Disable digital (SPDIF) pins */
5261 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5262 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5264 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5265 * when acting as an output.
5267 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5269 /* Start with output sum widgets muted and their output gains at min */
5270 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5271 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5273 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5276 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5277 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5278 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5280 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5281 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5282 /* Unmute Line1 pin widget output buffer since it starts as an output.
5283 * If the pin mode is changed by the user the pin mode control will
5284 * take care of enabling the pin's input/output buffers as needed.
5285 * Therefore there's no need to enable the input buffer at this
5288 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5289 /* Unmute input buffer of pin widget used for Line-in (no equiv
5292 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5294 /* Mute capture amp left and right */
5295 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5296 /* Set ADC connection select to match default mixer setting - line
5299 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5301 /* Do the same for the second ADC: mute capture input amp and
5302 * set ADC connection to line in (on mic1 pin)
5304 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5305 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5307 /* Mute all inputs to mixer widget (even unconnected ones) */
5308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5311 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5312 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5314 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5315 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5320 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5321 * similar laptops (adapted from Fujitsu init verbs).
5323 static struct hda_verb alc260_acer_init_verbs[] = {
5324 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5325 * the headphone jack. Turn this on and rely on the standard mute
5326 * methods whenever the user wants to turn these outputs off.
5328 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5329 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5330 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5331 /* Internal speaker/Headphone jack is connected to Line-out pin */
5332 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5333 /* Internal microphone/Mic jack is connected to Mic1 pin */
5334 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5335 /* Line In jack is connected to Line1 pin */
5336 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5337 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5338 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5339 /* Ensure all other unused pins are disabled and muted. */
5340 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5341 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5342 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5343 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5345 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5346 /* Disable digital (SPDIF) pins */
5347 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5348 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5350 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5351 * bus when acting as outputs.
5353 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5354 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5356 /* Start with output sum widgets muted and their output gains at min */
5357 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5358 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5359 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5360 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5361 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5362 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5363 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5364 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5365 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5367 /* Unmute Line-out pin widget amp left and right
5368 * (no equiv mixer ctrl)
5370 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5371 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5372 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5373 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5374 * inputs. If the pin mode is changed by the user the pin mode control
5375 * will take care of enabling the pin's input/output buffers as needed.
5376 * Therefore there's no need to enable the input buffer at this
5379 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5380 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5382 /* Mute capture amp left and right */
5383 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5384 /* Set ADC connection select to match default mixer setting - mic
5387 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5389 /* Do similar with the second ADC: mute capture input amp and
5390 * set ADC connection to mic to match ALSA's default state.
5392 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5393 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5395 /* Mute all inputs to mixer widget (even unconnected ones) */
5396 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5402 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5403 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5408 /* Initialisation sequence for Maxdata Favorit 100XS
5409 * (adapted from Acer init verbs).
5411 static struct hda_verb alc260_favorit100_init_verbs[] = {
5412 /* GPIO 0 enables the output jack.
5413 * Turn this on and rely on the standard mute
5414 * methods whenever the user wants to turn these outputs off.
5416 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5417 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5418 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5419 /* Line/Mic input jack is connected to Mic1 pin */
5420 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5421 /* Ensure all other unused pins are disabled and muted. */
5422 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5423 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5424 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5425 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5426 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5427 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5429 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5431 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5432 /* Disable digital (SPDIF) pins */
5433 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5434 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5436 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5437 * bus when acting as outputs.
5439 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5440 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5442 /* Start with output sum widgets muted and their output gains at min */
5443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5446 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5449 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5450 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5453 /* Unmute Line-out pin widget amp left and right
5454 * (no equiv mixer ctrl)
5456 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5457 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5458 * inputs. If the pin mode is changed by the user the pin mode control
5459 * will take care of enabling the pin's input/output buffers as needed.
5460 * Therefore there's no need to enable the input buffer at this
5463 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5465 /* Mute capture amp left and right */
5466 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5467 /* Set ADC connection select to match default mixer setting - mic
5470 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5472 /* Do similar with the second ADC: mute capture input amp and
5473 * set ADC connection to mic to match ALSA's default state.
5475 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5476 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5478 /* Mute all inputs to mixer widget (even unconnected ones) */
5479 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5480 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5481 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5482 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5491 static struct hda_verb alc260_will_verbs[] = {
5492 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5493 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5494 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5495 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5496 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5497 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5501 static struct hda_verb alc260_replacer_672v_verbs[] = {
5502 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5503 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5504 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5506 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5507 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5508 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5510 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5514 /* toggle speaker-output according to the hp-jack state */
5515 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5517 unsigned int present;
5519 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5520 present = snd_hda_codec_read(codec, 0x0f, 0,
5521 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5523 snd_hda_codec_write_cache(codec, 0x01, 0,
5524 AC_VERB_SET_GPIO_DATA, 1);
5525 snd_hda_codec_write_cache(codec, 0x0f, 0,
5526 AC_VERB_SET_PIN_WIDGET_CONTROL,
5529 snd_hda_codec_write_cache(codec, 0x01, 0,
5530 AC_VERB_SET_GPIO_DATA, 0);
5531 snd_hda_codec_write_cache(codec, 0x0f, 0,
5532 AC_VERB_SET_PIN_WIDGET_CONTROL,
5537 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5540 if ((res >> 26) == ALC880_HP_EVENT)
5541 alc260_replacer_672v_automute(codec);
5544 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5545 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5546 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5547 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5548 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5549 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5551 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5552 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5553 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5554 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5558 /* Test configuration for debugging, modelled after the ALC880 test
5561 #ifdef CONFIG_SND_DEBUG
5562 static hda_nid_t alc260_test_dac_nids[1] = {
5565 static hda_nid_t alc260_test_adc_nids[2] = {
5568 /* For testing the ALC260, each input MUX needs its own definition since
5569 * the signal assignments are different. This assumes that the first ADC
5572 static struct hda_input_mux alc260_test_capture_sources[2] = {
5576 { "MIC1 pin", 0x0 },
5577 { "MIC2 pin", 0x1 },
5578 { "LINE1 pin", 0x2 },
5579 { "LINE2 pin", 0x3 },
5581 { "LINE-OUT pin", 0x5 },
5582 { "HP-OUT pin", 0x6 },
5588 { "MIC1 pin", 0x0 },
5589 { "MIC2 pin", 0x1 },
5590 { "LINE1 pin", 0x2 },
5591 { "LINE2 pin", 0x3 },
5594 { "LINE-OUT pin", 0x6 },
5595 { "HP-OUT pin", 0x7 },
5599 static struct snd_kcontrol_new alc260_test_mixer[] = {
5600 /* Output driver widgets */
5601 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5602 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5603 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5604 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5605 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5606 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5608 /* Modes for retasking pin widgets
5609 * Note: the ALC260 doesn't seem to act on requests to enable mic
5610 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5611 * mention this restriction. At this stage it's not clear whether
5612 * this behaviour is intentional or is a hardware bug in chip
5613 * revisions available at least up until early 2006. Therefore for
5614 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5615 * choices, but if it turns out that the lack of mic bias for these
5616 * NIDs is intentional we could change their modes from
5617 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5619 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5620 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5621 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5622 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5623 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5624 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5626 /* Loopback mixer controls */
5627 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5628 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5629 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5630 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5631 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5632 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5633 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5634 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5635 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5636 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5637 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5638 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5639 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5640 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5642 /* Controls for GPIO pins, assuming they are configured as outputs */
5643 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5644 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5645 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5646 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5648 /* Switches to allow the digital IO pins to be enabled. The datasheet
5649 * is ambigious as to which NID is which; testing on laptops which
5650 * make this output available should provide clarification.
5652 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5653 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5655 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5656 * this output to turn on an external amplifier.
5658 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5659 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5663 static struct hda_verb alc260_test_init_verbs[] = {
5664 /* Enable all GPIOs as outputs with an initial value of 0 */
5665 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5666 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5667 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5669 /* Enable retasking pins as output, initially without power amp */
5670 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5671 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5672 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5673 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5674 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5675 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5677 /* Disable digital (SPDIF) pins initially, but users can enable
5678 * them via a mixer switch. In the case of SPDIF-out, this initverb
5679 * payload also sets the generation to 0, output to be in "consumer"
5680 * PCM format, copyright asserted, no pre-emphasis and no validity
5683 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5684 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5686 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5687 * OUT1 sum bus when acting as an output.
5689 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5690 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5691 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5692 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5694 /* Start with output sum widgets muted and their output gains at min */
5695 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5696 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5698 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5699 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5701 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5702 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5703 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5705 /* Unmute retasking pin widget output buffers since the default
5706 * state appears to be output. As the pin mode is changed by the
5707 * user the pin mode control will take care of enabling the pin's
5708 * input/output buffers as needed.
5710 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5711 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5714 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5715 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5716 /* Also unmute the mono-out pin widget */
5717 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5719 /* Mute capture amp left and right */
5720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5721 /* Set ADC connection select to match default mixer setting (mic1
5724 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5726 /* Do the same for the second ADC: mute capture input amp and
5727 * set ADC connection to mic1 pin
5729 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5730 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5732 /* Mute all inputs to mixer widget (even unconnected ones) */
5733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5734 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5746 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5747 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5749 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5750 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5753 * for BIOS auto-configuration
5756 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5757 const char *pfx, int *vol_bits)
5760 unsigned long vol_val, sw_val;
5764 if (nid >= 0x0f && nid < 0x11) {
5765 nid_vol = nid - 0x7;
5766 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5767 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5768 } else if (nid == 0x11) {
5769 nid_vol = nid - 0x7;
5770 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5771 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5772 } else if (nid >= 0x12 && nid <= 0x15) {
5774 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5775 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5779 if (!(*vol_bits & (1 << nid_vol))) {
5780 /* first control for the volume widget */
5781 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5782 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5785 *vol_bits |= (1 << nid_vol);
5787 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5788 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5794 /* add playback controls from the parsed DAC table */
5795 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5796 const struct auto_pin_cfg *cfg)
5802 spec->multiout.num_dacs = 1;
5803 spec->multiout.dac_nids = spec->private_dac_nids;
5804 spec->multiout.dac_nids[0] = 0x02;
5806 nid = cfg->line_out_pins[0];
5808 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5813 nid = cfg->speaker_pins[0];
5815 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5820 nid = cfg->hp_pins[0];
5822 err = alc260_add_playback_controls(spec, nid, "Headphone",
5830 /* create playback/capture controls for input pins */
5831 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5832 const struct auto_pin_cfg *cfg)
5834 struct hda_input_mux *imux = &spec->private_imux[0];
5837 for (i = 0; i < AUTO_PIN_LAST; i++) {
5838 if (cfg->input_pins[i] >= 0x12) {
5839 idx = cfg->input_pins[i] - 0x12;
5840 err = new_analog_input(spec, cfg->input_pins[i],
5841 auto_pin_cfg_labels[i], idx,
5845 imux->items[imux->num_items].label =
5846 auto_pin_cfg_labels[i];
5847 imux->items[imux->num_items].index = idx;
5850 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5851 idx = cfg->input_pins[i] - 0x09;
5852 err = new_analog_input(spec, cfg->input_pins[i],
5853 auto_pin_cfg_labels[i], idx,
5857 imux->items[imux->num_items].label =
5858 auto_pin_cfg_labels[i];
5859 imux->items[imux->num_items].index = idx;
5866 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5867 hda_nid_t nid, int pin_type,
5870 alc_set_pin_output(codec, nid, pin_type);
5871 /* need the manual connection? */
5873 int idx = nid - 0x12;
5874 snd_hda_codec_write(codec, idx + 0x0b, 0,
5875 AC_VERB_SET_CONNECT_SEL, sel_idx);
5879 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5881 struct alc_spec *spec = codec->spec;
5884 nid = spec->autocfg.line_out_pins[0];
5886 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5887 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5890 nid = spec->autocfg.speaker_pins[0];
5892 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5894 nid = spec->autocfg.hp_pins[0];
5896 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5899 #define ALC260_PIN_CD_NID 0x16
5900 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5902 struct alc_spec *spec = codec->spec;
5905 for (i = 0; i < AUTO_PIN_LAST; i++) {
5906 hda_nid_t nid = spec->autocfg.input_pins[i];
5908 alc_set_input_pin(codec, nid, i);
5909 if (nid != ALC260_PIN_CD_NID &&
5910 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5911 snd_hda_codec_write(codec, nid, 0,
5912 AC_VERB_SET_AMP_GAIN_MUTE,
5919 * generic initialization of ADC, input mixers and output mixers
5921 static struct hda_verb alc260_volume_init_verbs[] = {
5923 * Unmute ADC0-1 and set the default input to mic-in
5925 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5926 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5927 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5928 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5930 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5932 * Note: PASD motherboards uses the Line In 2 as the input for
5933 * front panel mic (mic 2)
5935 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5936 /* mute analog inputs */
5937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5944 * Set up output mixers (0x08 - 0x0a)
5946 /* set vol=0 to output mixers */
5947 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5948 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5949 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5950 /* set up input amps for analog loopback */
5951 /* Amp Indices: DAC = 0, mixer = 1 */
5952 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5953 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5954 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5955 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5956 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5957 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5962 static int alc260_parse_auto_config(struct hda_codec *codec)
5964 struct alc_spec *spec = codec->spec;
5966 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5968 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5972 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5975 if (!spec->kctls.list)
5976 return 0; /* can't find valid BIOS pin config */
5977 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5981 spec->multiout.max_channels = 2;
5983 if (spec->autocfg.dig_outs)
5984 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5985 if (spec->kctls.list)
5986 add_mixer(spec, spec->kctls.list);
5988 add_verb(spec, alc260_volume_init_verbs);
5990 spec->num_mux_defs = 1;
5991 spec->input_mux = &spec->private_imux[0];
5993 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
5998 /* additional initialization for auto-configuration model */
5999 static void alc260_auto_init(struct hda_codec *codec)
6001 struct alc_spec *spec = codec->spec;
6002 alc260_auto_init_multi_out(codec);
6003 alc260_auto_init_analog_input(codec);
6004 if (spec->unsol_event)
6005 alc_inithook(codec);
6008 #ifdef CONFIG_SND_HDA_POWER_SAVE
6009 static struct hda_amp_list alc260_loopbacks[] = {
6010 { 0x07, HDA_INPUT, 0 },
6011 { 0x07, HDA_INPUT, 1 },
6012 { 0x07, HDA_INPUT, 2 },
6013 { 0x07, HDA_INPUT, 3 },
6014 { 0x07, HDA_INPUT, 4 },
6020 * ALC260 configurations
6022 static const char *alc260_models[ALC260_MODEL_LAST] = {
6023 [ALC260_BASIC] = "basic",
6025 [ALC260_HP_3013] = "hp-3013",
6026 [ALC260_HP_DC7600] = "hp-dc7600",
6027 [ALC260_FUJITSU_S702X] = "fujitsu",
6028 [ALC260_ACER] = "acer",
6029 [ALC260_WILL] = "will",
6030 [ALC260_REPLACER_672V] = "replacer",
6031 [ALC260_FAVORIT100] = "favorit100",
6032 #ifdef CONFIG_SND_DEBUG
6033 [ALC260_TEST] = "test",
6035 [ALC260_AUTO] = "auto",
6038 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6039 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6040 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6041 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6042 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6043 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6044 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6045 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6046 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6047 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6048 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6049 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6050 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6051 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6052 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6053 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6054 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6055 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6056 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6057 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6061 static struct alc_config_preset alc260_presets[] = {
6063 .mixers = { alc260_base_output_mixer,
6064 alc260_input_mixer },
6065 .init_verbs = { alc260_init_verbs },
6066 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6067 .dac_nids = alc260_dac_nids,
6068 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6069 .adc_nids = alc260_adc_nids,
6070 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6071 .channel_mode = alc260_modes,
6072 .input_mux = &alc260_capture_source,
6075 .mixers = { alc260_hp_output_mixer,
6076 alc260_input_mixer },
6077 .init_verbs = { alc260_init_verbs,
6078 alc260_hp_unsol_verbs },
6079 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6080 .dac_nids = alc260_dac_nids,
6081 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6082 .adc_nids = alc260_adc_nids_alt,
6083 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6084 .channel_mode = alc260_modes,
6085 .input_mux = &alc260_capture_source,
6086 .unsol_event = alc260_hp_unsol_event,
6087 .init_hook = alc260_hp_automute,
6089 [ALC260_HP_DC7600] = {
6090 .mixers = { alc260_hp_dc7600_mixer,
6091 alc260_input_mixer },
6092 .init_verbs = { alc260_init_verbs,
6093 alc260_hp_dc7600_verbs },
6094 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6095 .dac_nids = alc260_dac_nids,
6096 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6097 .adc_nids = alc260_adc_nids_alt,
6098 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6099 .channel_mode = alc260_modes,
6100 .input_mux = &alc260_capture_source,
6101 .unsol_event = alc260_hp_3012_unsol_event,
6102 .init_hook = alc260_hp_3012_automute,
6104 [ALC260_HP_3013] = {
6105 .mixers = { alc260_hp_3013_mixer,
6106 alc260_input_mixer },
6107 .init_verbs = { alc260_hp_3013_init_verbs,
6108 alc260_hp_3013_unsol_verbs },
6109 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6110 .dac_nids = alc260_dac_nids,
6111 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6112 .adc_nids = alc260_adc_nids_alt,
6113 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6114 .channel_mode = alc260_modes,
6115 .input_mux = &alc260_capture_source,
6116 .unsol_event = alc260_hp_3013_unsol_event,
6117 .init_hook = alc260_hp_3013_automute,
6119 [ALC260_FUJITSU_S702X] = {
6120 .mixers = { alc260_fujitsu_mixer },
6121 .init_verbs = { alc260_fujitsu_init_verbs },
6122 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6123 .dac_nids = alc260_dac_nids,
6124 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6125 .adc_nids = alc260_dual_adc_nids,
6126 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6127 .channel_mode = alc260_modes,
6128 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6129 .input_mux = alc260_fujitsu_capture_sources,
6132 .mixers = { alc260_acer_mixer },
6133 .init_verbs = { alc260_acer_init_verbs },
6134 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6135 .dac_nids = alc260_dac_nids,
6136 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6137 .adc_nids = alc260_dual_adc_nids,
6138 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6139 .channel_mode = alc260_modes,
6140 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6141 .input_mux = alc260_acer_capture_sources,
6143 [ALC260_FAVORIT100] = {
6144 .mixers = { alc260_favorit100_mixer },
6145 .init_verbs = { alc260_favorit100_init_verbs },
6146 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6147 .dac_nids = alc260_dac_nids,
6148 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6149 .adc_nids = alc260_dual_adc_nids,
6150 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6151 .channel_mode = alc260_modes,
6152 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6153 .input_mux = alc260_favorit100_capture_sources,
6156 .mixers = { alc260_will_mixer },
6157 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6158 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6159 .dac_nids = alc260_dac_nids,
6160 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6161 .adc_nids = alc260_adc_nids,
6162 .dig_out_nid = ALC260_DIGOUT_NID,
6163 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6164 .channel_mode = alc260_modes,
6165 .input_mux = &alc260_capture_source,
6167 [ALC260_REPLACER_672V] = {
6168 .mixers = { alc260_replacer_672v_mixer },
6169 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6170 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6171 .dac_nids = alc260_dac_nids,
6172 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6173 .adc_nids = alc260_adc_nids,
6174 .dig_out_nid = ALC260_DIGOUT_NID,
6175 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6176 .channel_mode = alc260_modes,
6177 .input_mux = &alc260_capture_source,
6178 .unsol_event = alc260_replacer_672v_unsol_event,
6179 .init_hook = alc260_replacer_672v_automute,
6181 #ifdef CONFIG_SND_DEBUG
6183 .mixers = { alc260_test_mixer },
6184 .init_verbs = { alc260_test_init_verbs },
6185 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6186 .dac_nids = alc260_test_dac_nids,
6187 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6188 .adc_nids = alc260_test_adc_nids,
6189 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6190 .channel_mode = alc260_modes,
6191 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6192 .input_mux = alc260_test_capture_sources,
6197 static int patch_alc260(struct hda_codec *codec)
6199 struct alc_spec *spec;
6200 int err, board_config;
6202 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6208 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6211 if (board_config < 0) {
6212 snd_printd(KERN_INFO "hda_codec: Unknown model for %s, "
6213 "trying auto-probe from BIOS...\n",
6215 board_config = ALC260_AUTO;
6218 if (board_config == ALC260_AUTO) {
6219 /* automatic parse from the BIOS config */
6220 err = alc260_parse_auto_config(codec);
6226 "hda_codec: Cannot set up configuration "
6227 "from BIOS. Using base mode...\n");
6228 board_config = ALC260_BASIC;
6232 err = snd_hda_attach_beep_device(codec, 0x1);
6238 if (board_config != ALC260_AUTO)
6239 setup_preset(spec, &alc260_presets[board_config]);
6241 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6242 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6244 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6245 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6247 if (!spec->adc_nids && spec->input_mux) {
6248 /* check whether NID 0x04 is valid */
6249 unsigned int wcap = get_wcaps(codec, 0x04);
6250 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6252 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6253 spec->adc_nids = alc260_adc_nids_alt;
6254 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6256 spec->adc_nids = alc260_adc_nids;
6257 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6260 set_capture_mixer(spec);
6261 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6263 spec->vmaster_nid = 0x08;
6265 codec->patch_ops = alc_patch_ops;
6266 if (board_config == ALC260_AUTO)
6267 spec->init_hook = alc260_auto_init;
6268 #ifdef CONFIG_SND_HDA_POWER_SAVE
6269 if (!spec->loopback.amplist)
6270 spec->loopback.amplist = alc260_loopbacks;
6272 codec->proc_widget_hook = print_realtek_coef;
6281 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6282 * configuration. Each pin widget can choose any input DACs and a mixer.
6283 * Each ADC is connected from a mixer of all inputs. This makes possible
6284 * 6-channel independent captures.
6286 * In addition, an independent DAC for the multi-playback (not used in this
6289 #define ALC882_DIGOUT_NID 0x06
6290 #define ALC882_DIGIN_NID 0x0a
6292 static struct hda_channel_mode alc882_ch_modes[1] = {
6296 static hda_nid_t alc882_dac_nids[4] = {
6297 /* front, rear, clfe, rear_surr */
6298 0x02, 0x03, 0x04, 0x05
6301 /* identical with ALC880 */
6302 #define alc882_adc_nids alc880_adc_nids
6303 #define alc882_adc_nids_alt alc880_adc_nids_alt
6305 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6306 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6309 /* FIXME: should be a matrix-type input source selection */
6311 static struct hda_input_mux alc882_capture_source = {
6315 { "Front Mic", 0x1 },
6321 static struct hda_input_mux mb5_capture_source = {
6333 static struct hda_verb alc882_3ST_ch2_init[] = {
6334 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6335 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6336 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6337 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6344 static struct hda_verb alc882_3ST_ch6_init[] = {
6345 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6346 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6347 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6348 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6349 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6350 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6354 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6355 { 2, alc882_3ST_ch2_init },
6356 { 6, alc882_3ST_ch6_init },
6362 static struct hda_verb alc882_sixstack_ch6_init[] = {
6363 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6364 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6365 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6366 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6373 static struct hda_verb alc882_sixstack_ch8_init[] = {
6374 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6375 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6376 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6377 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6381 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6382 { 6, alc882_sixstack_ch6_init },
6383 { 8, alc882_sixstack_ch8_init },
6387 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6393 static struct hda_verb alc885_mbp_ch2_init[] = {
6394 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6395 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6396 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6403 static struct hda_verb alc885_mbp_ch6_init[] = {
6404 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6405 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6406 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6407 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6408 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6412 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6413 { 2, alc885_mbp_ch2_init },
6414 { 6, alc885_mbp_ch6_init },
6419 * Speakers/Woofer/HP = Front
6422 static struct hda_verb alc885_mb5_ch2_init[] = {
6423 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6424 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6430 * Speakers/HP = Front
6434 static struct hda_verb alc885_mb5_ch6_init[] = {
6435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6437 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6441 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6442 { 2, alc885_mb5_ch2_init },
6443 { 6, alc885_mb5_ch6_init },
6446 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6447 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6449 static struct snd_kcontrol_new alc882_base_mixer[] = {
6450 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6451 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6452 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6453 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6454 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6455 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6456 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6457 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6458 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6459 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6460 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6461 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6462 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6463 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6464 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6466 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6467 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6468 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6469 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6470 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6474 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6475 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6476 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6477 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6478 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6479 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6480 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6481 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6482 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6483 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6484 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6488 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6489 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6490 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6491 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6492 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6493 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6494 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6495 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6496 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6497 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6498 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6500 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6501 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6502 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6506 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6507 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6508 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6509 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6510 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6511 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6512 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6514 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6519 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6520 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6521 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6523 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6524 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6525 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6526 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6528 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6529 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6530 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6531 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6532 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6536 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6537 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6539 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6540 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6541 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6543 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6544 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6545 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6546 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6547 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6548 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6549 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6556 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6557 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6558 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6560 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6561 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6562 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6563 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6565 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6566 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6570 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6572 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6573 .name = "Channel Mode",
6574 .info = alc_ch_mode_info,
6575 .get = alc_ch_mode_get,
6576 .put = alc_ch_mode_put,
6581 static struct hda_verb alc882_init_verbs[] = {
6582 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6591 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6592 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6595 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6596 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6599 /* Front Pin: output 0 (0x0c) */
6600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6602 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6603 /* Rear Pin: output 1 (0x0d) */
6604 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6607 /* CLFE Pin: output 2 (0x0e) */
6608 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6609 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6610 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6611 /* Side Pin: output 3 (0x0f) */
6612 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6613 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6614 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6615 /* Mic (rear) pin: input vref at 80% */
6616 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6617 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6618 /* Front Mic pin: input vref at 80% */
6619 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6620 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6621 /* Line In pin: input */
6622 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6623 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6624 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6625 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6626 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6627 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6628 /* CD pin widget for input */
6629 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6631 /* FIXME: use matrix-type input source selection */
6632 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6633 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6634 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6635 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6636 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6637 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6639 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6640 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6645 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6648 /* ADC1: mute amp left and right */
6649 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6650 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6651 /* ADC2: mute amp left and right */
6652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6653 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6654 /* ADC3: mute amp left and right */
6655 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6656 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6661 static struct hda_verb alc882_eapd_verbs[] = {
6662 /* change to EAPD mode */
6663 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6664 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6669 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6670 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6671 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6672 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6673 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6674 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6675 /* FIXME: this looks suspicious...
6676 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6677 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6682 static struct hda_verb alc882_macpro_init_verbs[] = {
6683 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6687 /* Front Pin: output 0 (0x0c) */
6688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6690 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6691 /* Front Mic pin: input vref at 80% */
6692 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6694 /* Speaker: output */
6695 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6697 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6698 /* Headphone output (output 0 - 0x0c) */
6699 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6701 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6703 /* FIXME: use matrix-type input source selection */
6704 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6705 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6711 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6720 /* ADC1: mute amp left and right */
6721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6722 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6723 /* ADC2: mute amp left and right */
6724 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6725 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6726 /* ADC3: mute amp left and right */
6727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6728 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6734 static struct hda_verb alc885_mb5_init_verbs[] = {
6736 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6737 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6738 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6739 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6744 /* Surround mixer */
6745 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6749 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6750 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6753 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6754 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6755 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6756 /* Front Pin (0x0c) */
6757 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6758 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6759 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6760 /* LFE Pin (0x0e) */
6761 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6762 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6763 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
6765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6766 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6767 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
6768 /* Front Mic pin: input vref at 80% */
6769 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6770 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6772 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6782 /* Macbook Pro rev3 */
6783 static struct hda_verb alc885_mbp3_init_verbs[] = {
6784 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6785 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6789 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6790 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6791 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6792 /* Front Pin: output 0 (0x0c) */
6793 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6794 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6795 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6796 /* HP Pin: output 0 (0x0d) */
6797 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6798 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6799 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6800 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6801 /* Mic (rear) pin: input vref at 80% */
6802 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6803 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6804 /* Front Mic pin: input vref at 80% */
6805 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6806 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6807 /* Line In pin: use output 1 when in LineOut mode */
6808 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6809 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6810 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6812 /* FIXME: use matrix-type input source selection */
6813 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6814 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6815 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6816 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6818 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6820 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6821 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6822 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6829 /* ADC1: mute amp left and right */
6830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6831 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6832 /* ADC2: mute amp left and right */
6833 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6834 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6835 /* ADC3: mute amp left and right */
6836 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6837 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6842 /* iMac 24 mixer. */
6843 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6844 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6845 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6849 /* iMac 24 init verbs. */
6850 static struct hda_verb alc885_imac24_init_verbs[] = {
6851 /* Internal speakers: output 0 (0x0c) */
6852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6853 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6854 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6855 /* Internal speakers: output 0 (0x0c) */
6856 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6857 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6858 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6859 /* Headphone: output 0 (0x0c) */
6860 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6861 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6862 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6863 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6864 /* Front Mic: input vref at 80% */
6865 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6866 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6870 /* Toggle speaker-output according to the hp-jack state */
6871 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
6873 struct alc_spec *spec = codec->spec;
6875 spec->autocfg.hp_pins[0] = 0x14;
6876 spec->autocfg.speaker_pins[0] = 0x18;
6877 spec->autocfg.speaker_pins[1] = 0x1a;
6878 alc_automute_amp(codec);
6881 static void alc885_mbp3_init_hook(struct hda_codec *codec)
6883 struct alc_spec *spec = codec->spec;
6885 spec->autocfg.hp_pins[0] = 0x15;
6886 spec->autocfg.speaker_pins[0] = 0x14;
6887 alc_automute_amp(codec);
6891 static struct hda_verb alc882_targa_verbs[] = {
6892 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6895 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6896 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6898 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6899 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6900 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6902 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6903 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6904 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6905 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6909 /* toggle speaker-output according to the hp-jack state */
6910 static void alc882_targa_automute(struct hda_codec *codec)
6912 struct alc_spec *spec = codec->spec;
6913 alc_automute_amp(codec);
6914 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6915 spec->jack_present ? 1 : 3);
6918 static void alc882_targa_init_hook(struct hda_codec *codec)
6920 struct alc_spec *spec = codec->spec;
6922 spec->autocfg.hp_pins[0] = 0x14;
6923 spec->autocfg.speaker_pins[0] = 0x1b;
6924 alc882_targa_automute(codec);
6927 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6929 if ((res >> 26) == ALC880_HP_EVENT)
6930 alc882_targa_automute(codec);
6933 static struct hda_verb alc882_asus_a7j_verbs[] = {
6934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6937 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6939 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6941 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6942 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6943 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6945 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6946 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6947 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6951 static struct hda_verb alc882_asus_a7m_verbs[] = {
6952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6955 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6956 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6957 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6959 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6960 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6961 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6963 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6964 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6965 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6969 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6971 unsigned int gpiostate, gpiomask, gpiodir;
6973 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6974 AC_VERB_GET_GPIO_DATA, 0);
6977 gpiostate |= (1 << pin);
6979 gpiostate &= ~(1 << pin);
6981 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6982 AC_VERB_GET_GPIO_MASK, 0);
6983 gpiomask |= (1 << pin);
6985 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6986 AC_VERB_GET_GPIO_DIRECTION, 0);
6987 gpiodir |= (1 << pin);
6990 snd_hda_codec_write(codec, codec->afg, 0,
6991 AC_VERB_SET_GPIO_MASK, gpiomask);
6992 snd_hda_codec_write(codec, codec->afg, 0,
6993 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6997 snd_hda_codec_write(codec, codec->afg, 0,
6998 AC_VERB_SET_GPIO_DATA, gpiostate);
7001 /* set up GPIO at initialization */
7002 static void alc885_macpro_init_hook(struct hda_codec *codec)
7004 alc882_gpio_mute(codec, 0, 0);
7005 alc882_gpio_mute(codec, 1, 0);
7008 /* set up GPIO and update auto-muting at initialization */
7009 static void alc885_imac24_init_hook(struct hda_codec *codec)
7011 alc885_macpro_init_hook(codec);
7012 alc885_imac24_automute_init_hook(codec);
7016 * generic initialization of ADC, input mixers and output mixers
7018 static struct hda_verb alc882_auto_init_verbs[] = {
7020 * Unmute ADC0-2 and set the default input to mic-in
7022 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7024 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7025 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7026 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7027 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7029 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7031 * Note: PASD motherboards uses the Line In 2 as the input for
7032 * front panel mic (mic 2)
7034 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7042 * Set up output mixers (0x0c - 0x0f)
7044 /* set vol=0 to output mixers */
7045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7046 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7047 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7048 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7049 /* set up input amps for analog loopback */
7050 /* Amp Indices: DAC = 0, mixer = 1 */
7051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7053 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7054 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7055 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7056 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7057 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7058 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7059 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7060 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7062 /* FIXME: use matrix-type input source selection */
7063 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7064 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7071 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7076 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7083 #ifdef CONFIG_SND_HDA_POWER_SAVE
7084 #define alc882_loopbacks alc880_loopbacks
7087 /* pcm configuration: identical with ALC880 */
7088 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
7089 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
7090 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
7091 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
7094 * configuration and preset
7096 static const char *alc882_models[ALC882_MODEL_LAST] = {
7097 [ALC882_3ST_DIG] = "3stack-dig",
7098 [ALC882_6ST_DIG] = "6stack-dig",
7099 [ALC882_ARIMA] = "arima",
7100 [ALC882_W2JC] = "w2jc",
7101 [ALC882_TARGA] = "targa",
7102 [ALC882_ASUS_A7J] = "asus-a7j",
7103 [ALC882_ASUS_A7M] = "asus-a7m",
7104 [ALC885_MACPRO] = "macpro",
7105 [ALC885_MB5] = "mb5",
7106 [ALC885_MBP3] = "mbp3",
7107 [ALC885_IMAC24] = "imac24",
7108 [ALC882_AUTO] = "auto",
7111 static struct snd_pci_quirk alc882_cfg_tbl[] = {
7112 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
7113 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
7114 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
7115 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
7116 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
7117 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
7118 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
7119 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
7120 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
7121 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
7122 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
7123 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
7127 static struct alc_config_preset alc882_presets[] = {
7128 [ALC882_3ST_DIG] = {
7129 .mixers = { alc882_base_mixer },
7130 .init_verbs = { alc882_init_verbs },
7131 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7132 .dac_nids = alc882_dac_nids,
7133 .dig_out_nid = ALC882_DIGOUT_NID,
7134 .dig_in_nid = ALC882_DIGIN_NID,
7135 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7136 .channel_mode = alc882_ch_modes,
7138 .input_mux = &alc882_capture_source,
7140 [ALC882_6ST_DIG] = {
7141 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
7142 .init_verbs = { alc882_init_verbs },
7143 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7144 .dac_nids = alc882_dac_nids,
7145 .dig_out_nid = ALC882_DIGOUT_NID,
7146 .dig_in_nid = ALC882_DIGIN_NID,
7147 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
7148 .channel_mode = alc882_sixstack_modes,
7149 .input_mux = &alc882_capture_source,
7152 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
7153 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
7154 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7155 .dac_nids = alc882_dac_nids,
7156 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
7157 .channel_mode = alc882_sixstack_modes,
7158 .input_mux = &alc882_capture_source,
7161 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
7162 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7163 alc880_gpio1_init_verbs },
7164 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7165 .dac_nids = alc882_dac_nids,
7166 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7167 .channel_mode = alc880_threestack_modes,
7169 .input_mux = &alc882_capture_source,
7170 .dig_out_nid = ALC882_DIGOUT_NID,
7173 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
7174 .init_verbs = { alc885_mbp3_init_verbs,
7175 alc880_gpio1_init_verbs },
7176 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7177 .dac_nids = alc882_dac_nids,
7178 .channel_mode = alc885_mbp_6ch_modes,
7179 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
7180 .input_mux = &alc882_capture_source,
7181 .dig_out_nid = ALC882_DIGOUT_NID,
7182 .dig_in_nid = ALC882_DIGIN_NID,
7183 .unsol_event = alc_automute_amp_unsol_event,
7184 .init_hook = alc885_mbp3_init_hook,
7187 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
7188 .init_verbs = { alc885_mb5_init_verbs,
7189 alc880_gpio1_init_verbs },
7190 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7191 .dac_nids = alc882_dac_nids,
7192 .channel_mode = alc885_mb5_6ch_modes,
7193 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
7194 .input_mux = &mb5_capture_source,
7195 .dig_out_nid = ALC882_DIGOUT_NID,
7196 .dig_in_nid = ALC882_DIGIN_NID,
7199 .mixers = { alc882_macpro_mixer },
7200 .init_verbs = { alc882_macpro_init_verbs },
7201 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7202 .dac_nids = alc882_dac_nids,
7203 .dig_out_nid = ALC882_DIGOUT_NID,
7204 .dig_in_nid = ALC882_DIGIN_NID,
7205 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7206 .channel_mode = alc882_ch_modes,
7207 .input_mux = &alc882_capture_source,
7208 .init_hook = alc885_macpro_init_hook,
7211 .mixers = { alc885_imac24_mixer },
7212 .init_verbs = { alc885_imac24_init_verbs },
7213 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7214 .dac_nids = alc882_dac_nids,
7215 .dig_out_nid = ALC882_DIGOUT_NID,
7216 .dig_in_nid = ALC882_DIGIN_NID,
7217 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7218 .channel_mode = alc882_ch_modes,
7219 .input_mux = &alc882_capture_source,
7220 .unsol_event = alc_automute_amp_unsol_event,
7221 .init_hook = alc885_imac24_init_hook,
7224 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7225 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
7226 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7227 .dac_nids = alc882_dac_nids,
7228 .dig_out_nid = ALC882_DIGOUT_NID,
7229 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7230 .adc_nids = alc882_adc_nids,
7231 .capsrc_nids = alc882_capsrc_nids,
7232 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7233 .channel_mode = alc882_3ST_6ch_modes,
7235 .input_mux = &alc882_capture_source,
7236 .unsol_event = alc882_targa_unsol_event,
7237 .init_hook = alc882_targa_init_hook,
7239 [ALC882_ASUS_A7J] = {
7240 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
7241 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
7242 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7243 .dac_nids = alc882_dac_nids,
7244 .dig_out_nid = ALC882_DIGOUT_NID,
7245 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7246 .adc_nids = alc882_adc_nids,
7247 .capsrc_nids = alc882_capsrc_nids,
7248 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7249 .channel_mode = alc882_3ST_6ch_modes,
7251 .input_mux = &alc882_capture_source,
7253 [ALC882_ASUS_A7M] = {
7254 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7255 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7256 alc880_gpio1_init_verbs,
7257 alc882_asus_a7m_verbs },
7258 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7259 .dac_nids = alc882_dac_nids,
7260 .dig_out_nid = ALC882_DIGOUT_NID,
7261 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7262 .channel_mode = alc880_threestack_modes,
7264 .input_mux = &alc882_capture_source,
7273 PINFIX_ABIT_AW9D_MAX
7276 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7277 { 0x15, 0x01080104 }, /* side */
7278 { 0x16, 0x01011012 }, /* rear */
7279 { 0x17, 0x01016011 }, /* clfe */
7283 static const struct alc_pincfg *alc882_pin_fixes[] = {
7284 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7287 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7288 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7293 * BIOS auto configuration
7295 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7296 hda_nid_t nid, int pin_type,
7300 struct alc_spec *spec = codec->spec;
7303 alc_set_pin_output(codec, nid, pin_type);
7304 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7307 idx = spec->multiout.dac_nids[dac_idx] - 2;
7308 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7312 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7314 struct alc_spec *spec = codec->spec;
7317 for (i = 0; i <= HDA_SIDE; i++) {
7318 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7319 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7321 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7326 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7328 struct alc_spec *spec = codec->spec;
7331 pin = spec->autocfg.hp_pins[0];
7332 if (pin) /* connect to front */
7334 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7335 pin = spec->autocfg.speaker_pins[0];
7337 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7340 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7341 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7343 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7345 struct alc_spec *spec = codec->spec;
7348 for (i = 0; i < AUTO_PIN_LAST; i++) {
7349 hda_nid_t nid = spec->autocfg.input_pins[i];
7352 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7353 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7354 snd_hda_codec_write(codec, nid, 0,
7355 AC_VERB_SET_AMP_GAIN_MUTE,
7360 static void alc882_auto_init_input_src(struct hda_codec *codec)
7362 struct alc_spec *spec = codec->spec;
7365 for (c = 0; c < spec->num_adc_nids; c++) {
7366 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7367 hda_nid_t nid = spec->capsrc_nids[c];
7368 unsigned int mux_idx;
7369 const struct hda_input_mux *imux;
7370 int conns, mute, idx, item;
7372 conns = snd_hda_get_connections(codec, nid, conn_list,
7373 ARRAY_SIZE(conn_list));
7376 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7377 imux = &spec->input_mux[mux_idx];
7378 for (idx = 0; idx < conns; idx++) {
7379 /* if the current connection is the selected one,
7380 * unmute it as default - otherwise mute it
7382 mute = AMP_IN_MUTE(idx);
7383 for (item = 0; item < imux->num_items; item++) {
7384 if (imux->items[item].index == idx) {
7385 if (spec->cur_mux[c] == item)
7386 mute = AMP_IN_UNMUTE(idx);
7390 /* check if we have a selector or mixer
7391 * we could check for the widget type instead, but
7392 * just check for Amp-In presence (in case of mixer
7393 * without amp-in there is something wrong, this
7394 * function shouldn't be used or capsrc nid is wrong)
7396 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7397 snd_hda_codec_write(codec, nid, 0,
7398 AC_VERB_SET_AMP_GAIN_MUTE,
7400 else if (mute != AMP_IN_MUTE(idx))
7401 snd_hda_codec_write(codec, nid, 0,
7402 AC_VERB_SET_CONNECT_SEL,
7408 /* add mic boosts if needed */
7409 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7411 struct alc_spec *spec = codec->spec;
7415 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7416 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7417 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7419 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7423 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7424 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7425 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7427 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7434 /* almost identical with ALC880 parser... */
7435 static int alc882_parse_auto_config(struct hda_codec *codec)
7437 struct alc_spec *spec = codec->spec;
7438 int err = alc880_parse_auto_config(codec);
7443 return 0; /* no config found */
7445 err = alc_auto_add_mic_boost(codec);
7449 /* hack - override the init verbs */
7450 spec->init_verbs[0] = alc882_auto_init_verbs;
7452 return 1; /* config found */
7455 /* additional initialization for auto-configuration model */
7456 static void alc882_auto_init(struct hda_codec *codec)
7458 struct alc_spec *spec = codec->spec;
7459 alc882_auto_init_multi_out(codec);
7460 alc882_auto_init_hp_out(codec);
7461 alc882_auto_init_analog_input(codec);
7462 alc882_auto_init_input_src(codec);
7463 if (spec->unsol_event)
7464 alc_inithook(codec);
7467 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7469 static int patch_alc882(struct hda_codec *codec)
7471 struct alc_spec *spec;
7472 int err, board_config;
7474 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7480 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7484 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7485 /* Pick up systems that don't supply PCI SSID */
7486 switch (codec->subsystem_id) {
7487 case 0x106b0c00: /* Mac Pro */
7488 board_config = ALC885_MACPRO;
7490 case 0x106b1000: /* iMac 24 */
7491 case 0x106b2800: /* AppleTV */
7492 case 0x106b3e00: /* iMac 24 Aluminium */
7493 board_config = ALC885_IMAC24;
7495 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7496 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7497 case 0x106b00a4: /* MacbookPro4,1 */
7498 case 0x106b2c00: /* Macbook Pro rev3 */
7499 /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */
7500 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7501 board_config = ALC885_MBP3;
7503 case 0x106b3f00: /* Macbook 5,1 */
7504 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7505 * seems not working, so apparently
7506 * no perfect solution yet
7508 board_config = ALC885_MB5;
7511 /* ALC889A is handled better as ALC888-compatible */
7512 if (codec->revision_id == 0x100101 ||
7513 codec->revision_id == 0x100103) {
7515 return patch_alc883(codec);
7517 printk(KERN_INFO "hda_codec: Unknown model for %s, "
7518 "trying auto-probe from BIOS...\n",
7520 board_config = ALC882_AUTO;
7524 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7526 if (board_config == ALC882_AUTO) {
7527 /* automatic parse from the BIOS config */
7528 err = alc882_parse_auto_config(codec);
7534 "hda_codec: Cannot set up configuration "
7535 "from BIOS. Using base mode...\n");
7536 board_config = ALC882_3ST_DIG;
7540 err = snd_hda_attach_beep_device(codec, 0x1);
7546 if (board_config != ALC882_AUTO)
7547 setup_preset(spec, &alc882_presets[board_config]);
7549 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7550 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7551 /* FIXME: setup DAC5 */
7552 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7553 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7555 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7556 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7558 if (!spec->adc_nids && spec->input_mux) {
7559 /* check whether NID 0x07 is valid */
7560 unsigned int wcap = get_wcaps(codec, 0x07);
7562 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7563 if (wcap != AC_WID_AUD_IN) {
7564 spec->adc_nids = alc882_adc_nids_alt;
7565 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7566 spec->capsrc_nids = alc882_capsrc_nids_alt;
7568 spec->adc_nids = alc882_adc_nids;
7569 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7570 spec->capsrc_nids = alc882_capsrc_nids;
7573 set_capture_mixer(spec);
7574 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7576 spec->vmaster_nid = 0x0c;
7578 codec->patch_ops = alc_patch_ops;
7579 if (board_config == ALC882_AUTO)
7580 spec->init_hook = alc882_auto_init;
7581 #ifdef CONFIG_SND_HDA_POWER_SAVE
7582 if (!spec->loopback.amplist)
7583 spec->loopback.amplist = alc882_loopbacks;
7585 codec->proc_widget_hook = print_realtek_coef;
7593 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7594 * configuration. Each pin widget can choose any input DACs and a mixer.
7595 * Each ADC is connected from a mixer of all inputs. This makes possible
7596 * 6-channel independent captures.
7598 * In addition, an independent DAC for the multi-playback (not used in this
7601 #define ALC883_DIGOUT_NID 0x06
7602 #define ALC883_DIGIN_NID 0x0a
7604 #define ALC1200_DIGOUT_NID 0x10
7606 static hda_nid_t alc883_dac_nids[4] = {
7607 /* front, rear, clfe, rear_surr */
7608 0x02, 0x03, 0x04, 0x05
7611 static hda_nid_t alc883_adc_nids[2] = {
7616 static hda_nid_t alc883_adc_nids_alt[1] = {
7621 static hda_nid_t alc883_adc_nids_rev[2] = {
7626 #define alc889_adc_nids alc880_adc_nids
7628 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7630 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7632 #define alc889_capsrc_nids alc882_capsrc_nids
7635 /* FIXME: should be a matrix-type input source selection */
7637 static struct hda_input_mux alc883_capture_source = {
7641 { "Front Mic", 0x1 },
7647 static struct hda_input_mux alc883_3stack_6ch_intel = {
7651 { "Front Mic", 0x0 },
7657 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7665 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7675 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7683 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7687 { "Front Mic", 0x1 },
7692 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7700 static struct hda_input_mux alc889A_mb31_capture_source = {
7704 /* Front Mic (0x01) unused */
7706 /* Line 2 (0x03) unused */
7707 /* CD (0x04) unsused? */
7714 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7721 static struct hda_verb alc883_3ST_ch2_init[] = {
7722 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7723 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7724 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7725 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7732 static struct hda_verb alc883_3ST_ch4_init[] = {
7733 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7734 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7735 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7736 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7737 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7744 static struct hda_verb alc883_3ST_ch6_init[] = {
7745 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7746 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7747 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7748 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7749 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7750 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7754 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7755 { 2, alc883_3ST_ch2_init },
7756 { 4, alc883_3ST_ch4_init },
7757 { 6, alc883_3ST_ch6_init },
7764 static struct hda_verb alc883_4ST_ch2_init[] = {
7765 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7766 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7767 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7768 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7769 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7770 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7777 static struct hda_verb alc883_4ST_ch4_init[] = {
7778 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7779 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7780 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7781 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7782 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7783 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7784 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7791 static struct hda_verb alc883_4ST_ch6_init[] = {
7792 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7793 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7794 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7795 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7796 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7797 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7798 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7799 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7806 static struct hda_verb alc883_4ST_ch8_init[] = {
7807 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7808 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7809 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7810 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7811 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7812 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7813 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7814 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7815 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7819 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7820 { 2, alc883_4ST_ch2_init },
7821 { 4, alc883_4ST_ch4_init },
7822 { 6, alc883_4ST_ch6_init },
7823 { 8, alc883_4ST_ch8_init },
7830 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7831 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7832 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7833 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7834 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7841 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7842 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7843 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7844 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7845 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7846 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7853 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7854 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7855 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7856 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7857 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7858 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7859 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7863 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7864 { 2, alc883_3ST_ch2_intel_init },
7865 { 4, alc883_3ST_ch4_intel_init },
7866 { 6, alc883_3ST_ch6_intel_init },
7872 static struct hda_verb alc883_sixstack_ch6_init[] = {
7873 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7874 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7875 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7876 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7883 static struct hda_verb alc883_sixstack_ch8_init[] = {
7884 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7885 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7886 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7887 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7891 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7892 { 6, alc883_sixstack_ch6_init },
7893 { 8, alc883_sixstack_ch8_init },
7896 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7897 static struct hda_verb alc889A_mb31_ch2_init[] = {
7898 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7899 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7900 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7901 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7905 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7906 static struct hda_verb alc889A_mb31_ch4_init[] = {
7907 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7908 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7909 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7910 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7914 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7915 static struct hda_verb alc889A_mb31_ch5_init[] = {
7916 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7917 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7918 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7919 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7923 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7924 static struct hda_verb alc889A_mb31_ch6_init[] = {
7925 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7926 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7927 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7928 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7932 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7933 { 2, alc889A_mb31_ch2_init },
7934 { 4, alc889A_mb31_ch4_init },
7935 { 5, alc889A_mb31_ch5_init },
7936 { 6, alc889A_mb31_ch6_init },
7939 static struct hda_verb alc883_medion_eapd_verbs[] = {
7940 /* eanable EAPD on medion laptop */
7941 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7942 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7946 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7947 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7950 static struct snd_kcontrol_new alc883_base_mixer[] = {
7951 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7952 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7953 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7954 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7955 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7956 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7957 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7958 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7959 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7960 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7962 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7963 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7964 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7965 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7966 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7968 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7971 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7975 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7976 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7977 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7978 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7979 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7980 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7981 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7985 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7986 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7987 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7988 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7992 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7994 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7996 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7998 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8000 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8001 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8002 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8006 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8007 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8008 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8009 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8010 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8016 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8020 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8021 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8022 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8024 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8025 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8026 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8027 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8029 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8030 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8031 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8032 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8033 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8037 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8038 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8039 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8040 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8041 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8042 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8043 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8045 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8052 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8056 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8060 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8061 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8062 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8063 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8064 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8065 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8067 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8068 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8069 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8070 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8071 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8072 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8074 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8080 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8084 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8085 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8086 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8087 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8088 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8089 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8090 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8092 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8094 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8095 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8096 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8097 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8103 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8107 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8108 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8109 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8110 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8111 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8112 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8113 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8114 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8115 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8116 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8117 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8118 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8119 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8120 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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),
8127 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8128 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8130 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8134 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8136 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8137 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8138 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8142 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8143 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8144 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8146 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8149 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8154 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8155 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8156 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8157 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8158 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8159 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8162 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8163 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8167 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8168 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8170 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8171 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8172 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8174 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8175 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8176 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8180 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8181 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8182 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8184 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8185 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8186 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8187 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8192 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8193 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8194 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8195 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8196 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8200 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8205 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8206 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8207 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8208 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8209 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8210 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8211 0x0d, 1, 0x0, HDA_OUTPUT),
8212 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8213 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8214 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8215 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8216 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8217 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8218 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8219 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8220 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8222 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8223 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8224 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8225 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8226 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8230 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8233 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8235 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8236 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8238 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8239 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8240 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8241 /* Output switches */
8242 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8243 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8244 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8246 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8247 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8256 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8257 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8258 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8260 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8261 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8266 static struct hda_bind_ctls alc883_bind_cap_vol = {
8267 .ops = &snd_hda_bind_vol,
8269 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8270 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8275 static struct hda_bind_ctls alc883_bind_cap_switch = {
8276 .ops = &snd_hda_bind_sw,
8278 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8279 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8284 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8285 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8286 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8287 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8288 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8289 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8292 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8296 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8297 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8298 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8300 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8301 /* .name = "Capture Source", */
8302 .name = "Input Source",
8304 .info = alc_mux_enum_info,
8305 .get = alc_mux_enum_get,
8306 .put = alc_mux_enum_put,
8311 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8313 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8314 .name = "Channel Mode",
8315 .info = alc_ch_mode_info,
8316 .get = alc_ch_mode_get,
8317 .put = alc_ch_mode_put,
8322 static struct hda_verb alc883_init_verbs[] = {
8323 /* ADC1: mute amp left and right */
8324 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8325 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8326 /* ADC2: mute amp left and right */
8327 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8328 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8329 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8340 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8342 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8343 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8344 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8346 /* mute analog input loopbacks */
8347 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8348 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8349 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8351 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8353 /* Front Pin: output 0 (0x0c) */
8354 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8355 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8356 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8357 /* Rear Pin: output 1 (0x0d) */
8358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8359 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8360 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8361 /* CLFE Pin: output 2 (0x0e) */
8362 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8363 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8364 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8365 /* Side Pin: output 3 (0x0f) */
8366 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8367 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8368 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8369 /* Mic (rear) pin: input vref at 80% */
8370 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8371 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8372 /* Front Mic pin: input vref at 80% */
8373 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8374 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8375 /* Line In pin: input */
8376 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8378 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8379 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8380 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8381 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8382 /* CD pin widget for input */
8383 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8385 /* FIXME: use matrix-type input source selection */
8386 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8388 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8400 /* toggle speaker-output according to the hp-jack state */
8401 static void alc883_mitac_init_hook(struct hda_codec *codec)
8403 struct alc_spec *spec = codec->spec;
8405 spec->autocfg.hp_pins[0] = 0x15;
8406 spec->autocfg.speaker_pins[0] = 0x14;
8407 spec->autocfg.speaker_pins[1] = 0x17;
8408 alc_automute_amp(codec);
8411 /* auto-toggle front mic */
8413 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8415 unsigned int present;
8418 present = snd_hda_codec_read(codec, 0x18, 0,
8419 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8420 bits = present ? HDA_AMP_MUTE : 0;
8421 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8425 static struct hda_verb alc883_mitac_verbs[] = {
8427 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8428 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8430 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8431 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8433 /* enable unsolicited event */
8434 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8435 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8440 static struct hda_verb alc883_clevo_m720_verbs[] = {
8442 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8445 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8446 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8448 /* enable unsolicited event */
8449 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8450 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8455 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8457 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8461 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8463 /* enable unsolicited event */
8464 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8469 static struct hda_verb alc883_targa_verbs[] = {
8470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8476 /* Connect Line-Out side jack (SPDIF) to Side */
8477 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8478 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8479 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8480 /* Connect Mic jack to CLFE */
8481 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8482 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8483 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8484 /* Connect Line-in jack to Surround */
8485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8487 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8488 /* Connect HP out jack to Front */
8489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8490 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8491 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8493 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8498 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8499 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8500 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8501 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8505 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8506 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8508 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8509 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8513 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8515 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8516 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8517 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8518 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8522 static struct hda_verb alc883_haier_w66_verbs[] = {
8523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8528 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8530 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8531 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8535 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8541 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8542 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8543 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8547 static struct hda_verb alc888_6st_dell_verbs[] = {
8548 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8552 static struct hda_verb alc883_vaiott_verbs[] = {
8554 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8557 /* enable unsolicited event */
8558 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8563 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8565 struct alc_spec *spec = codec->spec;
8567 spec->autocfg.hp_pins[0] = 0x1b;
8568 spec->autocfg.speaker_pins[0] = 0x14;
8569 spec->autocfg.speaker_pins[1] = 0x16;
8570 spec->autocfg.speaker_pins[2] = 0x18;
8571 alc_automute_amp(codec);
8574 static struct hda_verb alc888_3st_hp_verbs[] = {
8575 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8576 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8577 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8578 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8585 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8586 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8587 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8588 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8589 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8596 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8597 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8598 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8599 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8600 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8601 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8608 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8609 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8610 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8611 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8612 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8613 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8614 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8618 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8619 { 2, alc888_3st_hp_2ch_init },
8620 { 4, alc888_3st_hp_4ch_init },
8621 { 6, alc888_3st_hp_6ch_init },
8624 /* toggle front-jack and RCA according to the hp-jack state */
8625 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8627 unsigned int present;
8629 present = snd_hda_codec_read(codec, 0x1b, 0,
8630 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8631 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8632 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8633 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8634 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8637 /* toggle RCA according to the front-jack state */
8638 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8640 unsigned int present;
8642 present = snd_hda_codec_read(codec, 0x14, 0,
8643 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8644 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8645 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8648 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8651 if ((res >> 26) == ALC880_HP_EVENT)
8652 alc888_lenovo_ms7195_front_automute(codec);
8653 if ((res >> 26) == ALC880_FRONT_EVENT)
8654 alc888_lenovo_ms7195_rca_automute(codec);
8657 static struct hda_verb alc883_medion_md2_verbs[] = {
8658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8661 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8663 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8667 /* toggle speaker-output according to the hp-jack state */
8668 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8670 struct alc_spec *spec = codec->spec;
8672 spec->autocfg.hp_pins[0] = 0x14;
8673 spec->autocfg.speaker_pins[0] = 0x15;
8674 alc_automute_amp(codec);
8677 /* toggle speaker-output according to the hp-jack state */
8678 #define alc883_targa_init_hook alc882_targa_init_hook
8679 #define alc883_targa_unsol_event alc882_targa_unsol_event
8681 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8683 unsigned int present;
8685 present = snd_hda_codec_read(codec, 0x18, 0,
8686 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8687 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8688 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8691 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8693 struct alc_spec *spec = codec->spec;
8695 spec->autocfg.hp_pins[0] = 0x15;
8696 spec->autocfg.speaker_pins[0] = 0x14;
8697 alc_automute_amp(codec);
8698 alc883_clevo_m720_mic_automute(codec);
8701 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8704 switch (res >> 26) {
8705 case ALC880_MIC_EVENT:
8706 alc883_clevo_m720_mic_automute(codec);
8709 alc_automute_amp_unsol_event(codec, res);
8714 /* toggle speaker-output according to the hp-jack state */
8715 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8717 struct alc_spec *spec = codec->spec;
8719 spec->autocfg.hp_pins[0] = 0x14;
8720 spec->autocfg.speaker_pins[0] = 0x15;
8721 alc_automute_amp(codec);
8724 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8726 struct alc_spec *spec = codec->spec;
8728 spec->autocfg.hp_pins[0] = 0x1b;
8729 spec->autocfg.speaker_pins[0] = 0x14;
8730 alc_automute_amp(codec);
8733 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8735 unsigned int present;
8738 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8739 & AC_PINSENSE_PRESENCE;
8740 bits = present ? HDA_AMP_MUTE : 0;
8741 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8742 HDA_AMP_MUTE, bits);
8745 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8747 unsigned int present;
8750 present = snd_hda_codec_read(codec, 0x1b, 0,
8751 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8752 bits = present ? HDA_AMP_MUTE : 0;
8753 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8754 HDA_AMP_MUTE, bits);
8755 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8756 HDA_AMP_MUTE, bits);
8759 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8762 if ((res >> 26) == ALC880_HP_EVENT)
8763 alc883_lenovo_101e_all_automute(codec);
8764 if ((res >> 26) == ALC880_FRONT_EVENT)
8765 alc883_lenovo_101e_ispeaker_automute(codec);
8768 /* toggle speaker-output according to the hp-jack state */
8769 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8771 struct alc_spec *spec = codec->spec;
8773 spec->autocfg.hp_pins[0] = 0x14;
8774 spec->autocfg.speaker_pins[0] = 0x15;
8775 spec->autocfg.speaker_pins[1] = 0x16;
8776 alc_automute_amp(codec);
8779 static struct hda_verb alc883_acer_eapd_verbs[] = {
8780 /* HP Pin: output 0 (0x0c) */
8781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8783 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8784 /* Front Pin: output 0 (0x0c) */
8785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8786 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8787 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8788 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8789 /* eanable EAPD on medion laptop */
8790 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8791 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8792 /* enable unsolicited event */
8793 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8797 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8799 struct alc_spec *spec = codec->spec;
8801 spec->autocfg.hp_pins[0] = 0x1b;
8802 spec->autocfg.speaker_pins[0] = 0x14;
8803 spec->autocfg.speaker_pins[1] = 0x15;
8804 spec->autocfg.speaker_pins[2] = 0x16;
8805 spec->autocfg.speaker_pins[3] = 0x17;
8806 alc_automute_amp(codec);
8809 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8811 struct alc_spec *spec = codec->spec;
8813 spec->autocfg.hp_pins[0] = 0x1b;
8814 spec->autocfg.speaker_pins[0] = 0x14;
8815 spec->autocfg.speaker_pins[1] = 0x15;
8816 spec->autocfg.speaker_pins[2] = 0x16;
8817 spec->autocfg.speaker_pins[3] = 0x17;
8818 spec->autocfg.speaker_pins[4] = 0x1a;
8819 alc_automute_amp(codec);
8822 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8824 struct alc_spec *spec = codec->spec;
8826 spec->autocfg.hp_pins[0] = 0x15;
8827 spec->autocfg.speaker_pins[0] = 0x14;
8828 spec->autocfg.speaker_pins[1] = 0x17;
8829 alc_automute_amp(codec);
8833 * generic initialization of ADC, input mixers and output mixers
8835 static struct hda_verb alc883_auto_init_verbs[] = {
8837 * Unmute ADC0-2 and set the default input to mic-in
8839 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8840 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8841 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8842 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8844 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8846 * Note: PASD motherboards uses the Line In 2 as the input for
8847 * front panel mic (mic 2)
8849 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8850 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8851 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8857 * Set up output mixers (0x0c - 0x0f)
8859 /* set vol=0 to output mixers */
8860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8861 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8862 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8863 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8864 /* set up input amps for analog loopback */
8865 /* Amp Indices: DAC = 0, mixer = 1 */
8866 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8867 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8868 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8869 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8870 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8871 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8872 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8873 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8874 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8875 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8877 /* FIXME: use matrix-type input source selection */
8878 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8880 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8881 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8882 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8883 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8884 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8886 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8887 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8888 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8889 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8890 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8895 static struct hda_verb alc888_asus_m90v_verbs[] = {
8896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8897 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8898 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8899 /* enable unsolicited event */
8900 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8901 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8905 static void alc883_nb_mic_automute(struct hda_codec *codec)
8907 unsigned int present;
8909 present = snd_hda_codec_read(codec, 0x18, 0,
8910 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8911 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8912 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8913 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8914 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8917 static void alc883_M90V_init_hook(struct hda_codec *codec)
8919 struct alc_spec *spec = codec->spec;
8921 spec->autocfg.hp_pins[0] = 0x1b;
8922 spec->autocfg.speaker_pins[0] = 0x14;
8923 spec->autocfg.speaker_pins[1] = 0x15;
8924 spec->autocfg.speaker_pins[2] = 0x16;
8925 alc_automute_pin(codec);
8928 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8931 switch (res >> 26) {
8932 case ALC880_MIC_EVENT:
8933 alc883_nb_mic_automute(codec);
8936 alc_sku_unsol_event(codec, res);
8941 static void alc883_mode2_inithook(struct hda_codec *codec)
8943 alc883_M90V_init_hook(codec);
8944 alc883_nb_mic_automute(codec);
8947 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8948 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8949 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8950 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8951 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8952 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8953 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8954 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8955 /* enable unsolicited event */
8956 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8960 static void alc883_eee1601_inithook(struct hda_codec *codec)
8962 struct alc_spec *spec = codec->spec;
8964 spec->autocfg.hp_pins[0] = 0x14;
8965 spec->autocfg.speaker_pins[0] = 0x1b;
8966 alc_automute_pin(codec);
8969 static struct hda_verb alc889A_mb31_verbs[] = {
8970 /* Init rear pin (used as headphone output) */
8971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8972 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8973 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8974 /* Init line pin (used as output in 4ch and 6ch mode) */
8975 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8976 /* Init line 2 pin (used as headphone out by default) */
8977 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8978 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8982 /* Mute speakers according to the headphone jack state */
8983 static void alc889A_mb31_automute(struct hda_codec *codec)
8985 unsigned int present;
8987 /* Mute only in 2ch or 4ch mode */
8988 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8990 present = snd_hda_codec_read(codec, 0x15, 0,
8991 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8992 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8993 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8994 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8995 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8999 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9001 if ((res >> 26) == ALC880_HP_EVENT)
9002 alc889A_mb31_automute(codec);
9005 #ifdef CONFIG_SND_HDA_POWER_SAVE
9006 #define alc883_loopbacks alc880_loopbacks
9009 /* pcm configuration: identical with ALC880 */
9010 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
9011 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
9012 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
9013 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
9014 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
9017 * configuration and preset
9019 static const char *alc883_models[ALC883_MODEL_LAST] = {
9020 [ALC883_3ST_2ch_DIG] = "3stack-dig",
9021 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9022 [ALC883_3ST_6ch] = "3stack-6ch",
9023 [ALC883_6ST_DIG] = "6stack-dig",
9024 [ALC883_TARGA_DIG] = "targa-dig",
9025 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9026 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9027 [ALC883_ACER] = "acer",
9028 [ALC883_ACER_ASPIRE] = "acer-aspire",
9029 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9030 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9031 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9032 [ALC883_MEDION] = "medion",
9033 [ALC883_MEDION_MD2] = "medion-md2",
9034 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9035 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9036 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9037 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9038 [ALC888_LENOVO_SKY] = "lenovo-sky",
9039 [ALC883_HAIER_W66] = "haier-w66",
9040 [ALC888_3ST_HP] = "3stack-hp",
9041 [ALC888_6ST_DELL] = "6stack-dell",
9042 [ALC883_MITAC] = "mitac",
9043 [ALC883_CLEVO_M720] = "clevo-m720",
9044 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9045 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9046 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9047 [ALC1200_ASUS_P5Q] = "asus-p5q",
9048 [ALC889A_MB31] = "mb31",
9049 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9050 [ALC883_AUTO] = "auto",
9053 static struct snd_pci_quirk alc883_cfg_tbl[] = {
9054 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
9055 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9056 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9057 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9058 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9059 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9060 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9061 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9062 ALC888_ACER_ASPIRE_4930G),
9063 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9064 ALC888_ACER_ASPIRE_4930G),
9065 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9066 ALC888_ACER_ASPIRE_8930G),
9067 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9068 ALC888_ACER_ASPIRE_8930G),
9069 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
9070 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
9071 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9072 ALC888_ACER_ASPIRE_4930G),
9073 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9074 ALC888_ACER_ASPIRE_6530G),
9075 /* default Acer -- disabled as it causes more problems.
9076 * model=auto should work fine now
9078 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9079 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9080 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9081 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9082 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9083 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9084 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9085 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9086 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9087 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9088 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9089 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9090 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9091 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9092 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
9093 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9094 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9095 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9096 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9097 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9098 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
9099 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9100 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9101 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9102 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
9103 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9104 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9105 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9106 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9107 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9108 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9109 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9110 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9111 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9112 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9113 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9114 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9115 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9116 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9117 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9118 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9119 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9120 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9121 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9122 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9123 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9124 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9125 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9126 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9127 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9128 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9129 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9130 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9131 ALC883_FUJITSU_PI2515),
9132 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9133 ALC888_FUJITSU_XA3530),
9134 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9135 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9136 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9137 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9138 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9139 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9140 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9141 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9142 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9143 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9144 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9145 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9146 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
9147 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9148 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9152 static hda_nid_t alc883_slave_dig_outs[] = {
9153 ALC1200_DIGOUT_NID, 0,
9156 static hda_nid_t alc1200_slave_dig_outs[] = {
9157 ALC883_DIGOUT_NID, 0,
9160 static struct alc_config_preset alc883_presets[] = {
9161 [ALC883_3ST_2ch_DIG] = {
9162 .mixers = { alc883_3ST_2ch_mixer },
9163 .init_verbs = { alc883_init_verbs },
9164 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9165 .dac_nids = alc883_dac_nids,
9166 .dig_out_nid = ALC883_DIGOUT_NID,
9167 .dig_in_nid = ALC883_DIGIN_NID,
9168 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9169 .channel_mode = alc883_3ST_2ch_modes,
9170 .input_mux = &alc883_capture_source,
9172 [ALC883_3ST_6ch_DIG] = {
9173 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9174 .init_verbs = { alc883_init_verbs },
9175 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9176 .dac_nids = alc883_dac_nids,
9177 .dig_out_nid = ALC883_DIGOUT_NID,
9178 .dig_in_nid = ALC883_DIGIN_NID,
9179 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9180 .channel_mode = alc883_3ST_6ch_modes,
9182 .input_mux = &alc883_capture_source,
9184 [ALC883_3ST_6ch] = {
9185 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9186 .init_verbs = { alc883_init_verbs },
9187 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9188 .dac_nids = alc883_dac_nids,
9189 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9190 .channel_mode = alc883_3ST_6ch_modes,
9192 .input_mux = &alc883_capture_source,
9194 [ALC883_3ST_6ch_INTEL] = {
9195 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9196 .init_verbs = { alc883_init_verbs },
9197 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9198 .dac_nids = alc883_dac_nids,
9199 .dig_out_nid = ALC883_DIGOUT_NID,
9200 .dig_in_nid = ALC883_DIGIN_NID,
9201 .slave_dig_outs = alc883_slave_dig_outs,
9202 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9203 .channel_mode = alc883_3ST_6ch_intel_modes,
9205 .input_mux = &alc883_3stack_6ch_intel,
9207 [ALC883_6ST_DIG] = {
9208 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9209 .init_verbs = { alc883_init_verbs },
9210 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9211 .dac_nids = alc883_dac_nids,
9212 .dig_out_nid = ALC883_DIGOUT_NID,
9213 .dig_in_nid = ALC883_DIGIN_NID,
9214 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9215 .channel_mode = alc883_sixstack_modes,
9216 .input_mux = &alc883_capture_source,
9218 [ALC883_TARGA_DIG] = {
9219 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9220 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
9221 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9222 .dac_nids = alc883_dac_nids,
9223 .dig_out_nid = ALC883_DIGOUT_NID,
9224 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9225 .channel_mode = alc883_3ST_6ch_modes,
9227 .input_mux = &alc883_capture_source,
9228 .unsol_event = alc883_targa_unsol_event,
9229 .init_hook = alc883_targa_init_hook,
9231 [ALC883_TARGA_2ch_DIG] = {
9232 .mixers = { alc883_targa_2ch_mixer},
9233 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
9234 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9235 .dac_nids = alc883_dac_nids,
9236 .adc_nids = alc883_adc_nids_alt,
9237 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9238 .dig_out_nid = ALC883_DIGOUT_NID,
9239 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9240 .channel_mode = alc883_3ST_2ch_modes,
9241 .input_mux = &alc883_capture_source,
9242 .unsol_event = alc883_targa_unsol_event,
9243 .init_hook = alc883_targa_init_hook,
9245 [ALC883_TARGA_8ch_DIG] = {
9246 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9247 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9248 alc883_targa_verbs },
9249 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9250 .dac_nids = alc883_dac_nids,
9251 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9252 .adc_nids = alc883_adc_nids_rev,
9253 .capsrc_nids = alc883_capsrc_nids_rev,
9254 .dig_out_nid = ALC883_DIGOUT_NID,
9255 .dig_in_nid = ALC883_DIGIN_NID,
9256 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9257 .channel_mode = alc883_4ST_8ch_modes,
9259 .input_mux = &alc883_capture_source,
9260 .unsol_event = alc883_targa_unsol_event,
9261 .init_hook = alc883_targa_init_hook,
9264 .mixers = { alc883_base_mixer },
9265 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9266 * and the headphone jack. Turn this on and rely on the
9267 * standard mute methods whenever the user wants to turn
9268 * these outputs off.
9270 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9271 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9272 .dac_nids = alc883_dac_nids,
9273 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9274 .channel_mode = alc883_3ST_2ch_modes,
9275 .input_mux = &alc883_capture_source,
9277 [ALC883_ACER_ASPIRE] = {
9278 .mixers = { alc883_acer_aspire_mixer },
9279 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9280 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9281 .dac_nids = alc883_dac_nids,
9282 .dig_out_nid = ALC883_DIGOUT_NID,
9283 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9284 .channel_mode = alc883_3ST_2ch_modes,
9285 .input_mux = &alc883_capture_source,
9286 .unsol_event = alc_automute_amp_unsol_event,
9287 .init_hook = alc883_acer_aspire_init_hook,
9289 [ALC888_ACER_ASPIRE_4930G] = {
9290 .mixers = { alc888_base_mixer,
9291 alc883_chmode_mixer },
9292 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9293 alc888_acer_aspire_4930g_verbs },
9294 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9295 .dac_nids = alc883_dac_nids,
9296 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9297 .adc_nids = alc883_adc_nids_rev,
9298 .capsrc_nids = alc883_capsrc_nids_rev,
9299 .dig_out_nid = ALC883_DIGOUT_NID,
9300 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9301 .channel_mode = alc883_3ST_6ch_modes,
9304 ARRAY_SIZE(alc888_2_capture_sources),
9305 .input_mux = alc888_2_capture_sources,
9306 .unsol_event = alc_automute_amp_unsol_event,
9307 .init_hook = alc888_acer_aspire_4930g_init_hook,
9309 [ALC888_ACER_ASPIRE_6530G] = {
9310 .mixers = { alc888_acer_aspire_6530_mixer },
9311 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9312 alc888_acer_aspire_6530g_verbs },
9313 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9314 .dac_nids = alc883_dac_nids,
9315 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9316 .adc_nids = alc883_adc_nids_rev,
9317 .capsrc_nids = alc883_capsrc_nids_rev,
9318 .dig_out_nid = ALC883_DIGOUT_NID,
9319 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9320 .channel_mode = alc883_3ST_2ch_modes,
9322 ARRAY_SIZE(alc888_2_capture_sources),
9323 .input_mux = alc888_acer_aspire_6530_sources,
9324 .unsol_event = alc_automute_amp_unsol_event,
9325 .init_hook = alc888_acer_aspire_4930g_init_hook,
9327 [ALC888_ACER_ASPIRE_8930G] = {
9328 .mixers = { alc888_base_mixer,
9329 alc883_chmode_mixer },
9330 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9331 alc889_acer_aspire_8930g_verbs },
9332 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9333 .dac_nids = alc883_dac_nids,
9334 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9335 .adc_nids = alc889_adc_nids,
9336 .capsrc_nids = alc889_capsrc_nids,
9337 .dig_out_nid = ALC883_DIGOUT_NID,
9338 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9339 .channel_mode = alc883_3ST_6ch_modes,
9341 .const_channel_count = 6,
9343 ARRAY_SIZE(alc889_capture_sources),
9344 .input_mux = alc889_capture_sources,
9345 .unsol_event = alc_automute_amp_unsol_event,
9346 .init_hook = alc889_acer_aspire_8930g_init_hook,
9349 .mixers = { alc883_fivestack_mixer,
9350 alc883_chmode_mixer },
9351 .init_verbs = { alc883_init_verbs,
9352 alc883_medion_eapd_verbs },
9353 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9354 .dac_nids = alc883_dac_nids,
9355 .adc_nids = alc883_adc_nids_alt,
9356 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9357 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9358 .channel_mode = alc883_sixstack_modes,
9359 .input_mux = &alc883_capture_source,
9361 [ALC883_MEDION_MD2] = {
9362 .mixers = { alc883_medion_md2_mixer},
9363 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9364 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9365 .dac_nids = alc883_dac_nids,
9366 .dig_out_nid = ALC883_DIGOUT_NID,
9367 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9368 .channel_mode = alc883_3ST_2ch_modes,
9369 .input_mux = &alc883_capture_source,
9370 .unsol_event = alc_automute_amp_unsol_event,
9371 .init_hook = alc883_medion_md2_init_hook,
9373 [ALC883_LAPTOP_EAPD] = {
9374 .mixers = { alc883_base_mixer },
9375 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9377 .dac_nids = alc883_dac_nids,
9378 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9379 .channel_mode = alc883_3ST_2ch_modes,
9380 .input_mux = &alc883_capture_source,
9382 [ALC883_CLEVO_M720] = {
9383 .mixers = { alc883_clevo_m720_mixer },
9384 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9385 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9386 .dac_nids = alc883_dac_nids,
9387 .dig_out_nid = ALC883_DIGOUT_NID,
9388 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9389 .channel_mode = alc883_3ST_2ch_modes,
9390 .input_mux = &alc883_capture_source,
9391 .unsol_event = alc883_clevo_m720_unsol_event,
9392 .init_hook = alc883_clevo_m720_init_hook,
9394 [ALC883_LENOVO_101E_2ch] = {
9395 .mixers = { alc883_lenovo_101e_2ch_mixer},
9396 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9397 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9398 .dac_nids = alc883_dac_nids,
9399 .adc_nids = alc883_adc_nids_alt,
9400 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9401 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9402 .channel_mode = alc883_3ST_2ch_modes,
9403 .input_mux = &alc883_lenovo_101e_capture_source,
9404 .unsol_event = alc883_lenovo_101e_unsol_event,
9405 .init_hook = alc883_lenovo_101e_all_automute,
9407 [ALC883_LENOVO_NB0763] = {
9408 .mixers = { alc883_lenovo_nb0763_mixer },
9409 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9410 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9411 .dac_nids = alc883_dac_nids,
9412 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9413 .channel_mode = alc883_3ST_2ch_modes,
9415 .input_mux = &alc883_lenovo_nb0763_capture_source,
9416 .unsol_event = alc_automute_amp_unsol_event,
9417 .init_hook = alc883_medion_md2_init_hook,
9419 [ALC888_LENOVO_MS7195_DIG] = {
9420 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9421 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9422 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9423 .dac_nids = alc883_dac_nids,
9424 .dig_out_nid = ALC883_DIGOUT_NID,
9425 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9426 .channel_mode = alc883_3ST_6ch_modes,
9428 .input_mux = &alc883_capture_source,
9429 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9430 .init_hook = alc888_lenovo_ms7195_front_automute,
9432 [ALC883_HAIER_W66] = {
9433 .mixers = { alc883_targa_2ch_mixer},
9434 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9435 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9436 .dac_nids = alc883_dac_nids,
9437 .dig_out_nid = ALC883_DIGOUT_NID,
9438 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9439 .channel_mode = alc883_3ST_2ch_modes,
9440 .input_mux = &alc883_capture_source,
9441 .unsol_event = alc_automute_amp_unsol_event,
9442 .init_hook = alc883_haier_w66_init_hook,
9445 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9446 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9447 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9448 .dac_nids = alc883_dac_nids,
9449 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9450 .channel_mode = alc888_3st_hp_modes,
9452 .input_mux = &alc883_capture_source,
9453 .unsol_event = alc_automute_amp_unsol_event,
9454 .init_hook = alc888_3st_hp_init_hook,
9456 [ALC888_6ST_DELL] = {
9457 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9458 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9459 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9460 .dac_nids = alc883_dac_nids,
9461 .dig_out_nid = ALC883_DIGOUT_NID,
9462 .dig_in_nid = ALC883_DIGIN_NID,
9463 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9464 .channel_mode = alc883_sixstack_modes,
9465 .input_mux = &alc883_capture_source,
9466 .unsol_event = alc_automute_amp_unsol_event,
9467 .init_hook = alc888_6st_dell_init_hook,
9470 .mixers = { alc883_mitac_mixer },
9471 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9473 .dac_nids = alc883_dac_nids,
9474 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9475 .channel_mode = alc883_3ST_2ch_modes,
9476 .input_mux = &alc883_capture_source,
9477 .unsol_event = alc_automute_amp_unsol_event,
9478 .init_hook = alc883_mitac_init_hook,
9480 [ALC883_FUJITSU_PI2515] = {
9481 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9482 .init_verbs = { alc883_init_verbs,
9483 alc883_2ch_fujitsu_pi2515_verbs},
9484 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9485 .dac_nids = alc883_dac_nids,
9486 .dig_out_nid = ALC883_DIGOUT_NID,
9487 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9488 .channel_mode = alc883_3ST_2ch_modes,
9489 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9490 .unsol_event = alc_automute_amp_unsol_event,
9491 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9493 [ALC888_FUJITSU_XA3530] = {
9494 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9495 .init_verbs = { alc883_init_verbs,
9496 alc888_fujitsu_xa3530_verbs },
9497 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9498 .dac_nids = alc883_dac_nids,
9499 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9500 .adc_nids = alc883_adc_nids_rev,
9501 .capsrc_nids = alc883_capsrc_nids_rev,
9502 .dig_out_nid = ALC883_DIGOUT_NID,
9503 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9504 .channel_mode = alc888_4ST_8ch_intel_modes,
9506 ARRAY_SIZE(alc888_2_capture_sources),
9507 .input_mux = alc888_2_capture_sources,
9508 .unsol_event = alc_automute_amp_unsol_event,
9509 .init_hook = alc888_fujitsu_xa3530_init_hook,
9511 [ALC888_LENOVO_SKY] = {
9512 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9513 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9514 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9515 .dac_nids = alc883_dac_nids,
9516 .dig_out_nid = ALC883_DIGOUT_NID,
9517 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9518 .channel_mode = alc883_sixstack_modes,
9520 .input_mux = &alc883_lenovo_sky_capture_source,
9521 .unsol_event = alc_automute_amp_unsol_event,
9522 .init_hook = alc888_lenovo_sky_init_hook,
9524 [ALC888_ASUS_M90V] = {
9525 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9526 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9527 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9528 .dac_nids = alc883_dac_nids,
9529 .dig_out_nid = ALC883_DIGOUT_NID,
9530 .dig_in_nid = ALC883_DIGIN_NID,
9531 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9532 .channel_mode = alc883_3ST_6ch_modes,
9534 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9535 .unsol_event = alc883_mode2_unsol_event,
9536 .init_hook = alc883_mode2_inithook,
9538 [ALC888_ASUS_EEE1601] = {
9539 .mixers = { alc883_asus_eee1601_mixer },
9540 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9541 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9542 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9543 .dac_nids = alc883_dac_nids,
9544 .dig_out_nid = ALC883_DIGOUT_NID,
9545 .dig_in_nid = ALC883_DIGIN_NID,
9546 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9547 .channel_mode = alc883_3ST_2ch_modes,
9549 .input_mux = &alc883_asus_eee1601_capture_source,
9550 .unsol_event = alc_sku_unsol_event,
9551 .init_hook = alc883_eee1601_inithook,
9553 [ALC1200_ASUS_P5Q] = {
9554 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9555 .init_verbs = { alc883_init_verbs },
9556 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9557 .dac_nids = alc883_dac_nids,
9558 .dig_out_nid = ALC1200_DIGOUT_NID,
9559 .dig_in_nid = ALC883_DIGIN_NID,
9560 .slave_dig_outs = alc1200_slave_dig_outs,
9561 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9562 .channel_mode = alc883_sixstack_modes,
9563 .input_mux = &alc883_capture_source,
9566 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9567 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9568 alc880_gpio1_init_verbs },
9569 .adc_nids = alc883_adc_nids,
9570 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9571 .dac_nids = alc883_dac_nids,
9572 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9573 .channel_mode = alc889A_mb31_6ch_modes,
9574 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9575 .input_mux = &alc889A_mb31_capture_source,
9576 .dig_out_nid = ALC883_DIGOUT_NID,
9577 .unsol_event = alc889A_mb31_unsol_event,
9578 .init_hook = alc889A_mb31_automute,
9580 [ALC883_SONY_VAIO_TT] = {
9581 .mixers = { alc883_vaiott_mixer },
9582 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9583 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9584 .dac_nids = alc883_dac_nids,
9585 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9586 .channel_mode = alc883_3ST_2ch_modes,
9587 .input_mux = &alc883_capture_source,
9588 .unsol_event = alc_automute_amp_unsol_event,
9589 .init_hook = alc883_vaiott_init_hook,
9595 * BIOS auto configuration
9597 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9598 hda_nid_t nid, int pin_type,
9602 struct alc_spec *spec = codec->spec;
9605 alc_set_pin_output(codec, nid, pin_type);
9606 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9609 idx = spec->multiout.dac_nids[dac_idx] - 2;
9610 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9614 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9616 struct alc_spec *spec = codec->spec;
9619 for (i = 0; i <= HDA_SIDE; i++) {
9620 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9621 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9623 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9628 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9630 struct alc_spec *spec = codec->spec;
9633 pin = spec->autocfg.hp_pins[0];
9634 if (pin) /* connect to front */
9636 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9637 pin = spec->autocfg.speaker_pins[0];
9639 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9642 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9643 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9645 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9647 struct alc_spec *spec = codec->spec;
9650 for (i = 0; i < AUTO_PIN_LAST; i++) {
9651 hda_nid_t nid = spec->autocfg.input_pins[i];
9652 if (alc883_is_input_pin(nid)) {
9653 alc_set_input_pin(codec, nid, i);
9654 if (nid != ALC883_PIN_CD_NID &&
9655 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9656 snd_hda_codec_write(codec, nid, 0,
9657 AC_VERB_SET_AMP_GAIN_MUTE,
9663 #define alc883_auto_init_input_src alc882_auto_init_input_src
9665 /* almost identical with ALC880 parser... */
9666 static int alc883_parse_auto_config(struct hda_codec *codec)
9668 struct alc_spec *spec = codec->spec;
9669 int err = alc880_parse_auto_config(codec);
9670 struct auto_pin_cfg *cfg = &spec->autocfg;
9676 return 0; /* no config found */
9678 err = alc_auto_add_mic_boost(codec);
9682 /* hack - override the init verbs */
9683 spec->init_verbs[0] = alc883_auto_init_verbs;
9685 /* setup input_mux for ALC889 */
9686 if (codec->vendor_id == 0x10ec0889) {
9687 /* digital-mic input pin is excluded in alc880_auto_create..()
9688 * because it's under 0x18
9690 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9691 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9692 struct hda_input_mux *imux = &spec->private_imux[0];
9693 for (i = 1; i < 3; i++)
9694 memcpy(&spec->private_imux[i],
9695 &spec->private_imux[0],
9696 sizeof(spec->private_imux[0]));
9697 imux->items[imux->num_items].label = "Int DMic";
9698 imux->items[imux->num_items].index = 0x0b;
9700 spec->num_mux_defs = 3;
9701 spec->input_mux = spec->private_imux;
9705 return 1; /* config found */
9708 /* additional initialization for auto-configuration model */
9709 static void alc883_auto_init(struct hda_codec *codec)
9711 struct alc_spec *spec = codec->spec;
9712 alc883_auto_init_multi_out(codec);
9713 alc883_auto_init_hp_out(codec);
9714 alc883_auto_init_analog_input(codec);
9715 alc883_auto_init_input_src(codec);
9716 if (spec->unsol_event)
9717 alc_inithook(codec);
9720 static int patch_alc883(struct hda_codec *codec)
9722 struct alc_spec *spec;
9723 int err, board_config;
9725 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9731 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9733 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9736 if (board_config < 0 || board_config >= ALC883_MODEL_LAST) {
9737 /* Pick up systems that don't supply PCI SSID */
9738 switch (codec->subsystem_id) {
9739 case 0x106b3600: /* Macbook 3.1 */
9740 board_config = ALC889A_MB31;
9744 "hda_codec: Unknown model for %s, trying "
9745 "auto-probe from BIOS...\n", codec->chip_name);
9746 board_config = ALC883_AUTO;
9750 if (board_config == ALC883_AUTO) {
9751 /* automatic parse from the BIOS config */
9752 err = alc883_parse_auto_config(codec);
9758 "hda_codec: Cannot set up configuration "
9759 "from BIOS. Using base mode...\n");
9760 board_config = ALC883_3ST_2ch_DIG;
9764 err = snd_hda_attach_beep_device(codec, 0x1);
9770 if (board_config != ALC883_AUTO)
9771 setup_preset(spec, &alc883_presets[board_config]);
9773 switch (codec->vendor_id) {
9775 if (!spec->num_adc_nids) {
9776 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9777 spec->adc_nids = alc883_adc_nids;
9779 if (!spec->capsrc_nids)
9780 spec->capsrc_nids = alc883_capsrc_nids;
9781 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9784 if (!spec->num_adc_nids) {
9785 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9786 spec->adc_nids = alc889_adc_nids;
9788 if (!spec->capsrc_nids)
9789 spec->capsrc_nids = alc889_capsrc_nids;
9792 if (!spec->num_adc_nids) {
9793 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9794 spec->adc_nids = alc883_adc_nids;
9796 if (!spec->capsrc_nids)
9797 spec->capsrc_nids = alc883_capsrc_nids;
9801 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9802 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9803 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9805 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9806 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9808 if (!spec->cap_mixer)
9809 set_capture_mixer(spec);
9810 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9812 spec->vmaster_nid = 0x0c;
9814 codec->patch_ops = alc_patch_ops;
9815 if (board_config == ALC883_AUTO)
9816 spec->init_hook = alc883_auto_init;
9818 #ifdef CONFIG_SND_HDA_POWER_SAVE
9819 if (!spec->loopback.amplist)
9820 spec->loopback.amplist = alc883_loopbacks;
9822 codec->proc_widget_hook = print_realtek_coef;
9831 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9832 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9834 #define alc262_dac_nids alc260_dac_nids
9835 #define alc262_adc_nids alc882_adc_nids
9836 #define alc262_adc_nids_alt alc882_adc_nids_alt
9837 #define alc262_capsrc_nids alc882_capsrc_nids
9838 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9840 #define alc262_modes alc260_modes
9841 #define alc262_capture_source alc882_capture_source
9843 static hda_nid_t alc262_dmic_adc_nids[1] = {
9848 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9850 static struct snd_kcontrol_new alc262_base_mixer[] = {
9851 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9852 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9853 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9854 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9855 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9856 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9859 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9860 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9861 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9862 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9863 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9864 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9865 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9866 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9870 /* update HP, line and mono-out pins according to the master switch */
9871 static void alc262_hp_master_update(struct hda_codec *codec)
9873 struct alc_spec *spec = codec->spec;
9874 int val = spec->master_sw;
9877 snd_hda_codec_write_cache(codec, 0x1b, 0,
9878 AC_VERB_SET_PIN_WIDGET_CONTROL,
9880 snd_hda_codec_write_cache(codec, 0x15, 0,
9881 AC_VERB_SET_PIN_WIDGET_CONTROL,
9883 /* mono (speaker) depending on the HP jack sense */
9884 val = val && !spec->jack_present;
9885 snd_hda_codec_write_cache(codec, 0x16, 0,
9886 AC_VERB_SET_PIN_WIDGET_CONTROL,
9890 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9892 struct alc_spec *spec = codec->spec;
9893 unsigned int presence;
9894 presence = snd_hda_codec_read(codec, 0x1b, 0,
9895 AC_VERB_GET_PIN_SENSE, 0);
9896 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9897 alc262_hp_master_update(codec);
9900 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9902 if ((res >> 26) != ALC880_HP_EVENT)
9904 alc262_hp_bpc_automute(codec);
9907 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9909 struct alc_spec *spec = codec->spec;
9910 unsigned int presence;
9911 presence = snd_hda_codec_read(codec, 0x15, 0,
9912 AC_VERB_GET_PIN_SENSE, 0);
9913 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9914 alc262_hp_master_update(codec);
9917 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9920 if ((res >> 26) != ALC880_HP_EVENT)
9922 alc262_hp_wildwest_automute(codec);
9925 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9927 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9928 struct snd_ctl_elem_value *ucontrol)
9930 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9931 struct alc_spec *spec = codec->spec;
9932 int val = !!*ucontrol->value.integer.value;
9934 if (val == spec->master_sw)
9936 spec->master_sw = val;
9937 alc262_hp_master_update(codec);
9941 #define ALC262_HP_MASTER_SWITCH \
9943 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9944 .name = "Master Playback Switch", \
9945 .info = snd_ctl_boolean_mono_info, \
9946 .get = alc262_hp_master_sw_get, \
9947 .put = alc262_hp_master_sw_put, \
9950 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9951 ALC262_HP_MASTER_SWITCH,
9952 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9953 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9954 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9955 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9957 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9961 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9962 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9963 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9964 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9965 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9966 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9967 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9968 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9969 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9970 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9974 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9975 ALC262_HP_MASTER_SWITCH,
9976 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9977 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9978 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9979 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9980 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9982 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9984 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9985 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9986 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9994 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9995 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9996 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9997 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10001 /* mute/unmute internal speaker according to the hp jack and mute state */
10002 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
10004 struct alc_spec *spec = codec->spec;
10006 spec->autocfg.hp_pins[0] = 0x15;
10007 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10008 alc_automute_amp(codec);
10011 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10012 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10013 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10014 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10015 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10017 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10018 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10022 static struct hda_verb alc262_hp_t5735_verbs[] = {
10023 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10024 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10026 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10030 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10031 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10033 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10034 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10035 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10036 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10040 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10041 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10042 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10043 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10044 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10045 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10046 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10047 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10049 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10050 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10054 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10061 /* bind hp and internal speaker mute (with plug check) as master switch */
10062 static void alc262_hippo_master_update(struct hda_codec *codec)
10064 struct alc_spec *spec = codec->spec;
10065 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10066 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10067 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10071 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10072 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10073 HDA_AMP_MUTE, mute);
10074 /* mute internal speaker per jack sense */
10075 if (spec->jack_present)
10076 mute = HDA_AMP_MUTE;
10078 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10079 HDA_AMP_MUTE, mute);
10080 if (speaker_nid && speaker_nid != line_nid)
10081 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10082 HDA_AMP_MUTE, mute);
10085 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10087 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10088 struct snd_ctl_elem_value *ucontrol)
10090 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10091 struct alc_spec *spec = codec->spec;
10092 int val = !!*ucontrol->value.integer.value;
10094 if (val == spec->master_sw)
10096 spec->master_sw = val;
10097 alc262_hippo_master_update(codec);
10101 #define ALC262_HIPPO_MASTER_SWITCH \
10103 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10104 .name = "Master Playback Switch", \
10105 .info = snd_ctl_boolean_mono_info, \
10106 .get = alc262_hippo_master_sw_get, \
10107 .put = alc262_hippo_master_sw_put, \
10110 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10111 ALC262_HIPPO_MASTER_SWITCH,
10112 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10113 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10114 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10115 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10116 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10120 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10121 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10122 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10123 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10127 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10128 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10129 ALC262_HIPPO_MASTER_SWITCH,
10130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10136 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10137 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10138 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10139 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10143 /* mute/unmute internal speaker according to the hp jack and mute state */
10144 static void alc262_hippo_automute(struct hda_codec *codec)
10146 struct alc_spec *spec = codec->spec;
10147 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10148 unsigned int present;
10150 /* need to execute and sync at first */
10151 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10152 present = snd_hda_codec_read(codec, hp_nid, 0,
10153 AC_VERB_GET_PIN_SENSE, 0);
10154 spec->jack_present = (present & 0x80000000) != 0;
10155 alc262_hippo_master_update(codec);
10158 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10160 if ((res >> 26) != ALC880_HP_EVENT)
10162 alc262_hippo_automute(codec);
10165 static void alc262_hippo_init_hook(struct hda_codec *codec)
10167 struct alc_spec *spec = codec->spec;
10169 spec->autocfg.hp_pins[0] = 0x15;
10170 spec->autocfg.speaker_pins[0] = 0x14;
10171 alc262_hippo_automute(codec);
10174 static void alc262_hippo1_init_hook(struct hda_codec *codec)
10176 struct alc_spec *spec = codec->spec;
10178 spec->autocfg.hp_pins[0] = 0x1b;
10179 spec->autocfg.speaker_pins[0] = 0x14;
10180 alc262_hippo_automute(codec);
10184 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10185 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10186 ALC262_HIPPO_MASTER_SWITCH,
10187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10189 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10190 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10194 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10195 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10196 ALC262_HIPPO_MASTER_SWITCH,
10197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10200 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10201 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10205 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10206 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10207 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10208 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10209 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10210 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10211 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10214 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10215 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10216 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10217 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10221 static struct hda_verb alc262_tyan_verbs[] = {
10222 /* Headphone automute */
10223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10224 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10225 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10227 /* P11 AUX_IN, white 4-pin connector */
10228 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10229 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10230 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10231 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10236 /* unsolicited event for HP jack sensing */
10237 static void alc262_tyan_init_hook(struct hda_codec *codec)
10239 struct alc_spec *spec = codec->spec;
10241 spec->autocfg.hp_pins[0] = 0x1b;
10242 spec->autocfg.speaker_pins[0] = 0x15;
10243 alc_automute_amp(codec);
10247 #define alc262_capture_mixer alc882_capture_mixer
10248 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10251 * generic initialization of ADC, input mixers and output mixers
10253 static struct hda_verb alc262_init_verbs[] = {
10255 * Unmute ADC0-2 and set the default input to mic-in
10257 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10259 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10260 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10261 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10262 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10264 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10266 * Note: PASD motherboards uses the Line In 2 as the input for
10267 * front panel mic (mic 2)
10269 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10277 * Set up output mixers (0x0c - 0x0e)
10279 /* set vol=0 to output mixers */
10280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10282 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10283 /* set up input amps for analog loopback */
10284 /* Amp Indices: DAC = 0, mixer = 1 */
10285 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10286 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10288 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10290 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10292 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10295 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10296 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10297 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10299 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10300 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10301 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10302 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10303 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10305 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10306 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10308 /* FIXME: use matrix-type input source selection */
10309 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10310 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10311 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10329 static struct hda_verb alc262_eapd_verbs[] = {
10330 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10331 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10335 static struct hda_verb alc262_hippo_unsol_verbs[] = {
10336 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10341 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10342 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10343 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10344 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10346 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10347 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10351 static struct hda_verb alc262_sony_unsol_verbs[] = {
10352 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10353 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10361 static struct hda_input_mux alc262_dmic_capture_source = {
10364 { "Int DMic", 0x9 },
10369 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10371 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10372 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10374 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10378 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10379 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10380 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10381 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10382 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10383 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10384 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10385 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10386 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10390 static void alc262_dmic_automute(struct hda_codec *codec)
10392 unsigned int present;
10394 present = snd_hda_codec_read(codec, 0x18, 0,
10395 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10396 snd_hda_codec_write(codec, 0x22, 0,
10397 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10401 /* unsolicited event for HP jack sensing */
10402 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10405 if ((res >> 26) == ALC880_MIC_EVENT)
10406 alc262_dmic_automute(codec);
10408 alc_sku_unsol_event(codec, res);
10411 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10413 struct alc_spec *spec = codec->spec;
10415 spec->autocfg.hp_pins[0] = 0x15;
10416 spec->autocfg.speaker_pins[0] = 0x14;
10417 alc_automute_pin(codec);
10418 alc262_dmic_automute(codec);
10424 * 0x16 = internal speaker
10425 * 0x18 = external mic
10428 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10429 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10430 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10434 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10436 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10441 static struct hda_verb alc262_nec_verbs[] = {
10442 /* Unmute Speaker */
10443 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10446 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10447 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10449 /* External mic to headphone */
10450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10451 /* External mic to speaker */
10452 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10458 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10459 * 0x1b = port replicator headphone out
10462 #define ALC_HP_EVENT 0x37
10464 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10465 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10467 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10468 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10472 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10473 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10478 static struct hda_input_mux alc262_fujitsu_capture_source = {
10482 { "Int Mic", 0x1 },
10487 static struct hda_input_mux alc262_HP_capture_source = {
10491 { "Front Mic", 0x1 },
10498 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10502 { "Front Mic", 0x2 },
10508 /* mute/unmute internal speaker according to the hp jacks and mute state */
10509 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10511 struct alc_spec *spec = codec->spec;
10514 if (force || !spec->sense_updated) {
10515 unsigned int present;
10516 /* need to execute and sync at first */
10517 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10518 /* check laptop HP jack */
10519 present = snd_hda_codec_read(codec, 0x14, 0,
10520 AC_VERB_GET_PIN_SENSE, 0);
10521 /* need to execute and sync at first */
10522 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10523 /* check docking HP jack */
10524 present |= snd_hda_codec_read(codec, 0x1b, 0,
10525 AC_VERB_GET_PIN_SENSE, 0);
10526 if (present & AC_PINSENSE_PRESENCE)
10527 spec->jack_present = 1;
10529 spec->jack_present = 0;
10530 spec->sense_updated = 1;
10532 /* unmute internal speaker only if both HPs are unplugged and
10533 * master switch is on
10535 if (spec->jack_present)
10536 mute = HDA_AMP_MUTE;
10538 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10539 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10540 HDA_AMP_MUTE, mute);
10543 /* unsolicited event for HP jack sensing */
10544 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10547 if ((res >> 26) != ALC_HP_EVENT)
10549 alc262_fujitsu_automute(codec, 1);
10552 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10554 alc262_fujitsu_automute(codec, 1);
10557 /* bind volumes of both NID 0x0c and 0x0d */
10558 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10559 .ops = &snd_hda_bind_vol,
10561 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10562 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10567 /* mute/unmute internal speaker according to the hp jack and mute state */
10568 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10570 struct alc_spec *spec = codec->spec;
10573 if (force || !spec->sense_updated) {
10574 unsigned int present_int_hp;
10575 /* need to execute and sync at first */
10576 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10577 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10578 AC_VERB_GET_PIN_SENSE, 0);
10579 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10580 spec->sense_updated = 1;
10582 if (spec->jack_present) {
10583 /* mute internal speaker */
10584 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10585 HDA_AMP_MUTE, HDA_AMP_MUTE);
10586 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10587 HDA_AMP_MUTE, HDA_AMP_MUTE);
10589 /* unmute internal speaker if necessary */
10590 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10591 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10592 HDA_AMP_MUTE, mute);
10593 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10594 HDA_AMP_MUTE, mute);
10598 /* unsolicited event for HP jack sensing */
10599 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10602 if ((res >> 26) != ALC_HP_EVENT)
10604 alc262_lenovo_3000_automute(codec, 1);
10607 /* bind hp and internal speaker mute (with plug check) */
10608 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10609 struct snd_ctl_elem_value *ucontrol)
10611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10612 long *valp = ucontrol->value.integer.value;
10615 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10617 valp ? 0 : HDA_AMP_MUTE);
10618 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10620 valp ? 0 : HDA_AMP_MUTE);
10623 alc262_fujitsu_automute(codec, 0);
10627 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10628 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10630 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10631 .name = "Master Playback Switch",
10632 .info = snd_hda_mixer_amp_switch_info,
10633 .get = snd_hda_mixer_amp_switch_get,
10634 .put = alc262_fujitsu_master_sw_put,
10635 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10637 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10638 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10642 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10643 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10644 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10648 /* bind hp and internal speaker mute (with plug check) */
10649 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10650 struct snd_ctl_elem_value *ucontrol)
10652 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10653 long *valp = ucontrol->value.integer.value;
10656 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10658 valp ? 0 : HDA_AMP_MUTE);
10661 alc262_lenovo_3000_automute(codec, 0);
10665 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10666 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10668 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10669 .name = "Master Playback Switch",
10670 .info = snd_hda_mixer_amp_switch_info,
10671 .get = snd_hda_mixer_amp_switch_get,
10672 .put = alc262_lenovo_3000_master_sw_put,
10673 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10675 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10676 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10677 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10680 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10681 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10682 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10686 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10687 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10688 ALC262_HIPPO_MASTER_SWITCH,
10689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10691 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10692 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10693 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10694 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10698 /* additional init verbs for Benq laptops */
10699 static struct hda_verb alc262_EAPD_verbs[] = {
10700 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10701 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10705 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10706 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10707 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10709 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10710 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10714 /* Samsung Q1 Ultra Vista model setup */
10715 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10716 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10717 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10719 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10720 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10721 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10725 static struct hda_verb alc262_ultra_verbs[] = {
10727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10731 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10733 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10734 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10737 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10739 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10740 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10744 /* ADC, choose mic */
10745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10746 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10747 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10749 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10751 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10752 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10754 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10758 /* mute/unmute internal speaker according to the hp jack and mute state */
10759 static void alc262_ultra_automute(struct hda_codec *codec)
10761 struct alc_spec *spec = codec->spec;
10765 /* auto-mute only when HP is used as HP */
10766 if (!spec->cur_mux[0]) {
10767 unsigned int present;
10768 /* need to execute and sync at first */
10769 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10770 present = snd_hda_codec_read(codec, 0x15, 0,
10771 AC_VERB_GET_PIN_SENSE, 0);
10772 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10773 if (spec->jack_present)
10774 mute = HDA_AMP_MUTE;
10776 /* mute/unmute internal speaker */
10777 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10778 HDA_AMP_MUTE, mute);
10779 /* mute/unmute HP */
10780 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10781 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10784 /* unsolicited event for HP jack sensing */
10785 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10788 if ((res >> 26) != ALC880_HP_EVENT)
10790 alc262_ultra_automute(codec);
10793 static struct hda_input_mux alc262_ultra_capture_source = {
10797 { "Headphone", 0x7 },
10801 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10802 struct snd_ctl_elem_value *ucontrol)
10804 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10805 struct alc_spec *spec = codec->spec;
10808 ret = alc_mux_enum_put(kcontrol, ucontrol);
10811 /* reprogram the HP pin as mic or HP according to the input source */
10812 snd_hda_codec_write_cache(codec, 0x15, 0,
10813 AC_VERB_SET_PIN_WIDGET_CONTROL,
10814 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10815 alc262_ultra_automute(codec); /* mute/unmute HP */
10819 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10820 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10821 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10824 .name = "Capture Source",
10825 .info = alc_mux_enum_info,
10826 .get = alc_mux_enum_get,
10827 .put = alc262_ultra_mux_enum_put,
10832 /* add playback controls from the parsed DAC table */
10833 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10834 const struct auto_pin_cfg *cfg)
10839 spec->multiout.num_dacs = 1; /* only use one dac */
10840 spec->multiout.dac_nids = spec->private_dac_nids;
10841 spec->multiout.dac_nids[0] = 2;
10843 nid = cfg->line_out_pins[0];
10845 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10846 "Front Playback Volume",
10847 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10850 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10851 "Front Playback Switch",
10852 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10857 nid = cfg->speaker_pins[0];
10860 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10861 "Speaker Playback Volume",
10862 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10866 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10867 "Speaker Playback Switch",
10868 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10873 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10874 "Speaker Playback Switch",
10875 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10881 nid = cfg->hp_pins[0];
10883 /* spec->multiout.hp_nid = 2; */
10885 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10886 "Headphone Playback Volume",
10887 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10891 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10892 "Headphone Playback Switch",
10893 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10898 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10899 "Headphone Playback Switch",
10900 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10909 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10910 const struct auto_pin_cfg *cfg)
10914 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10917 /* digital-mic input pin is excluded in alc880_auto_create..()
10918 * because it's under 0x18
10920 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10921 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10922 struct hda_input_mux *imux = &spec->private_imux[0];
10923 imux->items[imux->num_items].label = "Int Mic";
10924 imux->items[imux->num_items].index = 0x09;
10932 * generic initialization of ADC, input mixers and output mixers
10934 static struct hda_verb alc262_volume_init_verbs[] = {
10936 * Unmute ADC0-2 and set the default input to mic-in
10938 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10940 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10941 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10942 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10943 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10945 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10947 * Note: PASD motherboards uses the Line In 2 as the input for
10948 * front panel mic (mic 2)
10950 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10952 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10953 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10954 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10955 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10958 * Set up output mixers (0x0c - 0x0f)
10960 /* set vol=0 to output mixers */
10961 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10962 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10963 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10965 /* set up input amps for analog loopback */
10966 /* Amp Indices: DAC = 0, mixer = 1 */
10967 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10969 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10970 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10971 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10972 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10974 /* FIXME: use matrix-type input source selection */
10975 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10976 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10977 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10978 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10980 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10982 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10983 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10984 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10985 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10989 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10990 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10995 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10997 * Unmute ADC0-2 and set the default input to mic-in
10999 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11000 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11001 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11002 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11003 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11004 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11006 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11008 * Note: PASD motherboards uses the Line In 2 as the input for
11009 * front panel mic (mic 2)
11011 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11017 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11018 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11021 * Set up output mixers (0x0c - 0x0e)
11023 /* set vol=0 to output mixers */
11024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11025 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11026 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11028 /* set up input amps for analog loopback */
11029 /* Amp Indices: DAC = 0, mixer = 1 */
11030 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11031 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11032 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11033 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11034 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11035 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11037 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11039 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11041 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11044 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11049 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11051 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11054 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11055 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11056 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11057 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11058 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11061 /* FIXME: use matrix-type input source selection */
11062 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11063 /* Input mixer1: only unmute Mic */
11064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11077 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11078 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11079 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11080 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11081 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11082 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11094 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11099 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11101 * Unmute ADC0-2 and set the default input to mic-in
11103 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11104 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11105 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11106 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11107 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11108 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11110 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11112 * Note: PASD motherboards uses the Line In 2 as the input for front
11113 * panel mic (mic 2)
11115 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11123 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11125 * Set up output mixers (0x0c - 0x0e)
11127 /* set vol=0 to output mixers */
11128 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11129 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11130 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11132 /* set up input amps for analog loopback */
11133 /* Amp Indices: DAC = 0, mixer = 1 */
11134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11143 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11144 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11145 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11146 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11147 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11148 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11150 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11151 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11153 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11154 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11156 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11157 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11158 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11159 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11160 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11161 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11163 /* FIXME: use matrix-type input source selection */
11164 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11165 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11166 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11167 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11168 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11169 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11171 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11172 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11176 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11177 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11178 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11179 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11180 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11182 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11183 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11187 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11190 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11195 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11197 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11198 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11199 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11201 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11202 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11203 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11204 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11207 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11208 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11213 #ifdef CONFIG_SND_HDA_POWER_SAVE
11214 #define alc262_loopbacks alc880_loopbacks
11217 /* pcm configuration: identical with ALC880 */
11218 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11219 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11220 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11221 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11224 * BIOS auto configuration
11226 static int alc262_parse_auto_config(struct hda_codec *codec)
11228 struct alc_spec *spec = codec->spec;
11230 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11232 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11236 if (!spec->autocfg.line_outs) {
11237 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11238 spec->multiout.max_channels = 2;
11239 spec->no_analog = 1;
11242 return 0; /* can't find valid BIOS pin config */
11244 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11247 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11251 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11254 if (spec->autocfg.dig_outs) {
11255 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11256 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11258 if (spec->autocfg.dig_in_pin)
11259 spec->dig_in_nid = ALC262_DIGIN_NID;
11261 if (spec->kctls.list)
11262 add_mixer(spec, spec->kctls.list);
11264 add_verb(spec, alc262_volume_init_verbs);
11265 spec->num_mux_defs = 1;
11266 spec->input_mux = &spec->private_imux[0];
11268 err = alc_auto_add_mic_boost(codec);
11272 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11277 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11278 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11279 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11280 #define alc262_auto_init_input_src alc882_auto_init_input_src
11283 /* init callback for auto-configuration model -- overriding the default init */
11284 static void alc262_auto_init(struct hda_codec *codec)
11286 struct alc_spec *spec = codec->spec;
11287 alc262_auto_init_multi_out(codec);
11288 alc262_auto_init_hp_out(codec);
11289 alc262_auto_init_analog_input(codec);
11290 alc262_auto_init_input_src(codec);
11291 if (spec->unsol_event)
11292 alc_inithook(codec);
11296 * configuration and preset
11298 static const char *alc262_models[ALC262_MODEL_LAST] = {
11299 [ALC262_BASIC] = "basic",
11300 [ALC262_HIPPO] = "hippo",
11301 [ALC262_HIPPO_1] = "hippo_1",
11302 [ALC262_FUJITSU] = "fujitsu",
11303 [ALC262_HP_BPC] = "hp-bpc",
11304 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11305 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11306 [ALC262_HP_RP5700] = "hp-rp5700",
11307 [ALC262_BENQ_ED8] = "benq",
11308 [ALC262_BENQ_T31] = "benq-t31",
11309 [ALC262_SONY_ASSAMD] = "sony-assamd",
11310 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11311 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11312 [ALC262_ULTRA] = "ultra",
11313 [ALC262_LENOVO_3000] = "lenovo-3000",
11314 [ALC262_NEC] = "nec",
11315 [ALC262_TYAN] = "tyan",
11316 [ALC262_AUTO] = "auto",
11319 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11320 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11321 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11322 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11324 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11326 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11328 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11329 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11330 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11331 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11332 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11333 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11334 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11335 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11336 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11337 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11338 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11339 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11340 ALC262_HP_TC_T5735),
11341 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11342 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11343 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11344 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11345 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11346 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11347 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11348 ALC262_SONY_ASSAMD),
11349 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11350 ALC262_TOSHIBA_RX1),
11351 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11352 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11353 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11354 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11355 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11357 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11358 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11359 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11360 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11361 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11365 static struct alc_config_preset alc262_presets[] = {
11367 .mixers = { alc262_base_mixer },
11368 .init_verbs = { alc262_init_verbs },
11369 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11370 .dac_nids = alc262_dac_nids,
11372 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11373 .channel_mode = alc262_modes,
11374 .input_mux = &alc262_capture_source,
11377 .mixers = { alc262_hippo_mixer },
11378 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
11379 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11380 .dac_nids = alc262_dac_nids,
11382 .dig_out_nid = ALC262_DIGOUT_NID,
11383 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11384 .channel_mode = alc262_modes,
11385 .input_mux = &alc262_capture_source,
11386 .unsol_event = alc262_hippo_unsol_event,
11387 .init_hook = alc262_hippo_init_hook,
11389 [ALC262_HIPPO_1] = {
11390 .mixers = { alc262_hippo1_mixer },
11391 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11392 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11393 .dac_nids = alc262_dac_nids,
11395 .dig_out_nid = ALC262_DIGOUT_NID,
11396 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11397 .channel_mode = alc262_modes,
11398 .input_mux = &alc262_capture_source,
11399 .unsol_event = alc262_hippo_unsol_event,
11400 .init_hook = alc262_hippo1_init_hook,
11402 [ALC262_FUJITSU] = {
11403 .mixers = { alc262_fujitsu_mixer },
11404 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11405 alc262_fujitsu_unsol_verbs },
11406 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11407 .dac_nids = alc262_dac_nids,
11409 .dig_out_nid = ALC262_DIGOUT_NID,
11410 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11411 .channel_mode = alc262_modes,
11412 .input_mux = &alc262_fujitsu_capture_source,
11413 .unsol_event = alc262_fujitsu_unsol_event,
11414 .init_hook = alc262_fujitsu_init_hook,
11416 [ALC262_HP_BPC] = {
11417 .mixers = { alc262_HP_BPC_mixer },
11418 .init_verbs = { alc262_HP_BPC_init_verbs },
11419 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11420 .dac_nids = alc262_dac_nids,
11422 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11423 .channel_mode = alc262_modes,
11424 .input_mux = &alc262_HP_capture_source,
11425 .unsol_event = alc262_hp_bpc_unsol_event,
11426 .init_hook = alc262_hp_bpc_automute,
11428 [ALC262_HP_BPC_D7000_WF] = {
11429 .mixers = { alc262_HP_BPC_WildWest_mixer },
11430 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11431 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11432 .dac_nids = alc262_dac_nids,
11434 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11435 .channel_mode = alc262_modes,
11436 .input_mux = &alc262_HP_D7000_capture_source,
11437 .unsol_event = alc262_hp_wildwest_unsol_event,
11438 .init_hook = alc262_hp_wildwest_automute,
11440 [ALC262_HP_BPC_D7000_WL] = {
11441 .mixers = { alc262_HP_BPC_WildWest_mixer,
11442 alc262_HP_BPC_WildWest_option_mixer },
11443 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11444 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11445 .dac_nids = alc262_dac_nids,
11447 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11448 .channel_mode = alc262_modes,
11449 .input_mux = &alc262_HP_D7000_capture_source,
11450 .unsol_event = alc262_hp_wildwest_unsol_event,
11451 .init_hook = alc262_hp_wildwest_automute,
11453 [ALC262_HP_TC_T5735] = {
11454 .mixers = { alc262_hp_t5735_mixer },
11455 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11456 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11457 .dac_nids = alc262_dac_nids,
11459 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11460 .channel_mode = alc262_modes,
11461 .input_mux = &alc262_capture_source,
11462 .unsol_event = alc_automute_amp_unsol_event,
11463 .init_hook = alc262_hp_t5735_init_hook,
11465 [ALC262_HP_RP5700] = {
11466 .mixers = { alc262_hp_rp5700_mixer },
11467 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11468 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11469 .dac_nids = alc262_dac_nids,
11470 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11471 .channel_mode = alc262_modes,
11472 .input_mux = &alc262_hp_rp5700_capture_source,
11474 [ALC262_BENQ_ED8] = {
11475 .mixers = { alc262_base_mixer },
11476 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11477 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11478 .dac_nids = alc262_dac_nids,
11480 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11481 .channel_mode = alc262_modes,
11482 .input_mux = &alc262_capture_source,
11484 [ALC262_SONY_ASSAMD] = {
11485 .mixers = { alc262_sony_mixer },
11486 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11487 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11488 .dac_nids = alc262_dac_nids,
11490 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11491 .channel_mode = alc262_modes,
11492 .input_mux = &alc262_capture_source,
11493 .unsol_event = alc262_hippo_unsol_event,
11494 .init_hook = alc262_hippo_init_hook,
11496 [ALC262_BENQ_T31] = {
11497 .mixers = { alc262_benq_t31_mixer },
11498 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11499 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11500 .dac_nids = alc262_dac_nids,
11502 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11503 .channel_mode = alc262_modes,
11504 .input_mux = &alc262_capture_source,
11505 .unsol_event = alc262_hippo_unsol_event,
11506 .init_hook = alc262_hippo_init_hook,
11509 .mixers = { alc262_ultra_mixer },
11510 .cap_mixer = alc262_ultra_capture_mixer,
11511 .init_verbs = { alc262_ultra_verbs },
11512 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11513 .dac_nids = alc262_dac_nids,
11514 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11515 .channel_mode = alc262_modes,
11516 .input_mux = &alc262_ultra_capture_source,
11517 .adc_nids = alc262_adc_nids, /* ADC0 */
11518 .capsrc_nids = alc262_capsrc_nids,
11519 .num_adc_nids = 1, /* single ADC */
11520 .unsol_event = alc262_ultra_unsol_event,
11521 .init_hook = alc262_ultra_automute,
11523 [ALC262_LENOVO_3000] = {
11524 .mixers = { alc262_lenovo_3000_mixer },
11525 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11526 alc262_lenovo_3000_unsol_verbs },
11527 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11528 .dac_nids = alc262_dac_nids,
11530 .dig_out_nid = ALC262_DIGOUT_NID,
11531 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11532 .channel_mode = alc262_modes,
11533 .input_mux = &alc262_fujitsu_capture_source,
11534 .unsol_event = alc262_lenovo_3000_unsol_event,
11537 .mixers = { alc262_nec_mixer },
11538 .init_verbs = { alc262_nec_verbs },
11539 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11540 .dac_nids = alc262_dac_nids,
11542 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11543 .channel_mode = alc262_modes,
11544 .input_mux = &alc262_capture_source,
11546 [ALC262_TOSHIBA_S06] = {
11547 .mixers = { alc262_toshiba_s06_mixer },
11548 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11549 alc262_eapd_verbs },
11550 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11551 .capsrc_nids = alc262_dmic_capsrc_nids,
11552 .dac_nids = alc262_dac_nids,
11553 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11554 .num_adc_nids = 1, /* single ADC */
11555 .dig_out_nid = ALC262_DIGOUT_NID,
11556 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11557 .channel_mode = alc262_modes,
11558 .input_mux = &alc262_dmic_capture_source,
11559 .unsol_event = alc262_toshiba_s06_unsol_event,
11560 .init_hook = alc262_toshiba_s06_init_hook,
11562 [ALC262_TOSHIBA_RX1] = {
11563 .mixers = { alc262_toshiba_rx1_mixer },
11564 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11565 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11566 .dac_nids = alc262_dac_nids,
11568 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11569 .channel_mode = alc262_modes,
11570 .input_mux = &alc262_capture_source,
11571 .unsol_event = alc262_hippo_unsol_event,
11572 .init_hook = alc262_hippo_init_hook,
11575 .mixers = { alc262_tyan_mixer },
11576 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11577 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11578 .dac_nids = alc262_dac_nids,
11580 .dig_out_nid = ALC262_DIGOUT_NID,
11581 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11582 .channel_mode = alc262_modes,
11583 .input_mux = &alc262_capture_source,
11584 .unsol_event = alc_automute_amp_unsol_event,
11585 .init_hook = alc262_tyan_init_hook,
11589 static int patch_alc262(struct hda_codec *codec)
11591 struct alc_spec *spec;
11595 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11599 codec->spec = spec;
11601 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11606 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11607 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11608 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11609 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11613 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11615 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11619 if (board_config < 0) {
11620 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11621 "trying auto-probe from BIOS...\n", codec->chip_name);
11622 board_config = ALC262_AUTO;
11625 if (board_config == ALC262_AUTO) {
11626 /* automatic parse from the BIOS config */
11627 err = alc262_parse_auto_config(codec);
11633 "hda_codec: Cannot set up configuration "
11634 "from BIOS. Using base mode...\n");
11635 board_config = ALC262_BASIC;
11639 if (!spec->no_analog) {
11640 err = snd_hda_attach_beep_device(codec, 0x1);
11647 if (board_config != ALC262_AUTO)
11648 setup_preset(spec, &alc262_presets[board_config]);
11650 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11651 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11653 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11654 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11656 if (!spec->adc_nids && spec->input_mux) {
11658 /* check whether the digital-mic has to be supported */
11659 for (i = 0; i < spec->input_mux->num_items; i++) {
11660 if (spec->input_mux->items[i].index >= 9)
11663 if (i < spec->input_mux->num_items) {
11664 /* use only ADC0 */
11665 spec->adc_nids = alc262_dmic_adc_nids;
11666 spec->num_adc_nids = 1;
11667 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11669 /* all analog inputs */
11670 /* check whether NID 0x07 is valid */
11671 unsigned int wcap = get_wcaps(codec, 0x07);
11674 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11675 if (wcap != AC_WID_AUD_IN) {
11676 spec->adc_nids = alc262_adc_nids_alt;
11677 spec->num_adc_nids =
11678 ARRAY_SIZE(alc262_adc_nids_alt);
11679 spec->capsrc_nids = alc262_capsrc_nids_alt;
11681 spec->adc_nids = alc262_adc_nids;
11682 spec->num_adc_nids =
11683 ARRAY_SIZE(alc262_adc_nids);
11684 spec->capsrc_nids = alc262_capsrc_nids;
11688 if (!spec->cap_mixer && !spec->no_analog)
11689 set_capture_mixer(spec);
11690 if (!spec->no_analog)
11691 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11693 spec->vmaster_nid = 0x0c;
11695 codec->patch_ops = alc_patch_ops;
11696 if (board_config == ALC262_AUTO)
11697 spec->init_hook = alc262_auto_init;
11698 #ifdef CONFIG_SND_HDA_POWER_SAVE
11699 if (!spec->loopback.amplist)
11700 spec->loopback.amplist = alc262_loopbacks;
11702 codec->proc_widget_hook = print_realtek_coef;
11708 * ALC268 channel source setting (2 channel)
11710 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11711 #define alc268_modes alc260_modes
11713 static hda_nid_t alc268_dac_nids[2] = {
11718 static hda_nid_t alc268_adc_nids[2] = {
11723 static hda_nid_t alc268_adc_nids_alt[1] = {
11728 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11730 static struct snd_kcontrol_new alc268_base_mixer[] = {
11731 /* output mixer control */
11732 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11733 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11734 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11736 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11737 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11738 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11742 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11743 /* output mixer control */
11744 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11745 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11746 ALC262_HIPPO_MASTER_SWITCH,
11747 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11748 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11749 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11753 /* bind Beep switches of both NID 0x0f and 0x10 */
11754 static struct hda_bind_ctls alc268_bind_beep_sw = {
11755 .ops = &snd_hda_bind_sw,
11757 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11758 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11763 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11764 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11765 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11769 static struct hda_verb alc268_eapd_verbs[] = {
11770 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11771 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11775 /* Toshiba specific */
11776 static struct hda_verb alc268_toshiba_verbs[] = {
11777 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11781 static struct hda_input_mux alc268_acer_lc_capture_source = {
11789 /* Acer specific */
11790 /* bind volumes of both NID 0x02 and 0x03 */
11791 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11792 .ops = &snd_hda_bind_vol,
11794 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11795 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11800 /* mute/unmute internal speaker according to the hp jack and mute state */
11801 static void alc268_acer_automute(struct hda_codec *codec, int force)
11803 struct alc_spec *spec = codec->spec;
11806 if (force || !spec->sense_updated) {
11807 unsigned int present;
11808 present = snd_hda_codec_read(codec, 0x14, 0,
11809 AC_VERB_GET_PIN_SENSE, 0);
11810 spec->jack_present = (present & 0x80000000) != 0;
11811 spec->sense_updated = 1;
11813 if (spec->jack_present)
11814 mute = HDA_AMP_MUTE; /* mute internal speaker */
11815 else /* unmute internal speaker if necessary */
11816 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11817 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11818 HDA_AMP_MUTE, mute);
11822 /* bind hp and internal speaker mute (with plug check) */
11823 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11824 struct snd_ctl_elem_value *ucontrol)
11826 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11827 long *valp = ucontrol->value.integer.value;
11830 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11832 valp[0] ? 0 : HDA_AMP_MUTE);
11833 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11835 valp[1] ? 0 : HDA_AMP_MUTE);
11837 alc268_acer_automute(codec, 0);
11841 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11842 /* output mixer control */
11843 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11845 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11846 .name = "Master Playback Switch",
11847 .info = snd_hda_mixer_amp_switch_info,
11848 .get = snd_hda_mixer_amp_switch_get,
11849 .put = alc268_acer_master_sw_put,
11850 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11852 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11856 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11857 /* output mixer control */
11858 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11860 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11861 .name = "Master Playback Switch",
11862 .info = snd_hda_mixer_amp_switch_info,
11863 .get = snd_hda_mixer_amp_switch_get,
11864 .put = alc268_acer_master_sw_put,
11865 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11868 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11869 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11873 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11874 /* output mixer control */
11875 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11877 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11878 .name = "Master Playback Switch",
11879 .info = snd_hda_mixer_amp_switch_info,
11880 .get = snd_hda_mixer_amp_switch_get,
11881 .put = alc268_acer_master_sw_put,
11882 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11885 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11889 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11890 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11891 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11892 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11894 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11895 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11899 static struct hda_verb alc268_acer_verbs[] = {
11900 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11901 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11902 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11903 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11904 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11905 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11906 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11910 /* unsolicited event for HP jack sensing */
11911 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11912 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11914 static void alc268_acer_unsol_event(struct hda_codec *codec,
11917 if ((res >> 26) != ALC880_HP_EVENT)
11919 alc268_acer_automute(codec, 1);
11922 static void alc268_acer_init_hook(struct hda_codec *codec)
11924 alc268_acer_automute(codec, 1);
11927 /* toggle speaker-output according to the hp-jack state */
11928 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11930 unsigned int present;
11931 unsigned char bits;
11933 present = snd_hda_codec_read(codec, 0x15, 0,
11934 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11935 bits = present ? AMP_IN_MUTE(0) : 0;
11936 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11937 AMP_IN_MUTE(0), bits);
11938 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11939 AMP_IN_MUTE(0), bits);
11943 static void alc268_acer_mic_automute(struct hda_codec *codec)
11945 unsigned int present;
11947 present = snd_hda_codec_read(codec, 0x18, 0,
11948 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11949 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11950 present ? 0x0 : 0x6);
11953 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11956 if ((res >> 26) == ALC880_HP_EVENT)
11957 alc268_aspire_one_speaker_automute(codec);
11958 if ((res >> 26) == ALC880_MIC_EVENT)
11959 alc268_acer_mic_automute(codec);
11962 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11964 alc268_aspire_one_speaker_automute(codec);
11965 alc268_acer_mic_automute(codec);
11968 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11969 /* output mixer control */
11970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11971 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11974 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11975 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11979 static struct hda_verb alc268_dell_verbs[] = {
11980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11982 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11986 /* mute/unmute internal speaker according to the hp jack and mute state */
11987 static void alc268_dell_init_hook(struct hda_codec *codec)
11989 struct alc_spec *spec = codec->spec;
11991 spec->autocfg.hp_pins[0] = 0x15;
11992 spec->autocfg.speaker_pins[0] = 0x14;
11993 alc_automute_pin(codec);
11996 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11997 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11998 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11999 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12001 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12002 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12003 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12004 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12008 static struct hda_verb alc267_quanta_il1_verbs[] = {
12009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12010 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12014 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
12016 unsigned int present;
12018 present = snd_hda_codec_read(codec, 0x18, 0,
12019 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12020 snd_hda_codec_write(codec, 0x23, 0,
12021 AC_VERB_SET_CONNECT_SEL,
12022 present ? 0x00 : 0x01);
12025 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
12027 struct alc_spec *spec = codec->spec;
12029 spec->autocfg.hp_pins[0] = 0x15;
12030 spec->autocfg.speaker_pins[0] = 0x14;
12031 alc_automute_pin(codec);
12032 alc267_quanta_il1_mic_automute(codec);
12035 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
12038 switch (res >> 26) {
12039 case ALC880_MIC_EVENT:
12040 alc267_quanta_il1_mic_automute(codec);
12043 alc_sku_unsol_event(codec, res);
12049 * generic initialization of ADC, input mixers and output mixers
12051 static struct hda_verb alc268_base_init_verbs[] = {
12052 /* Unmute DAC0-1 and set vol = 0 */
12053 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12054 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12057 * Set up output mixers (0x0c - 0x0e)
12059 /* set vol=0 to output mixers */
12060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12061 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12063 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12064 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12066 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12067 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12068 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12072 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12073 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12075 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12077 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12081 /* set PCBEEP vol = 0, mute connections */
12082 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12084 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12086 /* Unmute Selector 23h,24h and set the default input to mic-in */
12088 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12089 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12090 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12091 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12097 * generic initialization of ADC, input mixers and output mixers
12099 static struct hda_verb alc268_volume_init_verbs[] = {
12100 /* set output DAC */
12101 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12102 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12105 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12106 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12107 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12108 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12111 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12112 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12114 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12115 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12117 /* set PCBEEP vol = 0, mute connections */
12118 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12119 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12120 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12125 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12126 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12127 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12129 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12130 /* The multiple "Capture Source" controls confuse alsamixer
12131 * So call somewhat different..
12133 /* .name = "Capture Source", */
12134 .name = "Input Source",
12136 .info = alc_mux_enum_info,
12137 .get = alc_mux_enum_get,
12138 .put = alc_mux_enum_put,
12143 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12144 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12145 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12146 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12147 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12150 /* The multiple "Capture Source" controls confuse alsamixer
12151 * So call somewhat different..
12153 /* .name = "Capture Source", */
12154 .name = "Input Source",
12156 .info = alc_mux_enum_info,
12157 .get = alc_mux_enum_get,
12158 .put = alc_mux_enum_put,
12163 static struct hda_input_mux alc268_capture_source = {
12167 { "Front Mic", 0x1 },
12173 static struct hda_input_mux alc268_acer_capture_source = {
12177 { "Internal Mic", 0x1 },
12182 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12186 { "Internal Mic", 0x6 },
12191 #ifdef CONFIG_SND_DEBUG
12192 static struct snd_kcontrol_new alc268_test_mixer[] = {
12193 /* Volume widgets */
12194 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12195 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12196 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12197 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12198 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12199 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12200 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12201 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12202 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12203 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12204 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12205 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12206 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12207 /* The below appears problematic on some hardwares */
12208 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12209 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12210 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12211 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12212 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12214 /* Modes for retasking pin widgets */
12215 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12216 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12217 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12218 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12220 /* Controls for GPIO pins, assuming they are configured as outputs */
12221 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12222 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12223 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12224 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12226 /* Switches to allow the digital SPDIF output pin to be enabled.
12227 * The ALC268 does not have an SPDIF input.
12229 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12231 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12232 * this output to turn on an external amplifier.
12234 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12235 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12241 /* create input playback/capture controls for the given pin */
12242 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12243 const char *ctlname, int idx)
12248 sprintf(name, "%s Playback Volume", ctlname);
12250 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12251 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
12255 } else if (nid == 0x15) {
12256 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12257 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
12263 sprintf(name, "%s Playback Switch", ctlname);
12264 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12265 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12271 /* add playback controls from the parsed DAC table */
12272 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12273 const struct auto_pin_cfg *cfg)
12278 spec->multiout.num_dacs = 2; /* only use one dac */
12279 spec->multiout.dac_nids = spec->private_dac_nids;
12280 spec->multiout.dac_nids[0] = 2;
12281 spec->multiout.dac_nids[1] = 3;
12283 nid = cfg->line_out_pins[0];
12285 alc268_new_analog_output(spec, nid, "Front", 0);
12287 nid = cfg->speaker_pins[0];
12289 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12290 "Speaker Playback Volume",
12291 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12295 nid = cfg->hp_pins[0];
12297 alc268_new_analog_output(spec, nid, "Headphone", 0);
12299 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12301 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12302 "Mono Playback Switch",
12303 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
12310 /* create playback/capture controls for input pins */
12311 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12312 const struct auto_pin_cfg *cfg)
12314 struct hda_input_mux *imux = &spec->private_imux[0];
12317 for (i = 0; i < AUTO_PIN_LAST; i++) {
12318 switch(cfg->input_pins[i]) {
12320 idx1 = 0; /* Mic 1 */
12323 idx1 = 1; /* Mic 2 */
12326 idx1 = 2; /* Line In */
12333 idx1 = 6; /* digital mics */
12338 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12339 imux->items[imux->num_items].index = idx1;
12345 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12347 struct alc_spec *spec = codec->spec;
12348 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12349 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12350 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12351 unsigned int dac_vol1, dac_vol2;
12354 snd_hda_codec_write(codec, speaker_nid, 0,
12355 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12356 snd_hda_codec_write(codec, 0x0f, 0,
12357 AC_VERB_SET_AMP_GAIN_MUTE,
12359 snd_hda_codec_write(codec, 0x10, 0,
12360 AC_VERB_SET_AMP_GAIN_MUTE,
12363 snd_hda_codec_write(codec, 0x0f, 0,
12364 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12365 snd_hda_codec_write(codec, 0x10, 0,
12366 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12369 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12370 if (line_nid == 0x14)
12371 dac_vol2 = AMP_OUT_ZERO;
12372 else if (line_nid == 0x15)
12373 dac_vol1 = AMP_OUT_ZERO;
12374 if (hp_nid == 0x14)
12375 dac_vol2 = AMP_OUT_ZERO;
12376 else if (hp_nid == 0x15)
12377 dac_vol1 = AMP_OUT_ZERO;
12378 if (line_nid != 0x16 || hp_nid != 0x16 ||
12379 spec->autocfg.line_out_pins[1] != 0x16 ||
12380 spec->autocfg.line_out_pins[2] != 0x16)
12381 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12383 snd_hda_codec_write(codec, 0x02, 0,
12384 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12385 snd_hda_codec_write(codec, 0x03, 0,
12386 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12389 /* pcm configuration: identical with ALC880 */
12390 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12391 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12392 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12393 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12396 * BIOS auto configuration
12398 static int alc268_parse_auto_config(struct hda_codec *codec)
12400 struct alc_spec *spec = codec->spec;
12402 static hda_nid_t alc268_ignore[] = { 0 };
12404 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12408 if (!spec->autocfg.line_outs) {
12409 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12410 spec->multiout.max_channels = 2;
12411 spec->no_analog = 1;
12414 return 0; /* can't find valid BIOS pin config */
12416 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12419 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12423 spec->multiout.max_channels = 2;
12426 /* digital only support output */
12427 if (spec->autocfg.dig_outs) {
12428 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12429 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12431 if (spec->kctls.list)
12432 add_mixer(spec, spec->kctls.list);
12434 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12435 add_mixer(spec, alc268_beep_mixer);
12437 add_verb(spec, alc268_volume_init_verbs);
12438 spec->num_mux_defs = 1;
12439 spec->input_mux = &spec->private_imux[0];
12441 err = alc_auto_add_mic_boost(codec);
12448 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12449 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12450 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12452 /* init callback for auto-configuration model -- overriding the default init */
12453 static void alc268_auto_init(struct hda_codec *codec)
12455 struct alc_spec *spec = codec->spec;
12456 alc268_auto_init_multi_out(codec);
12457 alc268_auto_init_hp_out(codec);
12458 alc268_auto_init_mono_speaker_out(codec);
12459 alc268_auto_init_analog_input(codec);
12460 if (spec->unsol_event)
12461 alc_inithook(codec);
12465 * configuration and preset
12467 static const char *alc268_models[ALC268_MODEL_LAST] = {
12468 [ALC267_QUANTA_IL1] = "quanta-il1",
12469 [ALC268_3ST] = "3stack",
12470 [ALC268_TOSHIBA] = "toshiba",
12471 [ALC268_ACER] = "acer",
12472 [ALC268_ACER_DMIC] = "acer-dmic",
12473 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12474 [ALC268_DELL] = "dell",
12475 [ALC268_ZEPTO] = "zepto",
12476 #ifdef CONFIG_SND_DEBUG
12477 [ALC268_TEST] = "test",
12479 [ALC268_AUTO] = "auto",
12482 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12483 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12484 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12485 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12486 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12487 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12488 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12489 ALC268_ACER_ASPIRE_ONE),
12490 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12491 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12492 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12494 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12495 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12496 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12498 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12499 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12500 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12501 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12505 static struct alc_config_preset alc268_presets[] = {
12506 [ALC267_QUANTA_IL1] = {
12507 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12508 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12509 alc267_quanta_il1_verbs },
12510 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12511 .dac_nids = alc268_dac_nids,
12512 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12513 .adc_nids = alc268_adc_nids_alt,
12515 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12516 .channel_mode = alc268_modes,
12517 .input_mux = &alc268_capture_source,
12518 .unsol_event = alc267_quanta_il1_unsol_event,
12519 .init_hook = alc267_quanta_il1_init_hook,
12522 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12523 alc268_beep_mixer },
12524 .init_verbs = { alc268_base_init_verbs },
12525 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12526 .dac_nids = alc268_dac_nids,
12527 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12528 .adc_nids = alc268_adc_nids_alt,
12529 .capsrc_nids = alc268_capsrc_nids,
12531 .dig_out_nid = ALC268_DIGOUT_NID,
12532 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12533 .channel_mode = alc268_modes,
12534 .input_mux = &alc268_capture_source,
12536 [ALC268_TOSHIBA] = {
12537 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12538 alc268_beep_mixer },
12539 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12540 alc268_toshiba_verbs },
12541 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12542 .dac_nids = alc268_dac_nids,
12543 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12544 .adc_nids = alc268_adc_nids_alt,
12545 .capsrc_nids = alc268_capsrc_nids,
12547 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12548 .channel_mode = alc268_modes,
12549 .input_mux = &alc268_capture_source,
12550 .unsol_event = alc268_toshiba_unsol_event,
12551 .init_hook = alc268_toshiba_init_hook,
12554 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12555 alc268_beep_mixer },
12556 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12557 alc268_acer_verbs },
12558 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12559 .dac_nids = alc268_dac_nids,
12560 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12561 .adc_nids = alc268_adc_nids_alt,
12562 .capsrc_nids = alc268_capsrc_nids,
12564 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12565 .channel_mode = alc268_modes,
12566 .input_mux = &alc268_acer_capture_source,
12567 .unsol_event = alc268_acer_unsol_event,
12568 .init_hook = alc268_acer_init_hook,
12570 [ALC268_ACER_DMIC] = {
12571 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12572 alc268_beep_mixer },
12573 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12574 alc268_acer_verbs },
12575 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12576 .dac_nids = alc268_dac_nids,
12577 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12578 .adc_nids = alc268_adc_nids_alt,
12579 .capsrc_nids = alc268_capsrc_nids,
12581 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12582 .channel_mode = alc268_modes,
12583 .input_mux = &alc268_acer_dmic_capture_source,
12584 .unsol_event = alc268_acer_unsol_event,
12585 .init_hook = alc268_acer_init_hook,
12587 [ALC268_ACER_ASPIRE_ONE] = {
12588 .mixers = { alc268_acer_aspire_one_mixer,
12590 alc268_capture_alt_mixer },
12591 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12592 alc268_acer_aspire_one_verbs },
12593 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12594 .dac_nids = alc268_dac_nids,
12595 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12596 .adc_nids = alc268_adc_nids_alt,
12597 .capsrc_nids = alc268_capsrc_nids,
12599 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12600 .channel_mode = alc268_modes,
12601 .input_mux = &alc268_acer_lc_capture_source,
12602 .unsol_event = alc268_acer_lc_unsol_event,
12603 .init_hook = alc268_acer_lc_init_hook,
12606 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12607 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12608 alc268_dell_verbs },
12609 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12610 .dac_nids = alc268_dac_nids,
12612 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12613 .channel_mode = alc268_modes,
12614 .unsol_event = alc_sku_unsol_event,
12615 .init_hook = alc268_dell_init_hook,
12616 .input_mux = &alc268_capture_source,
12619 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12620 alc268_beep_mixer },
12621 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12622 alc268_toshiba_verbs },
12623 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12624 .dac_nids = alc268_dac_nids,
12625 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12626 .adc_nids = alc268_adc_nids_alt,
12627 .capsrc_nids = alc268_capsrc_nids,
12629 .dig_out_nid = ALC268_DIGOUT_NID,
12630 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12631 .channel_mode = alc268_modes,
12632 .input_mux = &alc268_capture_source,
12633 .unsol_event = alc268_toshiba_unsol_event,
12634 .init_hook = alc268_toshiba_init_hook
12636 #ifdef CONFIG_SND_DEBUG
12638 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12639 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12640 alc268_volume_init_verbs },
12641 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12642 .dac_nids = alc268_dac_nids,
12643 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12644 .adc_nids = alc268_adc_nids_alt,
12645 .capsrc_nids = alc268_capsrc_nids,
12647 .dig_out_nid = ALC268_DIGOUT_NID,
12648 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12649 .channel_mode = alc268_modes,
12650 .input_mux = &alc268_capture_source,
12655 static int patch_alc268(struct hda_codec *codec)
12657 struct alc_spec *spec;
12659 int i, has_beep, err;
12661 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12665 codec->spec = spec;
12667 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12671 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12672 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12673 "trying auto-probe from BIOS...\n", codec->chip_name);
12674 board_config = ALC268_AUTO;
12677 if (board_config == ALC268_AUTO) {
12678 /* automatic parse from the BIOS config */
12679 err = alc268_parse_auto_config(codec);
12685 "hda_codec: Cannot set up configuration "
12686 "from BIOS. Using base mode...\n");
12687 board_config = ALC268_3ST;
12691 if (board_config != ALC268_AUTO)
12692 setup_preset(spec, &alc268_presets[board_config]);
12694 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12695 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12696 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12698 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12701 for (i = 0; i < spec->num_mixers; i++) {
12702 if (spec->mixers[i] == alc268_beep_mixer) {
12709 err = snd_hda_attach_beep_device(codec, 0x1);
12714 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12715 /* override the amp caps for beep generator */
12716 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12717 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12718 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12719 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12720 (0 << AC_AMPCAP_MUTE_SHIFT));
12723 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12724 /* check whether NID 0x07 is valid */
12725 unsigned int wcap = get_wcaps(codec, 0x07);
12729 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12730 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12731 spec->adc_nids = alc268_adc_nids_alt;
12732 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12733 add_mixer(spec, alc268_capture_alt_mixer);
12735 spec->adc_nids = alc268_adc_nids;
12736 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12737 add_mixer(spec, alc268_capture_mixer);
12739 spec->capsrc_nids = alc268_capsrc_nids;
12740 /* set default input source */
12741 for (i = 0; i < spec->num_adc_nids; i++)
12742 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12743 0, AC_VERB_SET_CONNECT_SEL,
12744 spec->input_mux->items[0].index);
12747 spec->vmaster_nid = 0x02;
12749 codec->patch_ops = alc_patch_ops;
12750 if (board_config == ALC268_AUTO)
12751 spec->init_hook = alc268_auto_init;
12753 codec->proc_widget_hook = print_realtek_coef;
12759 * ALC269 channel source setting (2 channel)
12761 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12763 #define alc269_dac_nids alc260_dac_nids
12765 static hda_nid_t alc269_adc_nids[1] = {
12770 static hda_nid_t alc269_capsrc_nids[1] = {
12774 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12778 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12786 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12794 #define alc269_modes alc260_modes
12795 #define alc269_capture_source alc880_lg_lw_capture_source
12797 static struct snd_kcontrol_new alc269_base_mixer[] = {
12798 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12799 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12800 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12801 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12804 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12805 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12806 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12807 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12808 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12809 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12813 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12814 /* output mixer control */
12815 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12817 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12818 .name = "Master Playback Switch",
12819 .info = snd_hda_mixer_amp_switch_info,
12820 .get = snd_hda_mixer_amp_switch_get,
12821 .put = alc268_acer_master_sw_put,
12822 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12826 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12827 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12828 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12829 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12833 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12834 /* output mixer control */
12835 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12837 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12838 .name = "Master Playback Switch",
12839 .info = snd_hda_mixer_amp_switch_info,
12840 .get = snd_hda_mixer_amp_switch_get,
12841 .put = alc268_acer_master_sw_put,
12842 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12844 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12846 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12847 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12848 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12849 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12850 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12851 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12852 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12856 /* bind volumes of both NID 0x0c and 0x0d */
12857 static struct hda_bind_ctls alc269_epc_bind_vol = {
12858 .ops = &snd_hda_bind_vol,
12860 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12861 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12866 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12867 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12868 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12869 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12873 /* capture mixer elements */
12874 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12875 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12876 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12877 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12882 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12883 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12884 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12885 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12889 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12890 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12891 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12893 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12894 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12895 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12899 static struct hda_verb alc269_lifebook_verbs[] = {
12900 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12901 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12902 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12903 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12904 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12905 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12906 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12907 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12908 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12909 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12913 /* toggle speaker-output according to the hp-jack state */
12914 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12916 unsigned int present;
12917 unsigned char bits;
12919 present = snd_hda_codec_read(codec, 0x15, 0,
12920 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12921 bits = present ? AMP_IN_MUTE(0) : 0;
12922 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12923 AMP_IN_MUTE(0), bits);
12924 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12925 AMP_IN_MUTE(0), bits);
12927 snd_hda_codec_write(codec, 0x20, 0,
12928 AC_VERB_SET_COEF_INDEX, 0x0c);
12929 snd_hda_codec_write(codec, 0x20, 0,
12930 AC_VERB_SET_PROC_COEF, 0x680);
12932 snd_hda_codec_write(codec, 0x20, 0,
12933 AC_VERB_SET_COEF_INDEX, 0x0c);
12934 snd_hda_codec_write(codec, 0x20, 0,
12935 AC_VERB_SET_PROC_COEF, 0x480);
12938 /* toggle speaker-output according to the hp-jacks state */
12939 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12941 unsigned int present;
12942 unsigned char bits;
12944 /* Check laptop headphone socket */
12945 present = snd_hda_codec_read(codec, 0x15, 0,
12946 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12948 /* Check port replicator headphone socket */
12949 present |= snd_hda_codec_read(codec, 0x1a, 0,
12950 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12952 bits = present ? AMP_IN_MUTE(0) : 0;
12953 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12954 AMP_IN_MUTE(0), bits);
12955 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12956 AMP_IN_MUTE(0), bits);
12958 snd_hda_codec_write(codec, 0x20, 0,
12959 AC_VERB_SET_COEF_INDEX, 0x0c);
12960 snd_hda_codec_write(codec, 0x20, 0,
12961 AC_VERB_SET_PROC_COEF, 0x680);
12963 snd_hda_codec_write(codec, 0x20, 0,
12964 AC_VERB_SET_COEF_INDEX, 0x0c);
12965 snd_hda_codec_write(codec, 0x20, 0,
12966 AC_VERB_SET_PROC_COEF, 0x480);
12969 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12971 unsigned int present;
12973 present = snd_hda_codec_read(codec, 0x18, 0,
12974 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12975 snd_hda_codec_write(codec, 0x23, 0,
12976 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12979 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12981 unsigned int present_laptop;
12982 unsigned int present_dock;
12984 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12985 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12987 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12988 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12990 /* Laptop mic port overrides dock mic port, design decision */
12992 snd_hda_codec_write(codec, 0x23, 0,
12993 AC_VERB_SET_CONNECT_SEL, 0x3);
12994 if (present_laptop)
12995 snd_hda_codec_write(codec, 0x23, 0,
12996 AC_VERB_SET_CONNECT_SEL, 0x0);
12997 if (!present_dock && !present_laptop)
12998 snd_hda_codec_write(codec, 0x23, 0,
12999 AC_VERB_SET_CONNECT_SEL, 0x1);
13002 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13005 if ((res >> 26) == ALC880_HP_EVENT)
13006 alc269_quanta_fl1_speaker_automute(codec);
13007 if ((res >> 26) == ALC880_MIC_EVENT)
13008 alc269_quanta_fl1_mic_automute(codec);
13011 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13014 if ((res >> 26) == ALC880_HP_EVENT)
13015 alc269_lifebook_speaker_automute(codec);
13016 if ((res >> 26) == ALC880_MIC_EVENT)
13017 alc269_lifebook_mic_autoswitch(codec);
13020 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13022 alc269_quanta_fl1_speaker_automute(codec);
13023 alc269_quanta_fl1_mic_automute(codec);
13026 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13028 alc269_lifebook_speaker_automute(codec);
13029 alc269_lifebook_mic_autoswitch(codec);
13032 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13033 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13034 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13035 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13036 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13037 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13038 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13039 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13043 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13044 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13045 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13046 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13047 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13048 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13049 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13053 /* toggle speaker-output according to the hp-jack state */
13054 static void alc269_speaker_automute(struct hda_codec *codec)
13056 unsigned int present;
13057 unsigned char bits;
13059 present = snd_hda_codec_read(codec, 0x15, 0,
13060 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13061 bits = present ? AMP_IN_MUTE(0) : 0;
13062 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13063 AMP_IN_MUTE(0), bits);
13064 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13065 AMP_IN_MUTE(0), bits);
13068 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
13070 unsigned int present;
13072 present = snd_hda_codec_read(codec, 0x18, 0,
13073 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13074 snd_hda_codec_write(codec, 0x23, 0,
13075 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
13078 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
13080 unsigned int present;
13082 present = snd_hda_codec_read(codec, 0x18, 0,
13083 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13084 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13085 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13086 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13087 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13090 /* unsolicited event for HP jack sensing */
13091 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
13094 if ((res >> 26) == ALC880_HP_EVENT)
13095 alc269_speaker_automute(codec);
13097 if ((res >> 26) == ALC880_MIC_EVENT)
13098 alc269_eeepc_dmic_automute(codec);
13101 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
13103 alc269_speaker_automute(codec);
13104 alc269_eeepc_dmic_automute(codec);
13107 /* unsolicited event for HP jack sensing */
13108 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
13111 if ((res >> 26) == ALC880_HP_EVENT)
13112 alc269_speaker_automute(codec);
13114 if ((res >> 26) == ALC880_MIC_EVENT)
13115 alc269_eeepc_amic_automute(codec);
13118 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
13120 alc269_speaker_automute(codec);
13121 alc269_eeepc_amic_automute(codec);
13125 * generic initialization of ADC, input mixers and output mixers
13127 static struct hda_verb alc269_init_verbs[] = {
13129 * Unmute ADC0 and set the default input to mic-in
13131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13133 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13134 * analog-loopback mixer widget
13135 * Note: PASD motherboards uses the Line In 2 as the input for
13136 * front panel mic (mic 2)
13138 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13139 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13140 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13141 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13142 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13143 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13146 * Set up output mixers (0x0c - 0x0e)
13148 /* set vol=0 to output mixers */
13149 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13150 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13152 /* set up input amps for analog loopback */
13153 /* Amp Indices: DAC = 0, mixer = 1 */
13154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13156 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13157 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13158 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13159 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13162 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13163 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13164 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13166 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13167 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13169 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13170 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13171 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13172 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13173 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13174 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13175 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13177 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13178 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13180 /* FIXME: use matrix-type input source selection */
13181 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13182 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13186 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13189 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13190 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13194 /* add playback controls from the parsed DAC table */
13195 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13196 const struct auto_pin_cfg *cfg)
13201 spec->multiout.num_dacs = 1; /* only use one dac */
13202 spec->multiout.dac_nids = spec->private_dac_nids;
13203 spec->multiout.dac_nids[0] = 2;
13205 nid = cfg->line_out_pins[0];
13207 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13208 "Front Playback Volume",
13209 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13212 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13213 "Front Playback Switch",
13214 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13219 nid = cfg->speaker_pins[0];
13221 if (!cfg->line_out_pins[0]) {
13222 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13223 "Speaker Playback Volume",
13224 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13230 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13231 "Speaker Playback Switch",
13232 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13237 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13238 "Speaker Playback Switch",
13239 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13245 nid = cfg->hp_pins[0];
13247 /* spec->multiout.hp_nid = 2; */
13248 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13249 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13250 "Headphone Playback Volume",
13251 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13257 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13258 "Headphone Playback Switch",
13259 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13264 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13265 "Headphone Playback Switch",
13266 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13275 #define alc269_auto_create_analog_input_ctls \
13276 alc262_auto_create_analog_input_ctls
13278 #ifdef CONFIG_SND_HDA_POWER_SAVE
13279 #define alc269_loopbacks alc880_loopbacks
13282 /* pcm configuration: identical with ALC880 */
13283 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13284 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13285 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13286 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13288 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13292 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13293 /* NID is set in alc_build_pcms */
13295 .open = alc880_playback_pcm_open,
13296 .prepare = alc880_playback_pcm_prepare,
13297 .cleanup = alc880_playback_pcm_cleanup
13301 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13305 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13306 /* NID is set in alc_build_pcms */
13310 * BIOS auto configuration
13312 static int alc269_parse_auto_config(struct hda_codec *codec)
13314 struct alc_spec *spec = codec->spec;
13316 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13318 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13323 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13326 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13330 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13332 if (spec->autocfg.dig_outs)
13333 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13335 if (spec->kctls.list)
13336 add_mixer(spec, spec->kctls.list);
13338 add_verb(spec, alc269_init_verbs);
13339 spec->num_mux_defs = 1;
13340 spec->input_mux = &spec->private_imux[0];
13341 /* set default input source */
13342 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13343 0, AC_VERB_SET_CONNECT_SEL,
13344 spec->input_mux->items[0].index);
13346 err = alc_auto_add_mic_boost(codec);
13350 if (!spec->cap_mixer && !spec->no_analog)
13351 set_capture_mixer(spec);
13356 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13357 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13358 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13361 /* init callback for auto-configuration model -- overriding the default init */
13362 static void alc269_auto_init(struct hda_codec *codec)
13364 struct alc_spec *spec = codec->spec;
13365 alc269_auto_init_multi_out(codec);
13366 alc269_auto_init_hp_out(codec);
13367 alc269_auto_init_analog_input(codec);
13368 if (spec->unsol_event)
13369 alc_inithook(codec);
13373 * configuration and preset
13375 static const char *alc269_models[ALC269_MODEL_LAST] = {
13376 [ALC269_BASIC] = "basic",
13377 [ALC269_QUANTA_FL1] = "quanta",
13378 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13379 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13380 [ALC269_FUJITSU] = "fujitsu",
13381 [ALC269_LIFEBOOK] = "lifebook"
13384 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13385 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13386 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13387 ALC269_ASUS_EEEPC_P703),
13388 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13389 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13390 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13391 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13392 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13393 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13394 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13395 ALC269_ASUS_EEEPC_P901),
13396 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13397 ALC269_ASUS_EEEPC_P901),
13398 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13399 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13400 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13404 static struct alc_config_preset alc269_presets[] = {
13406 .mixers = { alc269_base_mixer },
13407 .init_verbs = { alc269_init_verbs },
13408 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13409 .dac_nids = alc269_dac_nids,
13411 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13412 .channel_mode = alc269_modes,
13413 .input_mux = &alc269_capture_source,
13415 [ALC269_QUANTA_FL1] = {
13416 .mixers = { alc269_quanta_fl1_mixer },
13417 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13418 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13419 .dac_nids = alc269_dac_nids,
13421 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13422 .channel_mode = alc269_modes,
13423 .input_mux = &alc269_capture_source,
13424 .unsol_event = alc269_quanta_fl1_unsol_event,
13425 .init_hook = alc269_quanta_fl1_init_hook,
13427 [ALC269_ASUS_EEEPC_P703] = {
13428 .mixers = { alc269_eeepc_mixer },
13429 .cap_mixer = alc269_epc_capture_mixer,
13430 .init_verbs = { alc269_init_verbs,
13431 alc269_eeepc_amic_init_verbs },
13432 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13433 .dac_nids = alc269_dac_nids,
13435 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13436 .channel_mode = alc269_modes,
13437 .input_mux = &alc269_eeepc_amic_capture_source,
13438 .unsol_event = alc269_eeepc_amic_unsol_event,
13439 .init_hook = alc269_eeepc_amic_inithook,
13441 [ALC269_ASUS_EEEPC_P901] = {
13442 .mixers = { alc269_eeepc_mixer },
13443 .cap_mixer = alc269_epc_capture_mixer,
13444 .init_verbs = { alc269_init_verbs,
13445 alc269_eeepc_dmic_init_verbs },
13446 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13447 .dac_nids = alc269_dac_nids,
13449 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13450 .channel_mode = alc269_modes,
13451 .input_mux = &alc269_eeepc_dmic_capture_source,
13452 .unsol_event = alc269_eeepc_dmic_unsol_event,
13453 .init_hook = alc269_eeepc_dmic_inithook,
13455 [ALC269_FUJITSU] = {
13456 .mixers = { alc269_fujitsu_mixer },
13457 .cap_mixer = alc269_epc_capture_mixer,
13458 .init_verbs = { alc269_init_verbs,
13459 alc269_eeepc_dmic_init_verbs },
13460 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13461 .dac_nids = alc269_dac_nids,
13463 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13464 .channel_mode = alc269_modes,
13465 .input_mux = &alc269_eeepc_dmic_capture_source,
13466 .unsol_event = alc269_eeepc_dmic_unsol_event,
13467 .init_hook = alc269_eeepc_dmic_inithook,
13469 [ALC269_LIFEBOOK] = {
13470 .mixers = { alc269_lifebook_mixer },
13471 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13472 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13473 .dac_nids = alc269_dac_nids,
13475 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13476 .channel_mode = alc269_modes,
13477 .input_mux = &alc269_capture_source,
13478 .unsol_event = alc269_lifebook_unsol_event,
13479 .init_hook = alc269_lifebook_init_hook,
13483 static int patch_alc269(struct hda_codec *codec)
13485 struct alc_spec *spec;
13489 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13493 codec->spec = spec;
13495 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13497 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13501 if (board_config < 0) {
13502 printk(KERN_INFO "hda_codec: Unknown model for %s, "
13503 "trying auto-probe from BIOS...\n", codec->chip_name);
13504 board_config = ALC269_AUTO;
13507 if (board_config == ALC269_AUTO) {
13508 /* automatic parse from the BIOS config */
13509 err = alc269_parse_auto_config(codec);
13515 "hda_codec: Cannot set up configuration "
13516 "from BIOS. Using base mode...\n");
13517 board_config = ALC269_BASIC;
13521 err = snd_hda_attach_beep_device(codec, 0x1);
13527 if (board_config != ALC269_AUTO)
13528 setup_preset(spec, &alc269_presets[board_config]);
13530 if (codec->subsystem_id == 0x17aa3bf8) {
13531 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13532 * fix the sample rate of analog I/O to 44.1kHz
13534 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13535 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13537 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13538 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13540 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13541 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13543 spec->adc_nids = alc269_adc_nids;
13544 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13545 spec->capsrc_nids = alc269_capsrc_nids;
13546 if (!spec->cap_mixer)
13547 set_capture_mixer(spec);
13548 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13550 codec->patch_ops = alc_patch_ops;
13551 if (board_config == ALC269_AUTO)
13552 spec->init_hook = alc269_auto_init;
13553 #ifdef CONFIG_SND_HDA_POWER_SAVE
13554 if (!spec->loopback.amplist)
13555 spec->loopback.amplist = alc269_loopbacks;
13557 codec->proc_widget_hook = print_realtek_coef;
13563 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13567 * set the path ways for 2 channel output
13568 * need to set the codec line out and mic 1 pin widgets to inputs
13570 static struct hda_verb alc861_threestack_ch2_init[] = {
13571 /* set pin widget 1Ah (line in) for input */
13572 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13573 /* set pin widget 18h (mic1/2) for input, for mic also enable
13576 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13578 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13580 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13581 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13587 * need to set the codec line out and mic 1 pin widgets to outputs
13589 static struct hda_verb alc861_threestack_ch6_init[] = {
13590 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13591 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13592 /* set pin widget 18h (mic1) for output (CLFE)*/
13593 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13595 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13596 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13598 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13600 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13601 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13606 static struct hda_channel_mode alc861_threestack_modes[2] = {
13607 { 2, alc861_threestack_ch2_init },
13608 { 6, alc861_threestack_ch6_init },
13610 /* Set mic1 as input and unmute the mixer */
13611 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13612 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13613 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13616 /* Set mic1 as output and mute mixer */
13617 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13618 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13619 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13623 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13624 { 2, alc861_uniwill_m31_ch2_init },
13625 { 4, alc861_uniwill_m31_ch4_init },
13628 /* Set mic1 and line-in as input and unmute the mixer */
13629 static struct hda_verb alc861_asus_ch2_init[] = {
13630 /* set pin widget 1Ah (line in) for input */
13631 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13632 /* set pin widget 18h (mic1/2) for input, for mic also enable
13635 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13637 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13639 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13640 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13644 /* Set mic1 nad line-in as output and mute mixer */
13645 static struct hda_verb alc861_asus_ch6_init[] = {
13646 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13647 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13648 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13649 /* set pin widget 18h (mic1) for output (CLFE)*/
13650 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13651 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13652 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13653 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13655 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13657 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13658 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13663 static struct hda_channel_mode alc861_asus_modes[2] = {
13664 { 2, alc861_asus_ch2_init },
13665 { 6, alc861_asus_ch6_init },
13670 static struct snd_kcontrol_new alc861_base_mixer[] = {
13671 /* output mixer control */
13672 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13673 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13674 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13675 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13676 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13678 /*Input mixer control */
13679 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13680 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13681 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13682 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13683 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13684 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13686 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13687 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13688 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13693 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13694 /* output mixer control */
13695 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13696 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13697 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13698 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13699 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13701 /* Input mixer control */
13702 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13703 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13704 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13705 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13706 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13707 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13709 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13711 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13715 .name = "Channel Mode",
13716 .info = alc_ch_mode_info,
13717 .get = alc_ch_mode_get,
13718 .put = alc_ch_mode_put,
13719 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13724 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13725 /* output mixer control */
13726 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13728 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13733 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13734 /* output mixer control */
13735 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13736 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13737 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13738 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13739 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13741 /* Input mixer control */
13742 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13743 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13744 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13745 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13746 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13747 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13749 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13750 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13754 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13755 .name = "Channel Mode",
13756 .info = alc_ch_mode_info,
13757 .get = alc_ch_mode_get,
13758 .put = alc_ch_mode_put,
13759 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13764 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13765 /* output mixer control */
13766 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13767 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13768 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13769 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13770 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13772 /* Input mixer control */
13773 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13774 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13775 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13776 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13777 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13778 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13780 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13781 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13785 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13786 .name = "Channel Mode",
13787 .info = alc_ch_mode_info,
13788 .get = alc_ch_mode_get,
13789 .put = alc_ch_mode_put,
13790 .private_value = ARRAY_SIZE(alc861_asus_modes),
13795 /* additional mixer */
13796 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13797 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13798 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13803 * generic initialization of ADC, input mixers and output mixers
13805 static struct hda_verb alc861_base_init_verbs[] = {
13807 * Unmute ADC0 and set the default input to mic-in
13809 /* port-A for surround (rear panel) */
13810 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13811 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13812 /* port-B for mic-in (rear panel) with vref */
13813 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13814 /* port-C for line-in (rear panel) */
13815 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13816 /* port-D for Front */
13817 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13818 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13819 /* port-E for HP out (front panel) */
13820 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13821 /* route front PCM to HP */
13822 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13823 /* port-F for mic-in (front panel) with vref */
13824 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13825 /* port-G for CLFE (rear panel) */
13826 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13827 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13828 /* port-H for side (rear panel) */
13829 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13830 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13832 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13833 /* route front mic to ADC1*/
13834 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13835 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13837 /* Unmute DAC0~3 & spdif out*/
13838 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13839 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13840 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13841 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13844 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13845 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13846 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13847 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13848 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13850 /* Unmute Stereo Mixer 15 */
13851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13856 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13857 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13858 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13859 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13860 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13861 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13862 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13863 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13864 /* hp used DAC 3 (Front) */
13865 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13871 static struct hda_verb alc861_threestack_init_verbs[] = {
13873 * Unmute ADC0 and set the default input to mic-in
13875 /* port-A for surround (rear panel) */
13876 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13877 /* port-B for mic-in (rear panel) with vref */
13878 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13879 /* port-C for line-in (rear panel) */
13880 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13881 /* port-D for Front */
13882 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13883 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13884 /* port-E for HP out (front panel) */
13885 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13886 /* route front PCM to HP */
13887 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13888 /* port-F for mic-in (front panel) with vref */
13889 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13890 /* port-G for CLFE (rear panel) */
13891 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13892 /* port-H for side (rear panel) */
13893 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13895 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13896 /* route front mic to ADC1*/
13897 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13898 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13899 /* Unmute DAC0~3 & spdif out*/
13900 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13901 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13902 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13903 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13906 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13907 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13908 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13909 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13910 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13912 /* Unmute Stereo Mixer 15 */
13913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13914 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13918 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13919 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13920 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13921 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13922 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13924 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13925 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13926 /* hp used DAC 3 (Front) */
13927 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13928 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13932 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13934 * Unmute ADC0 and set the default input to mic-in
13936 /* port-A for surround (rear panel) */
13937 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13938 /* port-B for mic-in (rear panel) with vref */
13939 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13940 /* port-C for line-in (rear panel) */
13941 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13942 /* port-D for Front */
13943 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13944 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13945 /* port-E for HP out (front panel) */
13946 /* this has to be set to VREF80 */
13947 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13948 /* route front PCM to HP */
13949 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13950 /* port-F for mic-in (front panel) with vref */
13951 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13952 /* port-G for CLFE (rear panel) */
13953 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13954 /* port-H for side (rear panel) */
13955 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13957 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13958 /* route front mic to ADC1*/
13959 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13960 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13961 /* Unmute DAC0~3 & spdif out*/
13962 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13963 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13964 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13965 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13968 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13969 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13970 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13971 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13972 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13974 /* Unmute Stereo Mixer 15 */
13975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13977 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13978 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13980 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13981 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13982 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13983 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13984 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13985 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13987 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13988 /* hp used DAC 3 (Front) */
13989 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13990 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13994 static struct hda_verb alc861_asus_init_verbs[] = {
13996 * Unmute ADC0 and set the default input to mic-in
13998 /* port-A for surround (rear panel)
13999 * according to codec#0 this is the HP jack
14001 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14002 /* route front PCM to HP */
14003 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
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 /* this has to be set to VREF80 */
14013 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14014 /* route front PCM to HP */
14015 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14016 /* port-F for mic-in (front panel) with vref */
14017 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14018 /* port-G for CLFE (rear panel) */
14019 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14020 /* port-H for side (rear panel) */
14021 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14023 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14024 /* route front mic to ADC1*/
14025 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14026 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14027 /* Unmute DAC0~3 & spdif out*/
14028 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14029 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14030 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14031 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14033 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14034 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14035 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14036 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14037 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14039 /* Unmute Stereo Mixer 15 */
14040 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14045 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14046 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14047 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14048 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14050 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14051 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14052 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14053 /* hp used DAC 3 (Front) */
14054 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14059 /* additional init verbs for ASUS laptops */
14060 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14061 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14062 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14067 * generic initialization of ADC, input mixers and output mixers
14069 static struct hda_verb alc861_auto_init_verbs[] = {
14071 * Unmute ADC0 and set the default input to mic-in
14073 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14074 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14076 /* Unmute DAC0~3 & spdif out*/
14077 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14078 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14079 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14080 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14083 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14084 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14085 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14086 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14087 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14089 /* Unmute Stereo Mixer 15 */
14090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14093 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14095 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14096 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14097 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14098 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14100 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14101 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14102 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14104 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14105 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14106 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14107 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14108 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14109 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14110 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14111 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14113 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14118 static struct hda_verb alc861_toshiba_init_verbs[] = {
14119 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14124 /* toggle speaker-output according to the hp-jack state */
14125 static void alc861_toshiba_automute(struct hda_codec *codec)
14127 unsigned int present;
14129 present = snd_hda_codec_read(codec, 0x0f, 0,
14130 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14131 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14132 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14133 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14134 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14137 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14140 if ((res >> 26) == ALC880_HP_EVENT)
14141 alc861_toshiba_automute(codec);
14144 /* pcm configuration: identical with ALC880 */
14145 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14146 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14147 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14148 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14151 #define ALC861_DIGOUT_NID 0x07
14153 static struct hda_channel_mode alc861_8ch_modes[1] = {
14157 static hda_nid_t alc861_dac_nids[4] = {
14158 /* front, surround, clfe, side */
14159 0x03, 0x06, 0x05, 0x04
14162 static hda_nid_t alc660_dac_nids[3] = {
14163 /* front, clfe, surround */
14167 static hda_nid_t alc861_adc_nids[1] = {
14172 static struct hda_input_mux alc861_capture_source = {
14176 { "Front Mic", 0x3 },
14183 /* fill in the dac_nids table from the parsed pin configuration */
14184 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
14185 const struct auto_pin_cfg *cfg)
14190 spec->multiout.dac_nids = spec->private_dac_nids;
14191 for (i = 0; i < cfg->line_outs; i++) {
14192 nid = cfg->line_out_pins[i];
14194 if (i >= ARRAY_SIZE(alc861_dac_nids))
14196 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
14199 spec->multiout.num_dacs = cfg->line_outs;
14203 /* add playback controls from the parsed DAC table */
14204 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
14205 const struct auto_pin_cfg *cfg)
14208 static const char *chname[4] = {
14209 "Front", "Surround", NULL /*CLFE*/, "Side"
14214 for (i = 0; i < cfg->line_outs; i++) {
14215 nid = spec->multiout.dac_nids[i];
14220 err = add_control(spec, ALC_CTL_BIND_MUTE,
14221 "Center Playback Switch",
14222 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14226 err = add_control(spec, ALC_CTL_BIND_MUTE,
14227 "LFE Playback Switch",
14228 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14233 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
14235 if (nid == alc861_dac_nids[idx])
14237 sprintf(name, "%s Playback Switch", chname[idx]);
14238 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14239 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14248 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
14256 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14258 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
14259 "Headphone Playback Switch",
14260 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14263 spec->multiout.hp_nid = nid;
14268 /* create playback/capture controls for input pins */
14269 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
14270 const struct auto_pin_cfg *cfg)
14272 struct hda_input_mux *imux = &spec->private_imux[0];
14273 int i, err, idx, idx1;
14275 for (i = 0; i < AUTO_PIN_LAST; i++) {
14276 switch (cfg->input_pins[i]) {
14279 idx = 2; /* Line In */
14283 idx = 2; /* Line In */
14287 idx = 1; /* Mic In */
14291 idx = 1; /* Mic In */
14301 err = new_analog_input(spec, cfg->input_pins[i],
14302 auto_pin_cfg_labels[i], idx, 0x15);
14306 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14307 imux->items[imux->num_items].index = idx1;
14313 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14315 int pin_type, int dac_idx)
14317 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14319 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14323 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14325 struct alc_spec *spec = codec->spec;
14328 for (i = 0; i < spec->autocfg.line_outs; i++) {
14329 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14330 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14332 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14333 spec->multiout.dac_nids[i]);
14337 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14339 struct alc_spec *spec = codec->spec;
14342 pin = spec->autocfg.hp_pins[0];
14343 if (pin) /* connect to front */
14344 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14345 spec->multiout.dac_nids[0]);
14346 pin = spec->autocfg.speaker_pins[0];
14348 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14351 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14353 struct alc_spec *spec = codec->spec;
14356 for (i = 0; i < AUTO_PIN_LAST; i++) {
14357 hda_nid_t nid = spec->autocfg.input_pins[i];
14358 if (nid >= 0x0c && nid <= 0x11)
14359 alc_set_input_pin(codec, nid, i);
14363 /* parse the BIOS configuration and set up the alc_spec */
14364 /* return 1 if successful, 0 if the proper config is not found,
14365 * or a negative error code
14367 static int alc861_parse_auto_config(struct hda_codec *codec)
14369 struct alc_spec *spec = codec->spec;
14371 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14373 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14377 if (!spec->autocfg.line_outs)
14378 return 0; /* can't find valid BIOS pin config */
14380 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
14383 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
14386 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
14389 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
14393 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14395 if (spec->autocfg.dig_outs)
14396 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14398 if (spec->kctls.list)
14399 add_mixer(spec, spec->kctls.list);
14401 add_verb(spec, alc861_auto_init_verbs);
14403 spec->num_mux_defs = 1;
14404 spec->input_mux = &spec->private_imux[0];
14406 spec->adc_nids = alc861_adc_nids;
14407 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14408 set_capture_mixer(spec);
14410 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14415 /* additional initialization for auto-configuration model */
14416 static void alc861_auto_init(struct hda_codec *codec)
14418 struct alc_spec *spec = codec->spec;
14419 alc861_auto_init_multi_out(codec);
14420 alc861_auto_init_hp_out(codec);
14421 alc861_auto_init_analog_input(codec);
14422 if (spec->unsol_event)
14423 alc_inithook(codec);
14426 #ifdef CONFIG_SND_HDA_POWER_SAVE
14427 static struct hda_amp_list alc861_loopbacks[] = {
14428 { 0x15, HDA_INPUT, 0 },
14429 { 0x15, HDA_INPUT, 1 },
14430 { 0x15, HDA_INPUT, 2 },
14431 { 0x15, HDA_INPUT, 3 },
14438 * configuration and preset
14440 static const char *alc861_models[ALC861_MODEL_LAST] = {
14441 [ALC861_3ST] = "3stack",
14442 [ALC660_3ST] = "3stack-660",
14443 [ALC861_3ST_DIG] = "3stack-dig",
14444 [ALC861_6ST_DIG] = "6stack-dig",
14445 [ALC861_UNIWILL_M31] = "uniwill-m31",
14446 [ALC861_TOSHIBA] = "toshiba",
14447 [ALC861_ASUS] = "asus",
14448 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14449 [ALC861_AUTO] = "auto",
14452 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14453 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14454 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14455 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14456 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14457 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14458 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14459 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14460 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14461 * Any other models that need this preset?
14463 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14464 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14465 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14466 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14467 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14468 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14469 /* FIXME: the below seems conflict */
14470 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14471 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14472 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14476 static struct alc_config_preset alc861_presets[] = {
14478 .mixers = { alc861_3ST_mixer },
14479 .init_verbs = { alc861_threestack_init_verbs },
14480 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14481 .dac_nids = alc861_dac_nids,
14482 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14483 .channel_mode = alc861_threestack_modes,
14485 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14486 .adc_nids = alc861_adc_nids,
14487 .input_mux = &alc861_capture_source,
14489 [ALC861_3ST_DIG] = {
14490 .mixers = { alc861_base_mixer },
14491 .init_verbs = { alc861_threestack_init_verbs },
14492 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14493 .dac_nids = alc861_dac_nids,
14494 .dig_out_nid = ALC861_DIGOUT_NID,
14495 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14496 .channel_mode = alc861_threestack_modes,
14498 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14499 .adc_nids = alc861_adc_nids,
14500 .input_mux = &alc861_capture_source,
14502 [ALC861_6ST_DIG] = {
14503 .mixers = { alc861_base_mixer },
14504 .init_verbs = { alc861_base_init_verbs },
14505 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14506 .dac_nids = alc861_dac_nids,
14507 .dig_out_nid = ALC861_DIGOUT_NID,
14508 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14509 .channel_mode = alc861_8ch_modes,
14510 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14511 .adc_nids = alc861_adc_nids,
14512 .input_mux = &alc861_capture_source,
14515 .mixers = { alc861_3ST_mixer },
14516 .init_verbs = { alc861_threestack_init_verbs },
14517 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14518 .dac_nids = alc660_dac_nids,
14519 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14520 .channel_mode = alc861_threestack_modes,
14522 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14523 .adc_nids = alc861_adc_nids,
14524 .input_mux = &alc861_capture_source,
14526 [ALC861_UNIWILL_M31] = {
14527 .mixers = { alc861_uniwill_m31_mixer },
14528 .init_verbs = { alc861_uniwill_m31_init_verbs },
14529 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14530 .dac_nids = alc861_dac_nids,
14531 .dig_out_nid = ALC861_DIGOUT_NID,
14532 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14533 .channel_mode = alc861_uniwill_m31_modes,
14535 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14536 .adc_nids = alc861_adc_nids,
14537 .input_mux = &alc861_capture_source,
14539 [ALC861_TOSHIBA] = {
14540 .mixers = { alc861_toshiba_mixer },
14541 .init_verbs = { alc861_base_init_verbs,
14542 alc861_toshiba_init_verbs },
14543 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14544 .dac_nids = alc861_dac_nids,
14545 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14546 .channel_mode = alc883_3ST_2ch_modes,
14547 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14548 .adc_nids = alc861_adc_nids,
14549 .input_mux = &alc861_capture_source,
14550 .unsol_event = alc861_toshiba_unsol_event,
14551 .init_hook = alc861_toshiba_automute,
14554 .mixers = { alc861_asus_mixer },
14555 .init_verbs = { alc861_asus_init_verbs },
14556 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14557 .dac_nids = alc861_dac_nids,
14558 .dig_out_nid = ALC861_DIGOUT_NID,
14559 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14560 .channel_mode = alc861_asus_modes,
14563 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14564 .adc_nids = alc861_adc_nids,
14565 .input_mux = &alc861_capture_source,
14567 [ALC861_ASUS_LAPTOP] = {
14568 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14569 .init_verbs = { alc861_asus_init_verbs,
14570 alc861_asus_laptop_init_verbs },
14571 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14572 .dac_nids = alc861_dac_nids,
14573 .dig_out_nid = ALC861_DIGOUT_NID,
14574 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14575 .channel_mode = alc883_3ST_2ch_modes,
14577 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14578 .adc_nids = alc861_adc_nids,
14579 .input_mux = &alc861_capture_source,
14584 static int patch_alc861(struct hda_codec *codec)
14586 struct alc_spec *spec;
14590 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14594 codec->spec = spec;
14596 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14600 if (board_config < 0) {
14601 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14602 "trying auto-probe from BIOS...\n", codec->chip_name);
14603 board_config = ALC861_AUTO;
14606 if (board_config == ALC861_AUTO) {
14607 /* automatic parse from the BIOS config */
14608 err = alc861_parse_auto_config(codec);
14614 "hda_codec: Cannot set up configuration "
14615 "from BIOS. Using base mode...\n");
14616 board_config = ALC861_3ST_DIG;
14620 err = snd_hda_attach_beep_device(codec, 0x23);
14626 if (board_config != ALC861_AUTO)
14627 setup_preset(spec, &alc861_presets[board_config]);
14629 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14630 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14632 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14633 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14635 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14637 spec->vmaster_nid = 0x03;
14639 codec->patch_ops = alc_patch_ops;
14640 if (board_config == ALC861_AUTO)
14641 spec->init_hook = alc861_auto_init;
14642 #ifdef CONFIG_SND_HDA_POWER_SAVE
14643 if (!spec->loopback.amplist)
14644 spec->loopback.amplist = alc861_loopbacks;
14646 codec->proc_widget_hook = print_realtek_coef;
14652 * ALC861-VD support
14656 * In addition, an independent DAC
14658 #define ALC861VD_DIGOUT_NID 0x06
14660 static hda_nid_t alc861vd_dac_nids[4] = {
14661 /* front, surr, clfe, side surr */
14662 0x02, 0x03, 0x04, 0x05
14665 /* dac_nids for ALC660vd are in a different order - according to
14666 * Realtek's driver.
14667 * This should probably result in a different mixer for 6stack models
14668 * of ALC660vd codecs, but for now there is only 3stack mixer
14669 * - and it is the same as in 861vd.
14670 * adc_nids in ALC660vd are (is) the same as in 861vd
14672 static hda_nid_t alc660vd_dac_nids[3] = {
14673 /* front, rear, clfe, rear_surr */
14677 static hda_nid_t alc861vd_adc_nids[1] = {
14682 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14685 /* FIXME: should be a matrix-type input source selection */
14686 static struct hda_input_mux alc861vd_capture_source = {
14690 { "Front Mic", 0x1 },
14696 static struct hda_input_mux alc861vd_dallas_capture_source = {
14699 { "Ext Mic", 0x0 },
14700 { "Int Mic", 0x1 },
14704 static struct hda_input_mux alc861vd_hp_capture_source = {
14707 { "Front Mic", 0x0 },
14708 { "ATAPI Mic", 0x1 },
14715 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14722 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14723 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14724 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14725 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14726 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14733 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14734 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14735 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14736 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14737 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14741 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14742 { 6, alc861vd_6stack_ch6_init },
14743 { 8, alc861vd_6stack_ch8_init },
14746 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14749 .name = "Channel Mode",
14750 .info = alc_ch_mode_info,
14751 .get = alc_ch_mode_get,
14752 .put = alc_ch_mode_put,
14757 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14758 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14760 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14761 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14762 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14764 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14765 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14767 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14769 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14771 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14772 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14774 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14775 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14777 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14779 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14780 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14783 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14784 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14785 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14787 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14788 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14790 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14791 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14796 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14797 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14798 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14800 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14802 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14806 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14807 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14808 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14810 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14811 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14813 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14814 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14819 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14820 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14821 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14822 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14824 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14826 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14830 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14831 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14832 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14834 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14835 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14840 /* Pin assignment: Speaker=0x14, HP = 0x15,
14841 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14843 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14844 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14845 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14846 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14847 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14848 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14849 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14850 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14851 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14852 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14853 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14857 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14858 * Front Mic=0x18, ATAPI Mic = 0x19,
14860 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14861 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14862 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14863 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14864 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14865 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14866 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14867 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14868 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14874 * generic initialization of ADC, input mixers and output mixers
14876 static struct hda_verb alc861vd_volume_init_verbs[] = {
14878 * Unmute ADC0 and set the default input to mic-in
14880 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14881 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14883 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14884 * the analog-loopback mixer widget
14886 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14889 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14891 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14893 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14897 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14900 * Set up output mixers (0x02 - 0x05)
14902 /* set vol=0 to output mixers */
14903 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14904 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14905 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14906 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14908 /* set up input amps for analog loopback */
14909 /* Amp Indices: DAC = 0, mixer = 1 */
14910 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14912 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14913 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14914 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14916 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14917 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14923 * 3-stack pin configuration:
14924 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14926 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14928 * Set pin mode and muting
14930 /* set front pin widgets 0x14 for output */
14931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14932 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14933 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14935 /* Mic (rear) pin: input vref at 80% */
14936 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14937 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14938 /* Front Mic pin: input vref at 80% */
14939 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14940 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14941 /* Line In pin: input */
14942 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14944 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14945 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14946 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14947 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14948 /* CD pin widget for input */
14949 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14955 * 6-stack pin configuration:
14957 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14959 * Set pin mode and muting
14961 /* set front pin widgets 0x14 for output */
14962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14963 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14964 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14966 /* Rear Pin: output 1 (0x0d) */
14967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14968 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14969 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14970 /* CLFE Pin: output 2 (0x0e) */
14971 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14972 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14973 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14974 /* Side Pin: output 3 (0x0f) */
14975 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14976 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14977 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14979 /* Mic (rear) pin: input vref at 80% */
14980 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14981 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14982 /* Front Mic pin: input vref at 80% */
14983 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14984 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14985 /* Line In pin: input */
14986 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14987 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14988 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14989 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14990 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14991 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14992 /* CD pin widget for input */
14993 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14998 static struct hda_verb alc861vd_eapd_verbs[] = {
14999 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15003 static struct hda_verb alc660vd_eapd_verbs[] = {
15004 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15005 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15009 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15010 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15011 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15013 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15014 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15018 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15020 unsigned int present;
15021 unsigned char bits;
15023 present = snd_hda_codec_read(codec, 0x18, 0,
15024 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15025 bits = present ? HDA_AMP_MUTE : 0;
15026 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15027 HDA_AMP_MUTE, bits);
15030 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15032 struct alc_spec *spec = codec->spec;
15034 spec->autocfg.hp_pins[0] = 0x1b;
15035 spec->autocfg.speaker_pins[0] = 0x14;
15036 alc_automute_amp(codec);
15037 alc861vd_lenovo_mic_automute(codec);
15040 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15043 switch (res >> 26) {
15044 case ALC880_MIC_EVENT:
15045 alc861vd_lenovo_mic_automute(codec);
15048 alc_automute_amp_unsol_event(codec, res);
15053 static struct hda_verb alc861vd_dallas_verbs[] = {
15054 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15055 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15056 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15057 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15061 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15062 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15063 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15064 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15065 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15066 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15068 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15069 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15072 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15073 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15074 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15075 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15077 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15081 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15082 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15083 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15084 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15092 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15093 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15098 /* toggle speaker-output according to the hp-jack state */
15099 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
15101 struct alc_spec *spec = codec->spec;
15103 spec->autocfg.hp_pins[0] = 0x15;
15104 spec->autocfg.speaker_pins[0] = 0x14;
15105 alc_automute_amp(codec);
15108 #ifdef CONFIG_SND_HDA_POWER_SAVE
15109 #define alc861vd_loopbacks alc880_loopbacks
15112 /* pcm configuration: identical with ALC880 */
15113 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15114 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15115 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15116 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15119 * configuration and preset
15121 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15122 [ALC660VD_3ST] = "3stack-660",
15123 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15124 [ALC660VD_ASUS_V1S] = "asus-v1s",
15125 [ALC861VD_3ST] = "3stack",
15126 [ALC861VD_3ST_DIG] = "3stack-digout",
15127 [ALC861VD_6ST_DIG] = "6stack-digout",
15128 [ALC861VD_LENOVO] = "lenovo",
15129 [ALC861VD_DALLAS] = "dallas",
15130 [ALC861VD_HP] = "hp",
15131 [ALC861VD_AUTO] = "auto",
15134 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15135 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15136 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15137 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15138 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15139 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15140 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15141 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15142 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15143 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15144 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
15145 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15146 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15147 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15148 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15149 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15153 static struct alc_config_preset alc861vd_presets[] = {
15155 .mixers = { alc861vd_3st_mixer },
15156 .init_verbs = { alc861vd_volume_init_verbs,
15157 alc861vd_3stack_init_verbs },
15158 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15159 .dac_nids = alc660vd_dac_nids,
15160 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15161 .channel_mode = alc861vd_3stack_2ch_modes,
15162 .input_mux = &alc861vd_capture_source,
15164 [ALC660VD_3ST_DIG] = {
15165 .mixers = { alc861vd_3st_mixer },
15166 .init_verbs = { alc861vd_volume_init_verbs,
15167 alc861vd_3stack_init_verbs },
15168 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15169 .dac_nids = alc660vd_dac_nids,
15170 .dig_out_nid = ALC861VD_DIGOUT_NID,
15171 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15172 .channel_mode = alc861vd_3stack_2ch_modes,
15173 .input_mux = &alc861vd_capture_source,
15176 .mixers = { alc861vd_3st_mixer },
15177 .init_verbs = { alc861vd_volume_init_verbs,
15178 alc861vd_3stack_init_verbs },
15179 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15180 .dac_nids = alc861vd_dac_nids,
15181 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15182 .channel_mode = alc861vd_3stack_2ch_modes,
15183 .input_mux = &alc861vd_capture_source,
15185 [ALC861VD_3ST_DIG] = {
15186 .mixers = { alc861vd_3st_mixer },
15187 .init_verbs = { alc861vd_volume_init_verbs,
15188 alc861vd_3stack_init_verbs },
15189 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15190 .dac_nids = alc861vd_dac_nids,
15191 .dig_out_nid = ALC861VD_DIGOUT_NID,
15192 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15193 .channel_mode = alc861vd_3stack_2ch_modes,
15194 .input_mux = &alc861vd_capture_source,
15196 [ALC861VD_6ST_DIG] = {
15197 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15198 .init_verbs = { alc861vd_volume_init_verbs,
15199 alc861vd_6stack_init_verbs },
15200 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15201 .dac_nids = alc861vd_dac_nids,
15202 .dig_out_nid = ALC861VD_DIGOUT_NID,
15203 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15204 .channel_mode = alc861vd_6stack_modes,
15205 .input_mux = &alc861vd_capture_source,
15207 [ALC861VD_LENOVO] = {
15208 .mixers = { alc861vd_lenovo_mixer },
15209 .init_verbs = { alc861vd_volume_init_verbs,
15210 alc861vd_3stack_init_verbs,
15211 alc861vd_eapd_verbs,
15212 alc861vd_lenovo_unsol_verbs },
15213 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15214 .dac_nids = alc660vd_dac_nids,
15215 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15216 .channel_mode = alc861vd_3stack_2ch_modes,
15217 .input_mux = &alc861vd_capture_source,
15218 .unsol_event = alc861vd_lenovo_unsol_event,
15219 .init_hook = alc861vd_lenovo_init_hook,
15221 [ALC861VD_DALLAS] = {
15222 .mixers = { alc861vd_dallas_mixer },
15223 .init_verbs = { alc861vd_dallas_verbs },
15224 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15225 .dac_nids = alc861vd_dac_nids,
15226 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15227 .channel_mode = alc861vd_3stack_2ch_modes,
15228 .input_mux = &alc861vd_dallas_capture_source,
15229 .unsol_event = alc_automute_amp_unsol_event,
15230 .init_hook = alc861vd_dallas_init_hook,
15233 .mixers = { alc861vd_hp_mixer },
15234 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15235 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15236 .dac_nids = alc861vd_dac_nids,
15237 .dig_out_nid = ALC861VD_DIGOUT_NID,
15238 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15239 .channel_mode = alc861vd_3stack_2ch_modes,
15240 .input_mux = &alc861vd_hp_capture_source,
15241 .unsol_event = alc_automute_amp_unsol_event,
15242 .init_hook = alc861vd_dallas_init_hook,
15244 [ALC660VD_ASUS_V1S] = {
15245 .mixers = { alc861vd_lenovo_mixer },
15246 .init_verbs = { alc861vd_volume_init_verbs,
15247 alc861vd_3stack_init_verbs,
15248 alc861vd_eapd_verbs,
15249 alc861vd_lenovo_unsol_verbs },
15250 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15251 .dac_nids = alc660vd_dac_nids,
15252 .dig_out_nid = ALC861VD_DIGOUT_NID,
15253 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15254 .channel_mode = alc861vd_3stack_2ch_modes,
15255 .input_mux = &alc861vd_capture_source,
15256 .unsol_event = alc861vd_lenovo_unsol_event,
15257 .init_hook = alc861vd_lenovo_init_hook,
15262 * BIOS auto configuration
15264 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15265 hda_nid_t nid, int pin_type, int dac_idx)
15267 alc_set_pin_output(codec, nid, pin_type);
15270 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15272 struct alc_spec *spec = codec->spec;
15275 for (i = 0; i <= HDA_SIDE; i++) {
15276 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15277 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15279 alc861vd_auto_set_output_and_unmute(codec, nid,
15285 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15287 struct alc_spec *spec = codec->spec;
15290 pin = spec->autocfg.hp_pins[0];
15291 if (pin) /* connect to front and use dac 0 */
15292 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15293 pin = spec->autocfg.speaker_pins[0];
15295 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15298 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15299 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15301 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15303 struct alc_spec *spec = codec->spec;
15306 for (i = 0; i < AUTO_PIN_LAST; i++) {
15307 hda_nid_t nid = spec->autocfg.input_pins[i];
15308 if (alc861vd_is_input_pin(nid)) {
15309 alc_set_input_pin(codec, nid, i);
15310 if (nid != ALC861VD_PIN_CD_NID &&
15311 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15312 snd_hda_codec_write(codec, nid, 0,
15313 AC_VERB_SET_AMP_GAIN_MUTE,
15319 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15321 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15322 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15324 /* add playback controls from the parsed DAC table */
15325 /* Based on ALC880 version. But ALC861VD has separate,
15326 * different NIDs for mute/unmute switch and volume control */
15327 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15328 const struct auto_pin_cfg *cfg)
15331 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15332 hda_nid_t nid_v, nid_s;
15335 for (i = 0; i < cfg->line_outs; i++) {
15336 if (!spec->multiout.dac_nids[i])
15338 nid_v = alc861vd_idx_to_mixer_vol(
15340 spec->multiout.dac_nids[i]));
15341 nid_s = alc861vd_idx_to_mixer_switch(
15343 spec->multiout.dac_nids[i]));
15347 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15348 "Center Playback Volume",
15349 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15353 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15354 "LFE Playback Volume",
15355 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15359 err = add_control(spec, ALC_CTL_BIND_MUTE,
15360 "Center Playback Switch",
15361 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15365 err = add_control(spec, ALC_CTL_BIND_MUTE,
15366 "LFE Playback Switch",
15367 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15372 sprintf(name, "%s Playback Volume", chname[i]);
15373 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15374 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15378 sprintf(name, "%s Playback Switch", chname[i]);
15379 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15380 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15389 /* add playback controls for speaker and HP outputs */
15390 /* Based on ALC880 version. But ALC861VD has separate,
15391 * different NIDs for mute/unmute switch and volume control */
15392 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15393 hda_nid_t pin, const char *pfx)
15395 hda_nid_t nid_v, nid_s;
15402 if (alc880_is_fixed_pin(pin)) {
15403 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15404 /* specify the DAC as the extra output */
15405 if (!spec->multiout.hp_nid)
15406 spec->multiout.hp_nid = nid_v;
15408 spec->multiout.extra_out_nid[0] = nid_v;
15409 /* control HP volume/switch on the output mixer amp */
15410 nid_v = alc861vd_idx_to_mixer_vol(
15411 alc880_fixed_pin_idx(pin));
15412 nid_s = alc861vd_idx_to_mixer_switch(
15413 alc880_fixed_pin_idx(pin));
15415 sprintf(name, "%s Playback Volume", pfx);
15416 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15417 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15420 sprintf(name, "%s Playback Switch", pfx);
15421 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15422 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15425 } else if (alc880_is_multi_pin(pin)) {
15426 /* set manual connection */
15427 /* we have only a switch on HP-out PIN */
15428 sprintf(name, "%s Playback Switch", pfx);
15429 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15430 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15437 /* parse the BIOS configuration and set up the alc_spec
15438 * return 1 if successful, 0 if the proper config is not found,
15439 * or a negative error code
15440 * Based on ALC880 version - had to change it to override
15441 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15442 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15444 struct alc_spec *spec = codec->spec;
15446 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15448 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15452 if (!spec->autocfg.line_outs)
15453 return 0; /* can't find valid BIOS pin config */
15455 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15458 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15461 err = alc861vd_auto_create_extra_out(spec,
15462 spec->autocfg.speaker_pins[0],
15466 err = alc861vd_auto_create_extra_out(spec,
15467 spec->autocfg.hp_pins[0],
15471 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15475 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15477 if (spec->autocfg.dig_outs)
15478 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15480 if (spec->kctls.list)
15481 add_mixer(spec, spec->kctls.list);
15483 add_verb(spec, alc861vd_volume_init_verbs);
15485 spec->num_mux_defs = 1;
15486 spec->input_mux = &spec->private_imux[0];
15488 err = alc_auto_add_mic_boost(codec);
15492 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15497 /* additional initialization for auto-configuration model */
15498 static void alc861vd_auto_init(struct hda_codec *codec)
15500 struct alc_spec *spec = codec->spec;
15501 alc861vd_auto_init_multi_out(codec);
15502 alc861vd_auto_init_hp_out(codec);
15503 alc861vd_auto_init_analog_input(codec);
15504 alc861vd_auto_init_input_src(codec);
15505 if (spec->unsol_event)
15506 alc_inithook(codec);
15509 static int patch_alc861vd(struct hda_codec *codec)
15511 struct alc_spec *spec;
15512 int err, board_config;
15514 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15518 codec->spec = spec;
15520 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15524 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15525 printk(KERN_INFO "hda_codec: Unknown model for %s, "
15526 "trying auto-probe from BIOS...\n", codec->chip_name);
15527 board_config = ALC861VD_AUTO;
15530 if (board_config == ALC861VD_AUTO) {
15531 /* automatic parse from the BIOS config */
15532 err = alc861vd_parse_auto_config(codec);
15538 "hda_codec: Cannot set up configuration "
15539 "from BIOS. Using base mode...\n");
15540 board_config = ALC861VD_3ST;
15544 err = snd_hda_attach_beep_device(codec, 0x23);
15550 if (board_config != ALC861VD_AUTO)
15551 setup_preset(spec, &alc861vd_presets[board_config]);
15553 if (codec->vendor_id == 0x10ec0660) {
15554 /* always turn on EAPD */
15555 add_verb(spec, alc660vd_eapd_verbs);
15558 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15559 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15561 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15562 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15564 spec->adc_nids = alc861vd_adc_nids;
15565 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15566 spec->capsrc_nids = alc861vd_capsrc_nids;
15568 set_capture_mixer(spec);
15569 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15571 spec->vmaster_nid = 0x02;
15573 codec->patch_ops = alc_patch_ops;
15575 if (board_config == ALC861VD_AUTO)
15576 spec->init_hook = alc861vd_auto_init;
15577 #ifdef CONFIG_SND_HDA_POWER_SAVE
15578 if (!spec->loopback.amplist)
15579 spec->loopback.amplist = alc861vd_loopbacks;
15581 codec->proc_widget_hook = print_realtek_coef;
15589 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15590 * configuration. Each pin widget can choose any input DACs and a mixer.
15591 * Each ADC is connected from a mixer of all inputs. This makes possible
15592 * 6-channel independent captures.
15594 * In addition, an independent DAC for the multi-playback (not used in this
15597 #define ALC662_DIGOUT_NID 0x06
15598 #define ALC662_DIGIN_NID 0x0a
15600 static hda_nid_t alc662_dac_nids[4] = {
15601 /* front, rear, clfe, rear_surr */
15605 static hda_nid_t alc272_dac_nids[2] = {
15609 static hda_nid_t alc662_adc_nids[1] = {
15614 static hda_nid_t alc272_adc_nids[1] = {
15619 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15620 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15624 /* FIXME: should be a matrix-type input source selection */
15625 static struct hda_input_mux alc662_capture_source = {
15629 { "Front Mic", 0x1 },
15635 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15643 static struct hda_input_mux alc662_eeepc_capture_source = {
15651 static struct hda_input_mux alc663_capture_source = {
15655 { "Front Mic", 0x1 },
15660 static struct hda_input_mux alc663_m51va_capture_source = {
15663 { "Ext-Mic", 0x0 },
15668 #if 1 /* set to 0 for testing other input sources below */
15669 static struct hda_input_mux alc272_nc10_capture_source = {
15672 { "Autoselect Mic", 0x0 },
15673 { "Internal Mic", 0x1 },
15677 static struct hda_input_mux alc272_nc10_capture_source = {
15680 { "Autoselect Mic", 0x0 },
15681 { "Internal Mic", 0x1 },
15682 { "In-0x02", 0x2 },
15683 { "In-0x03", 0x3 },
15684 { "In-0x04", 0x4 },
15685 { "In-0x05", 0x5 },
15686 { "In-0x06", 0x6 },
15687 { "In-0x07", 0x7 },
15688 { "In-0x08", 0x8 },
15689 { "In-0x09", 0x9 },
15690 { "In-0x0a", 0x0a },
15691 { "In-0x0b", 0x0b },
15692 { "In-0x0c", 0x0c },
15693 { "In-0x0d", 0x0d },
15694 { "In-0x0e", 0x0e },
15695 { "In-0x0f", 0x0f },
15703 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15710 static struct hda_verb alc662_3ST_ch2_init[] = {
15711 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15712 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15713 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15714 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15721 static struct hda_verb alc662_3ST_ch6_init[] = {
15722 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15723 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15724 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15725 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15726 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15727 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15731 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15732 { 2, alc662_3ST_ch2_init },
15733 { 6, alc662_3ST_ch6_init },
15739 static struct hda_verb alc662_sixstack_ch6_init[] = {
15740 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15741 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15742 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15749 static struct hda_verb alc662_sixstack_ch8_init[] = {
15750 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15751 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15752 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15756 static struct hda_channel_mode alc662_5stack_modes[2] = {
15757 { 2, alc662_sixstack_ch6_init },
15758 { 6, alc662_sixstack_ch8_init },
15761 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15762 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15765 static struct snd_kcontrol_new alc662_base_mixer[] = {
15766 /* output mixer control */
15767 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15768 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15769 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15770 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15771 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15772 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15773 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15774 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15775 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15777 /*Input mixer control */
15778 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15779 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15780 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15781 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15782 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15783 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15784 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15785 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15789 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15790 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15791 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15792 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15793 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15794 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15804 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15805 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15806 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15807 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15808 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15809 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15810 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15811 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15812 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15814 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15815 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15816 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15817 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15820 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15821 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15825 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15826 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15827 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15828 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15829 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15830 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15832 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15838 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15839 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15840 ALC262_HIPPO_MASTER_SWITCH,
15842 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15843 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15844 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15846 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15847 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15848 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15852 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15853 ALC262_HIPPO_MASTER_SWITCH,
15854 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15855 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15856 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15857 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15858 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15859 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15860 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15866 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15867 .ops = &snd_hda_bind_vol,
15869 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15870 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15875 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15876 .ops = &snd_hda_bind_sw,
15878 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15879 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15884 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15885 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15886 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15887 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15888 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15892 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15893 .ops = &snd_hda_bind_sw,
15895 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15896 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15897 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15902 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15903 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15904 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15907 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15908 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15913 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15914 .ops = &snd_hda_bind_sw,
15916 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15917 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15918 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15923 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15924 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15925 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15927 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15928 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15929 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15933 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15934 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15935 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15936 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15939 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15940 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15944 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15945 .ops = &snd_hda_bind_vol,
15947 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15948 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15953 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15954 .ops = &snd_hda_bind_sw,
15956 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15957 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15962 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15963 HDA_BIND_VOL("Master Playback Volume",
15964 &alc663_asus_two_bind_master_vol),
15965 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15966 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15968 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15969 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15973 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15974 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15975 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15976 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15977 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15979 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15983 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15984 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15985 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15986 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15987 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15991 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15992 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15993 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15997 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15998 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15999 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16003 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16004 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16005 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16006 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16007 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16011 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16013 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16014 .name = "Channel Mode",
16015 .info = alc_ch_mode_info,
16016 .get = alc_ch_mode_get,
16017 .put = alc_ch_mode_put,
16022 static struct hda_verb alc662_init_verbs[] = {
16023 /* ADC: mute amp left and right */
16024 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16025 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16026 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16035 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16036 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16037 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16038 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16039 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16041 /* Front Pin: output 0 (0x0c) */
16042 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16043 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16045 /* Rear Pin: output 1 (0x0d) */
16046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16047 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16049 /* CLFE Pin: output 2 (0x0e) */
16050 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16051 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16053 /* Mic (rear) pin: input vref at 80% */
16054 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16055 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16056 /* Front Mic pin: input vref at 80% */
16057 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16058 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16059 /* Line In pin: input */
16060 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16061 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16062 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16063 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16064 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16065 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16066 /* CD pin widget for input */
16067 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16069 /* FIXME: use matrix-type input source selection */
16070 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16075 /* always trun on EAPD */
16076 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16077 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16082 static struct hda_verb alc662_sue_init_verbs[] = {
16083 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16084 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16088 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16089 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16090 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16094 /* Set Unsolicited Event*/
16095 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16096 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16097 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16102 * generic initialization of ADC, input mixers and output mixers
16104 static struct hda_verb alc662_auto_init_verbs[] = {
16106 * Unmute ADC and set the default input to mic-in
16108 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16109 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16111 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16113 * Note: PASD motherboards uses the Line In 2 as the input for front
16114 * panel mic (mic 2)
16116 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16124 * Set up output mixers (0x0c - 0x0f)
16126 /* set vol=0 to output mixers */
16127 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16128 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16129 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16131 /* set up input amps for analog loopback */
16132 /* Amp Indices: DAC = 0, mixer = 1 */
16133 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16137 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16141 /* FIXME: use matrix-type input source selection */
16142 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16144 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16145 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16149 /* additional verbs for ALC663 */
16150 static struct hda_verb alc663_auto_init_verbs[] = {
16151 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16152 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16156 static struct hda_verb alc663_m51va_init_verbs[] = {
16157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16158 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16159 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16160 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16161 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16162 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16164 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16165 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16169 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16170 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16171 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16172 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16173 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16174 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16175 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16176 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16180 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16181 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16182 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16183 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16184 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16187 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16188 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16192 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16193 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16194 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16195 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16198 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16199 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16203 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16204 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16205 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16206 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16207 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16209 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16210 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16211 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16212 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16213 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16214 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16215 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16219 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16220 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16221 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16222 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16223 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16224 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16225 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16226 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16227 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16228 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16229 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16230 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16231 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16235 static struct hda_verb alc663_g71v_init_verbs[] = {
16236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16237 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16238 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16240 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16241 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16242 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16244 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16245 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16246 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16250 static struct hda_verb alc663_g50v_init_verbs[] = {
16251 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16252 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16253 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16255 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16256 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16260 static struct hda_verb alc662_ecs_init_verbs[] = {
16261 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16263 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16264 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16268 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16269 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16270 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16272 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16273 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16274 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16275 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16276 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16278 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16279 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16283 static struct hda_verb alc272_dell_init_verbs[] = {
16284 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16285 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16287 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16288 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16289 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16290 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16293 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16294 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16298 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16299 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16300 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16304 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16305 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16306 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16310 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16312 unsigned int present;
16313 unsigned char bits;
16315 present = snd_hda_codec_read(codec, 0x14, 0,
16316 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16317 bits = present ? HDA_AMP_MUTE : 0;
16318 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16319 HDA_AMP_MUTE, bits);
16322 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16324 unsigned int present;
16325 unsigned char bits;
16327 present = snd_hda_codec_read(codec, 0x1b, 0,
16328 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16329 bits = present ? HDA_AMP_MUTE : 0;
16330 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16331 HDA_AMP_MUTE, bits);
16332 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16333 HDA_AMP_MUTE, bits);
16336 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16339 if ((res >> 26) == ALC880_HP_EVENT)
16340 alc662_lenovo_101e_all_automute(codec);
16341 if ((res >> 26) == ALC880_FRONT_EVENT)
16342 alc662_lenovo_101e_ispeaker_automute(codec);
16345 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16347 unsigned int present;
16349 present = snd_hda_codec_read(codec, 0x18, 0,
16350 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16351 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16352 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16353 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16354 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16355 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16356 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16357 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16358 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16361 /* unsolicited event for HP jack sensing */
16362 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16365 if ((res >> 26) == ALC880_MIC_EVENT)
16366 alc662_eeepc_mic_automute(codec);
16368 alc262_hippo_unsol_event(codec, res);
16371 static void alc662_eeepc_inithook(struct hda_codec *codec)
16373 alc262_hippo1_init_hook(codec);
16374 alc662_eeepc_mic_automute(codec);
16377 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16379 struct alc_spec *spec = codec->spec;
16381 spec->autocfg.hp_pins[0] = 0x14;
16382 spec->autocfg.speaker_pins[0] = 0x1b;
16383 alc262_hippo_master_update(codec);
16386 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16388 unsigned int present;
16389 unsigned char bits;
16391 present = snd_hda_codec_read(codec, 0x21, 0,
16392 AC_VERB_GET_PIN_SENSE, 0)
16393 & AC_PINSENSE_PRESENCE;
16394 bits = present ? HDA_AMP_MUTE : 0;
16395 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16396 AMP_IN_MUTE(0), bits);
16397 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16398 AMP_IN_MUTE(0), bits);
16401 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16403 unsigned int present;
16404 unsigned char bits;
16406 present = snd_hda_codec_read(codec, 0x21, 0,
16407 AC_VERB_GET_PIN_SENSE, 0)
16408 & AC_PINSENSE_PRESENCE;
16409 bits = present ? HDA_AMP_MUTE : 0;
16410 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16411 AMP_IN_MUTE(0), bits);
16412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16413 AMP_IN_MUTE(0), bits);
16414 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16415 AMP_IN_MUTE(0), bits);
16416 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16417 AMP_IN_MUTE(0), bits);
16420 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16422 unsigned int present;
16423 unsigned char bits;
16425 present = snd_hda_codec_read(codec, 0x15, 0,
16426 AC_VERB_GET_PIN_SENSE, 0)
16427 & AC_PINSENSE_PRESENCE;
16428 bits = present ? HDA_AMP_MUTE : 0;
16429 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16430 AMP_IN_MUTE(0), bits);
16431 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16432 AMP_IN_MUTE(0), bits);
16433 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16434 AMP_IN_MUTE(0), bits);
16435 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16436 AMP_IN_MUTE(0), bits);
16439 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16441 unsigned int present;
16442 unsigned char bits;
16444 present = snd_hda_codec_read(codec, 0x1b, 0,
16445 AC_VERB_GET_PIN_SENSE, 0)
16446 & AC_PINSENSE_PRESENCE;
16447 bits = present ? 0 : PIN_OUT;
16448 snd_hda_codec_write(codec, 0x14, 0,
16449 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16452 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16454 unsigned int present1, present2;
16456 present1 = snd_hda_codec_read(codec, 0x21, 0,
16457 AC_VERB_GET_PIN_SENSE, 0)
16458 & AC_PINSENSE_PRESENCE;
16459 present2 = snd_hda_codec_read(codec, 0x15, 0,
16460 AC_VERB_GET_PIN_SENSE, 0)
16461 & AC_PINSENSE_PRESENCE;
16463 if (present1 || present2) {
16464 snd_hda_codec_write_cache(codec, 0x14, 0,
16465 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16467 snd_hda_codec_write_cache(codec, 0x14, 0,
16468 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16472 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16474 unsigned int present1, present2;
16476 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16477 AC_VERB_GET_PIN_SENSE, 0)
16478 & AC_PINSENSE_PRESENCE;
16479 present2 = snd_hda_codec_read(codec, 0x15, 0,
16480 AC_VERB_GET_PIN_SENSE, 0)
16481 & AC_PINSENSE_PRESENCE;
16483 if (present1 || present2) {
16484 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16485 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16486 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16487 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16489 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16490 AMP_IN_MUTE(0), 0);
16491 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16492 AMP_IN_MUTE(0), 0);
16496 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16498 unsigned int present;
16500 present = snd_hda_codec_read(codec, 0x18, 0,
16501 AC_VERB_GET_PIN_SENSE, 0)
16502 & AC_PINSENSE_PRESENCE;
16503 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16504 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16505 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16506 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16507 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16508 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16509 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16510 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16513 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16516 switch (res >> 26) {
16517 case ALC880_HP_EVENT:
16518 alc663_m51va_speaker_automute(codec);
16520 case ALC880_MIC_EVENT:
16521 alc663_m51va_mic_automute(codec);
16526 static void alc663_m51va_inithook(struct hda_codec *codec)
16528 alc663_m51va_speaker_automute(codec);
16529 alc663_m51va_mic_automute(codec);
16532 /* ***************** Mode1 ******************************/
16533 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16536 switch (res >> 26) {
16537 case ALC880_HP_EVENT:
16538 alc663_m51va_speaker_automute(codec);
16540 case ALC880_MIC_EVENT:
16541 alc662_eeepc_mic_automute(codec);
16546 static void alc663_mode1_inithook(struct hda_codec *codec)
16548 alc663_m51va_speaker_automute(codec);
16549 alc662_eeepc_mic_automute(codec);
16551 /* ***************** Mode2 ******************************/
16552 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16555 switch (res >> 26) {
16556 case ALC880_HP_EVENT:
16557 alc662_f5z_speaker_automute(codec);
16559 case ALC880_MIC_EVENT:
16560 alc662_eeepc_mic_automute(codec);
16565 static void alc662_mode2_inithook(struct hda_codec *codec)
16567 alc662_f5z_speaker_automute(codec);
16568 alc662_eeepc_mic_automute(codec);
16570 /* ***************** Mode3 ******************************/
16571 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16574 switch (res >> 26) {
16575 case ALC880_HP_EVENT:
16576 alc663_two_hp_m1_speaker_automute(codec);
16578 case ALC880_MIC_EVENT:
16579 alc662_eeepc_mic_automute(codec);
16584 static void alc663_mode3_inithook(struct hda_codec *codec)
16586 alc663_two_hp_m1_speaker_automute(codec);
16587 alc662_eeepc_mic_automute(codec);
16589 /* ***************** Mode4 ******************************/
16590 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16593 switch (res >> 26) {
16594 case ALC880_HP_EVENT:
16595 alc663_21jd_two_speaker_automute(codec);
16597 case ALC880_MIC_EVENT:
16598 alc662_eeepc_mic_automute(codec);
16603 static void alc663_mode4_inithook(struct hda_codec *codec)
16605 alc663_21jd_two_speaker_automute(codec);
16606 alc662_eeepc_mic_automute(codec);
16608 /* ***************** Mode5 ******************************/
16609 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16612 switch (res >> 26) {
16613 case ALC880_HP_EVENT:
16614 alc663_15jd_two_speaker_automute(codec);
16616 case ALC880_MIC_EVENT:
16617 alc662_eeepc_mic_automute(codec);
16622 static void alc663_mode5_inithook(struct hda_codec *codec)
16624 alc663_15jd_two_speaker_automute(codec);
16625 alc662_eeepc_mic_automute(codec);
16627 /* ***************** Mode6 ******************************/
16628 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16631 switch (res >> 26) {
16632 case ALC880_HP_EVENT:
16633 alc663_two_hp_m2_speaker_automute(codec);
16635 case ALC880_MIC_EVENT:
16636 alc662_eeepc_mic_automute(codec);
16641 static void alc663_mode6_inithook(struct hda_codec *codec)
16643 alc663_two_hp_m2_speaker_automute(codec);
16644 alc662_eeepc_mic_automute(codec);
16647 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16649 unsigned int present;
16650 unsigned char bits;
16652 present = snd_hda_codec_read(codec, 0x21, 0,
16653 AC_VERB_GET_PIN_SENSE, 0)
16654 & AC_PINSENSE_PRESENCE;
16655 bits = present ? HDA_AMP_MUTE : 0;
16656 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16657 HDA_AMP_MUTE, bits);
16658 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16659 HDA_AMP_MUTE, bits);
16662 static void alc663_g71v_front_automute(struct hda_codec *codec)
16664 unsigned int present;
16665 unsigned char bits;
16667 present = snd_hda_codec_read(codec, 0x15, 0,
16668 AC_VERB_GET_PIN_SENSE, 0)
16669 & AC_PINSENSE_PRESENCE;
16670 bits = present ? HDA_AMP_MUTE : 0;
16671 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16672 HDA_AMP_MUTE, bits);
16675 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16678 switch (res >> 26) {
16679 case ALC880_HP_EVENT:
16680 alc663_g71v_hp_automute(codec);
16682 case ALC880_FRONT_EVENT:
16683 alc663_g71v_front_automute(codec);
16685 case ALC880_MIC_EVENT:
16686 alc662_eeepc_mic_automute(codec);
16691 static void alc663_g71v_inithook(struct hda_codec *codec)
16693 alc663_g71v_front_automute(codec);
16694 alc663_g71v_hp_automute(codec);
16695 alc662_eeepc_mic_automute(codec);
16698 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16701 switch (res >> 26) {
16702 case ALC880_HP_EVENT:
16703 alc663_m51va_speaker_automute(codec);
16705 case ALC880_MIC_EVENT:
16706 alc662_eeepc_mic_automute(codec);
16711 static void alc663_g50v_inithook(struct hda_codec *codec)
16713 alc663_m51va_speaker_automute(codec);
16714 alc662_eeepc_mic_automute(codec);
16717 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16718 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16719 ALC262_HIPPO_MASTER_SWITCH,
16721 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16722 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16723 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16725 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16726 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16727 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16731 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16732 /* Master Playback automatically created from Speaker and Headphone */
16733 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16734 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16735 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16736 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16738 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16739 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16740 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16742 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16743 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16744 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16748 #ifdef CONFIG_SND_HDA_POWER_SAVE
16749 #define alc662_loopbacks alc880_loopbacks
16753 /* pcm configuration: identical with ALC880 */
16754 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16755 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16756 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16757 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16760 * configuration and preset
16762 static const char *alc662_models[ALC662_MODEL_LAST] = {
16763 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16764 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16765 [ALC662_3ST_6ch] = "3stack-6ch",
16766 [ALC662_5ST_DIG] = "6stack-dig",
16767 [ALC662_LENOVO_101E] = "lenovo-101e",
16768 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16769 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16770 [ALC662_ECS] = "ecs",
16771 [ALC663_ASUS_M51VA] = "m51va",
16772 [ALC663_ASUS_G71V] = "g71v",
16773 [ALC663_ASUS_H13] = "h13",
16774 [ALC663_ASUS_G50V] = "g50v",
16775 [ALC663_ASUS_MODE1] = "asus-mode1",
16776 [ALC662_ASUS_MODE2] = "asus-mode2",
16777 [ALC663_ASUS_MODE3] = "asus-mode3",
16778 [ALC663_ASUS_MODE4] = "asus-mode4",
16779 [ALC663_ASUS_MODE5] = "asus-mode5",
16780 [ALC663_ASUS_MODE6] = "asus-mode6",
16781 [ALC272_DELL] = "dell",
16782 [ALC272_DELL_ZM1] = "dell-zm1",
16783 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16784 [ALC662_AUTO] = "auto",
16787 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16788 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16789 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16790 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16791 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16792 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16793 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16794 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16795 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16796 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16797 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16798 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16799 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16800 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16801 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16802 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16803 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16804 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16805 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16806 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16807 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16808 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16809 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16810 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16811 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16812 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16813 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16814 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16815 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16816 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16817 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16818 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16819 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16820 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16821 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16822 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16823 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16824 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16825 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16826 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16827 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16828 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16829 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16830 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16831 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16832 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16833 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16834 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16835 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16836 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16837 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16838 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16839 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16840 ALC662_3ST_6ch_DIG),
16841 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16842 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16843 ALC662_3ST_6ch_DIG),
16844 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16845 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16846 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16847 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16848 ALC662_3ST_6ch_DIG),
16849 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16854 static struct alc_config_preset alc662_presets[] = {
16855 [ALC662_3ST_2ch_DIG] = {
16856 .mixers = { alc662_3ST_2ch_mixer },
16857 .init_verbs = { alc662_init_verbs },
16858 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16859 .dac_nids = alc662_dac_nids,
16860 .dig_out_nid = ALC662_DIGOUT_NID,
16861 .dig_in_nid = ALC662_DIGIN_NID,
16862 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16863 .channel_mode = alc662_3ST_2ch_modes,
16864 .input_mux = &alc662_capture_source,
16866 [ALC662_3ST_6ch_DIG] = {
16867 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16868 .init_verbs = { alc662_init_verbs },
16869 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16870 .dac_nids = alc662_dac_nids,
16871 .dig_out_nid = ALC662_DIGOUT_NID,
16872 .dig_in_nid = ALC662_DIGIN_NID,
16873 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16874 .channel_mode = alc662_3ST_6ch_modes,
16876 .input_mux = &alc662_capture_source,
16878 [ALC662_3ST_6ch] = {
16879 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16880 .init_verbs = { alc662_init_verbs },
16881 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16882 .dac_nids = alc662_dac_nids,
16883 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16884 .channel_mode = alc662_3ST_6ch_modes,
16886 .input_mux = &alc662_capture_source,
16888 [ALC662_5ST_DIG] = {
16889 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16890 .init_verbs = { alc662_init_verbs },
16891 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16892 .dac_nids = alc662_dac_nids,
16893 .dig_out_nid = ALC662_DIGOUT_NID,
16894 .dig_in_nid = ALC662_DIGIN_NID,
16895 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16896 .channel_mode = alc662_5stack_modes,
16897 .input_mux = &alc662_capture_source,
16899 [ALC662_LENOVO_101E] = {
16900 .mixers = { alc662_lenovo_101e_mixer },
16901 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16902 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16903 .dac_nids = alc662_dac_nids,
16904 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16905 .channel_mode = alc662_3ST_2ch_modes,
16906 .input_mux = &alc662_lenovo_101e_capture_source,
16907 .unsol_event = alc662_lenovo_101e_unsol_event,
16908 .init_hook = alc662_lenovo_101e_all_automute,
16910 [ALC662_ASUS_EEEPC_P701] = {
16911 .mixers = { alc662_eeepc_p701_mixer },
16912 .init_verbs = { alc662_init_verbs,
16913 alc662_eeepc_sue_init_verbs },
16914 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16915 .dac_nids = alc662_dac_nids,
16916 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16917 .channel_mode = alc662_3ST_2ch_modes,
16918 .input_mux = &alc662_eeepc_capture_source,
16919 .unsol_event = alc662_eeepc_unsol_event,
16920 .init_hook = alc662_eeepc_inithook,
16922 [ALC662_ASUS_EEEPC_EP20] = {
16923 .mixers = { alc662_eeepc_ep20_mixer,
16924 alc662_chmode_mixer },
16925 .init_verbs = { alc662_init_verbs,
16926 alc662_eeepc_ep20_sue_init_verbs },
16927 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16928 .dac_nids = alc662_dac_nids,
16929 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16930 .channel_mode = alc662_3ST_6ch_modes,
16931 .input_mux = &alc662_lenovo_101e_capture_source,
16932 .unsol_event = alc662_eeepc_unsol_event,
16933 .init_hook = alc662_eeepc_ep20_inithook,
16936 .mixers = { alc662_ecs_mixer },
16937 .init_verbs = { alc662_init_verbs,
16938 alc662_ecs_init_verbs },
16939 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16940 .dac_nids = alc662_dac_nids,
16941 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16942 .channel_mode = alc662_3ST_2ch_modes,
16943 .input_mux = &alc662_eeepc_capture_source,
16944 .unsol_event = alc662_eeepc_unsol_event,
16945 .init_hook = alc662_eeepc_inithook,
16947 [ALC663_ASUS_M51VA] = {
16948 .mixers = { alc663_m51va_mixer },
16949 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16950 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16951 .dac_nids = alc662_dac_nids,
16952 .dig_out_nid = ALC662_DIGOUT_NID,
16953 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16954 .channel_mode = alc662_3ST_2ch_modes,
16955 .input_mux = &alc663_m51va_capture_source,
16956 .unsol_event = alc663_m51va_unsol_event,
16957 .init_hook = alc663_m51va_inithook,
16959 [ALC663_ASUS_G71V] = {
16960 .mixers = { alc663_g71v_mixer },
16961 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16962 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16963 .dac_nids = alc662_dac_nids,
16964 .dig_out_nid = ALC662_DIGOUT_NID,
16965 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16966 .channel_mode = alc662_3ST_2ch_modes,
16967 .input_mux = &alc662_eeepc_capture_source,
16968 .unsol_event = alc663_g71v_unsol_event,
16969 .init_hook = alc663_g71v_inithook,
16971 [ALC663_ASUS_H13] = {
16972 .mixers = { alc663_m51va_mixer },
16973 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16974 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16975 .dac_nids = alc662_dac_nids,
16976 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16977 .channel_mode = alc662_3ST_2ch_modes,
16978 .input_mux = &alc663_m51va_capture_source,
16979 .unsol_event = alc663_m51va_unsol_event,
16980 .init_hook = alc663_m51va_inithook,
16982 [ALC663_ASUS_G50V] = {
16983 .mixers = { alc663_g50v_mixer },
16984 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16985 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16986 .dac_nids = alc662_dac_nids,
16987 .dig_out_nid = ALC662_DIGOUT_NID,
16988 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16989 .channel_mode = alc662_3ST_6ch_modes,
16990 .input_mux = &alc663_capture_source,
16991 .unsol_event = alc663_g50v_unsol_event,
16992 .init_hook = alc663_g50v_inithook,
16994 [ALC663_ASUS_MODE1] = {
16995 .mixers = { alc663_m51va_mixer },
16996 .cap_mixer = alc662_auto_capture_mixer,
16997 .init_verbs = { alc662_init_verbs,
16998 alc663_21jd_amic_init_verbs },
16999 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17001 .dac_nids = alc662_dac_nids,
17002 .dig_out_nid = ALC662_DIGOUT_NID,
17003 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17004 .channel_mode = alc662_3ST_2ch_modes,
17005 .input_mux = &alc662_eeepc_capture_source,
17006 .unsol_event = alc663_mode1_unsol_event,
17007 .init_hook = alc663_mode1_inithook,
17009 [ALC662_ASUS_MODE2] = {
17010 .mixers = { alc662_1bjd_mixer },
17011 .cap_mixer = alc662_auto_capture_mixer,
17012 .init_verbs = { alc662_init_verbs,
17013 alc662_1bjd_amic_init_verbs },
17014 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17015 .dac_nids = alc662_dac_nids,
17016 .dig_out_nid = ALC662_DIGOUT_NID,
17017 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17018 .channel_mode = alc662_3ST_2ch_modes,
17019 .input_mux = &alc662_eeepc_capture_source,
17020 .unsol_event = alc662_mode2_unsol_event,
17021 .init_hook = alc662_mode2_inithook,
17023 [ALC663_ASUS_MODE3] = {
17024 .mixers = { alc663_two_hp_m1_mixer },
17025 .cap_mixer = alc662_auto_capture_mixer,
17026 .init_verbs = { alc662_init_verbs,
17027 alc663_two_hp_amic_m1_init_verbs },
17028 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17030 .dac_nids = alc662_dac_nids,
17031 .dig_out_nid = ALC662_DIGOUT_NID,
17032 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17033 .channel_mode = alc662_3ST_2ch_modes,
17034 .input_mux = &alc662_eeepc_capture_source,
17035 .unsol_event = alc663_mode3_unsol_event,
17036 .init_hook = alc663_mode3_inithook,
17038 [ALC663_ASUS_MODE4] = {
17039 .mixers = { alc663_asus_21jd_clfe_mixer },
17040 .cap_mixer = alc662_auto_capture_mixer,
17041 .init_verbs = { alc662_init_verbs,
17042 alc663_21jd_amic_init_verbs},
17043 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17045 .dac_nids = alc662_dac_nids,
17046 .dig_out_nid = ALC662_DIGOUT_NID,
17047 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17048 .channel_mode = alc662_3ST_2ch_modes,
17049 .input_mux = &alc662_eeepc_capture_source,
17050 .unsol_event = alc663_mode4_unsol_event,
17051 .init_hook = alc663_mode4_inithook,
17053 [ALC663_ASUS_MODE5] = {
17054 .mixers = { alc663_asus_15jd_clfe_mixer },
17055 .cap_mixer = alc662_auto_capture_mixer,
17056 .init_verbs = { alc662_init_verbs,
17057 alc663_15jd_amic_init_verbs },
17058 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17060 .dac_nids = alc662_dac_nids,
17061 .dig_out_nid = ALC662_DIGOUT_NID,
17062 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17063 .channel_mode = alc662_3ST_2ch_modes,
17064 .input_mux = &alc662_eeepc_capture_source,
17065 .unsol_event = alc663_mode5_unsol_event,
17066 .init_hook = alc663_mode5_inithook,
17068 [ALC663_ASUS_MODE6] = {
17069 .mixers = { alc663_two_hp_m2_mixer },
17070 .cap_mixer = alc662_auto_capture_mixer,
17071 .init_verbs = { alc662_init_verbs,
17072 alc663_two_hp_amic_m2_init_verbs },
17073 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17075 .dac_nids = alc662_dac_nids,
17076 .dig_out_nid = ALC662_DIGOUT_NID,
17077 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17078 .channel_mode = alc662_3ST_2ch_modes,
17079 .input_mux = &alc662_eeepc_capture_source,
17080 .unsol_event = alc663_mode6_unsol_event,
17081 .init_hook = alc663_mode6_inithook,
17084 .mixers = { alc663_m51va_mixer },
17085 .cap_mixer = alc272_auto_capture_mixer,
17086 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17087 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17088 .dac_nids = alc662_dac_nids,
17089 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17090 .adc_nids = alc272_adc_nids,
17091 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17092 .capsrc_nids = alc272_capsrc_nids,
17093 .channel_mode = alc662_3ST_2ch_modes,
17094 .input_mux = &alc663_m51va_capture_source,
17095 .unsol_event = alc663_m51va_unsol_event,
17096 .init_hook = alc663_m51va_inithook,
17098 [ALC272_DELL_ZM1] = {
17099 .mixers = { alc663_m51va_mixer },
17100 .cap_mixer = alc662_auto_capture_mixer,
17101 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17102 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17103 .dac_nids = alc662_dac_nids,
17104 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17105 .adc_nids = alc662_adc_nids,
17106 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
17107 .capsrc_nids = alc662_capsrc_nids,
17108 .channel_mode = alc662_3ST_2ch_modes,
17109 .input_mux = &alc663_m51va_capture_source,
17110 .unsol_event = alc663_m51va_unsol_event,
17111 .init_hook = alc663_m51va_inithook,
17113 [ALC272_SAMSUNG_NC10] = {
17114 .mixers = { alc272_nc10_mixer },
17115 .init_verbs = { alc662_init_verbs,
17116 alc663_21jd_amic_init_verbs },
17117 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17118 .dac_nids = alc272_dac_nids,
17119 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17120 .channel_mode = alc662_3ST_2ch_modes,
17121 .input_mux = &alc272_nc10_capture_source,
17122 .unsol_event = alc663_mode4_unsol_event,
17123 .init_hook = alc663_mode4_inithook,
17129 * BIOS auto configuration
17132 /* add playback controls from the parsed DAC table */
17133 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17134 const struct auto_pin_cfg *cfg)
17137 static const char *chname[4] = {
17138 "Front", "Surround", NULL /*CLFE*/, "Side"
17143 for (i = 0; i < cfg->line_outs; i++) {
17144 if (!spec->multiout.dac_nids[i])
17146 nid = alc880_idx_to_dac(i);
17149 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17150 "Center Playback Volume",
17151 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17155 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17156 "LFE Playback Volume",
17157 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17161 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17162 "Center Playback Switch",
17163 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17167 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17168 "LFE Playback Switch",
17169 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17174 sprintf(name, "%s Playback Volume", chname[i]);
17175 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17176 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17180 sprintf(name, "%s Playback Switch", chname[i]);
17181 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17182 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17191 /* add playback controls for speaker and HP outputs */
17192 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17203 /* ALC663 has a mono output pin on 0x17 */
17204 sprintf(name, "%s Playback Switch", pfx);
17205 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17206 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17210 if (alc880_is_fixed_pin(pin)) {
17211 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17212 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17213 /* specify the DAC as the extra output */
17214 if (!spec->multiout.hp_nid)
17215 spec->multiout.hp_nid = nid;
17217 spec->multiout.extra_out_nid[0] = nid;
17218 /* control HP volume/switch on the output mixer amp */
17219 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17220 sprintf(name, "%s Playback Volume", pfx);
17221 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17222 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17225 sprintf(name, "%s Playback Switch", pfx);
17226 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17227 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17230 } else if (alc880_is_multi_pin(pin)) {
17231 /* set manual connection */
17232 /* we have only a switch on HP-out PIN */
17233 sprintf(name, "%s Playback Switch", pfx);
17234 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17235 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17242 /* return the index of the src widget from the connection list of the nid.
17243 * return -1 if not found
17245 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
17248 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
17251 conns = snd_hda_get_connections(codec, nid, conn_list,
17252 ARRAY_SIZE(conn_list));
17255 for (i = 0; i < conns; i++)
17256 if (conn_list[i] == src)
17261 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17263 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17264 return (pincap & AC_PINCAP_IN) != 0;
17267 /* create playback/capture controls for input pins */
17268 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17269 const struct auto_pin_cfg *cfg)
17271 struct alc_spec *spec = codec->spec;
17272 struct hda_input_mux *imux = &spec->private_imux[0];
17275 for (i = 0; i < AUTO_PIN_LAST; i++) {
17276 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17277 idx = alc662_input_pin_idx(codec, 0x0b,
17278 cfg->input_pins[i]);
17280 err = new_analog_input(spec, cfg->input_pins[i],
17281 auto_pin_cfg_labels[i],
17286 idx = alc662_input_pin_idx(codec, 0x22,
17287 cfg->input_pins[i]);
17289 imux->items[imux->num_items].label =
17290 auto_pin_cfg_labels[i];
17291 imux->items[imux->num_items].index = idx;
17299 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17300 hda_nid_t nid, int pin_type,
17303 alc_set_pin_output(codec, nid, pin_type);
17304 /* need the manual connection? */
17305 if (alc880_is_multi_pin(nid)) {
17306 struct alc_spec *spec = codec->spec;
17307 int idx = alc880_multi_pin_idx(nid);
17308 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17309 AC_VERB_SET_CONNECT_SEL,
17310 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17314 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17316 struct alc_spec *spec = codec->spec;
17319 for (i = 0; i <= HDA_SIDE; i++) {
17320 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17321 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17323 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17328 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17330 struct alc_spec *spec = codec->spec;
17333 pin = spec->autocfg.hp_pins[0];
17334 if (pin) /* connect to front */
17336 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17337 pin = spec->autocfg.speaker_pins[0];
17339 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17342 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17344 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17346 struct alc_spec *spec = codec->spec;
17349 for (i = 0; i < AUTO_PIN_LAST; i++) {
17350 hda_nid_t nid = spec->autocfg.input_pins[i];
17351 if (alc662_is_input_pin(codec, nid)) {
17352 alc_set_input_pin(codec, nid, i);
17353 if (nid != ALC662_PIN_CD_NID &&
17354 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17355 snd_hda_codec_write(codec, nid, 0,
17356 AC_VERB_SET_AMP_GAIN_MUTE,
17362 #define alc662_auto_init_input_src alc882_auto_init_input_src
17364 static int alc662_parse_auto_config(struct hda_codec *codec)
17366 struct alc_spec *spec = codec->spec;
17368 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17370 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17374 if (!spec->autocfg.line_outs)
17375 return 0; /* can't find valid BIOS pin config */
17377 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17380 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17383 err = alc662_auto_create_extra_out(spec,
17384 spec->autocfg.speaker_pins[0],
17388 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17392 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17396 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17398 if (spec->autocfg.dig_outs)
17399 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17401 if (spec->kctls.list)
17402 add_mixer(spec, spec->kctls.list);
17404 spec->num_mux_defs = 1;
17405 spec->input_mux = &spec->private_imux[0];
17407 add_verb(spec, alc662_auto_init_verbs);
17408 if (codec->vendor_id == 0x10ec0663)
17409 add_verb(spec, alc663_auto_init_verbs);
17411 err = alc_auto_add_mic_boost(codec);
17415 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17420 /* additional initialization for auto-configuration model */
17421 static void alc662_auto_init(struct hda_codec *codec)
17423 struct alc_spec *spec = codec->spec;
17424 alc662_auto_init_multi_out(codec);
17425 alc662_auto_init_hp_out(codec);
17426 alc662_auto_init_analog_input(codec);
17427 alc662_auto_init_input_src(codec);
17428 if (spec->unsol_event)
17429 alc_inithook(codec);
17432 static int patch_alc662(struct hda_codec *codec)
17434 struct alc_spec *spec;
17435 int err, board_config;
17437 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17441 codec->spec = spec;
17443 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17445 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17448 if (board_config < 0) {
17449 printk(KERN_INFO "hda_codec: Unknown model for %s, "
17450 "trying auto-probe from BIOS...\n", codec->chip_name);
17451 board_config = ALC662_AUTO;
17454 if (board_config == ALC662_AUTO) {
17455 /* automatic parse from the BIOS config */
17456 err = alc662_parse_auto_config(codec);
17462 "hda_codec: Cannot set up configuration "
17463 "from BIOS. Using base mode...\n");
17464 board_config = ALC662_3ST_2ch_DIG;
17468 err = snd_hda_attach_beep_device(codec, 0x1);
17474 if (board_config != ALC662_AUTO)
17475 setup_preset(spec, &alc662_presets[board_config]);
17477 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17478 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17480 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17481 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17483 spec->adc_nids = alc662_adc_nids;
17484 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17485 spec->capsrc_nids = alc662_capsrc_nids;
17487 if (!spec->cap_mixer)
17488 set_capture_mixer(spec);
17489 if (codec->vendor_id == 0x10ec0662)
17490 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17492 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17494 spec->vmaster_nid = 0x02;
17496 codec->patch_ops = alc_patch_ops;
17497 if (board_config == ALC662_AUTO)
17498 spec->init_hook = alc662_auto_init;
17499 #ifdef CONFIG_SND_HDA_POWER_SAVE
17500 if (!spec->loopback.amplist)
17501 spec->loopback.amplist = alc662_loopbacks;
17503 codec->proc_widget_hook = print_realtek_coef;
17511 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17512 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17513 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17514 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17515 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17516 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17517 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17518 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17519 .patch = patch_alc861 },
17520 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17521 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17522 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17523 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17524 .patch = patch_alc883 },
17525 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17526 .patch = patch_alc662 },
17527 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17528 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17529 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17530 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17531 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17532 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17533 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17534 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17535 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17536 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17537 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17538 .patch = patch_alc883 },
17539 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17540 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17541 {} /* terminator */
17544 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17546 MODULE_LICENSE("GPL");
17547 MODULE_DESCRIPTION("Realtek HD-audio codec");
17549 static struct hda_codec_preset_list realtek_list = {
17550 .preset = snd_hda_preset_realtek,
17551 .owner = THIS_MODULE,
17554 static int __init patch_realtek_init(void)
17556 return snd_hda_add_codec_preset(&realtek_list);
17559 static void __exit patch_realtek_exit(void)
17561 snd_hda_delete_codec_preset(&realtek_list);
17564 module_init(patch_realtek_init)
17565 module_exit(patch_realtek_exit)