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 /* Front Mic: set to PIN_IN (empty by default) */
1480 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1481 /* Unselect Front Mic by default in input mixer 3 */
1482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1483 /* Enable unsolicited event for HP jack */
1484 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1485 /* Enable speaker output */
1486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1488 /* Enable headphone output */
1489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1491 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1496 * ALC889 Acer Aspire 8930G model
1499 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1500 /* Front Mic: set to PIN_IN (empty by default) */
1501 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1502 /* Unselect Front Mic by default in input mixer 3 */
1503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1504 /* Enable unsolicited event for HP jack */
1505 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1506 /* Connect Internal Front to Front */
1507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1510 /* Connect Internal Rear to Rear */
1511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1514 /* Connect Internal CLFE to CLFE */
1515 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1516 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1517 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1518 /* Connect HP out to Front */
1519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1522 /* Enable all DACs */
1523 /* DAC DISABLE/MUTE 1? */
1524 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1525 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1526 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1527 /* DAC DISABLE/MUTE 2? */
1528 /* some bit here disables the other DACs. Init=0x4900 */
1529 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1530 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1531 /* Enable amplifiers */
1532 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1533 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1535 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1536 * which makes the stereo useless. However, either the mic or the ALC889
1537 * makes the signal become a difference/sum signal instead of standard
1538 * stereo, which is annoying. So instead we flip this bit which makes the
1539 * codec replicate the sum signal to both channels, turning it into a
1542 /* DMIC_CONTROL? Init value = 0x0001 */
1543 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1544 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1548 static struct hda_input_mux alc888_2_capture_sources[2] = {
1549 /* Front mic only available on one ADC */
1556 { "Front Mic", 0xb },
1569 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1570 /* Interal mic only available on one ADC */
1588 static struct hda_input_mux alc889_capture_sources[3] = {
1589 /* Digital mic only available on first "ADC" */
1596 { "Front Mic", 0xb },
1597 { "Input Mix", 0xa },
1606 { "Input Mix", 0xa },
1615 { "Input Mix", 0xa },
1620 static struct snd_kcontrol_new alc888_base_mixer[] = {
1621 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1622 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1623 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1624 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1625 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1627 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1628 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1629 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1630 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1631 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1632 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1633 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1634 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1635 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1637 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1642 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1644 struct alc_spec *spec = codec->spec;
1646 spec->autocfg.hp_pins[0] = 0x15;
1647 spec->autocfg.speaker_pins[0] = 0x14;
1648 alc_automute_amp(codec);
1651 static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec)
1653 struct alc_spec *spec = codec->spec;
1655 spec->autocfg.hp_pins[0] = 0x15;
1656 spec->autocfg.speaker_pins[0] = 0x14;
1657 spec->autocfg.speaker_pins[1] = 0x16;
1658 spec->autocfg.speaker_pins[2] = 0x17;
1659 alc_automute_amp(codec);
1662 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1664 struct alc_spec *spec = codec->spec;
1666 spec->autocfg.hp_pins[0] = 0x15;
1667 spec->autocfg.speaker_pins[0] = 0x14;
1668 spec->autocfg.speaker_pins[1] = 0x16;
1669 spec->autocfg.speaker_pins[2] = 0x1b;
1670 alc_automute_amp(codec);
1674 * ALC880 3-stack model
1676 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1677 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1678 * F-Mic = 0x1b, HP = 0x19
1681 static hda_nid_t alc880_dac_nids[4] = {
1682 /* front, rear, clfe, rear_surr */
1683 0x02, 0x05, 0x04, 0x03
1686 static hda_nid_t alc880_adc_nids[3] = {
1691 /* The datasheet says the node 0x07 is connected from inputs,
1692 * but it shows zero connection in the real implementation on some devices.
1693 * Note: this is a 915GAV bug, fixed on 915GLV
1695 static hda_nid_t alc880_adc_nids_alt[2] = {
1700 #define ALC880_DIGOUT_NID 0x06
1701 #define ALC880_DIGIN_NID 0x0a
1703 static struct hda_input_mux alc880_capture_source = {
1707 { "Front Mic", 0x3 },
1713 /* channel source setting (2/6 channel selection for 3-stack) */
1715 static struct hda_verb alc880_threestack_ch2_init[] = {
1716 /* set line-in to input, mute it */
1717 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1718 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1719 /* set mic-in to input vref 80%, mute it */
1720 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1721 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1726 static struct hda_verb alc880_threestack_ch6_init[] = {
1727 /* set line-in to output, unmute it */
1728 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1729 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1730 /* set mic-in to output, unmute it */
1731 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1732 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1736 static struct hda_channel_mode alc880_threestack_modes[2] = {
1737 { 2, alc880_threestack_ch2_init },
1738 { 6, alc880_threestack_ch6_init },
1741 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1742 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1743 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1744 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1745 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1746 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1747 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1748 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1749 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1750 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1751 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1752 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1753 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1754 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1756 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1757 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1760 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1761 .name = "Channel Mode",
1762 .info = alc_ch_mode_info,
1763 .get = alc_ch_mode_get,
1764 .put = alc_ch_mode_put,
1769 /* capture mixer elements */
1770 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1771 struct snd_ctl_elem_info *uinfo)
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_volume_info(kcontrol, uinfo);
1781 mutex_unlock(&codec->control_mutex);
1785 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1786 unsigned int size, unsigned int __user *tlv)
1788 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1789 struct alc_spec *spec = codec->spec;
1792 mutex_lock(&codec->control_mutex);
1793 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1795 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1796 mutex_unlock(&codec->control_mutex);
1800 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1801 struct snd_ctl_elem_value *ucontrol);
1803 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1804 struct snd_ctl_elem_value *ucontrol,
1807 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1808 struct alc_spec *spec = codec->spec;
1809 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1812 mutex_lock(&codec->control_mutex);
1813 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1815 err = func(kcontrol, ucontrol);
1816 mutex_unlock(&codec->control_mutex);
1820 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1821 struct snd_ctl_elem_value *ucontrol)
1823 return alc_cap_getput_caller(kcontrol, ucontrol,
1824 snd_hda_mixer_amp_volume_get);
1827 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1828 struct snd_ctl_elem_value *ucontrol)
1830 return alc_cap_getput_caller(kcontrol, ucontrol,
1831 snd_hda_mixer_amp_volume_put);
1834 /* capture mixer elements */
1835 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1837 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1838 struct snd_ctl_elem_value *ucontrol)
1840 return alc_cap_getput_caller(kcontrol, ucontrol,
1841 snd_hda_mixer_amp_switch_get);
1844 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1845 struct snd_ctl_elem_value *ucontrol)
1847 return alc_cap_getput_caller(kcontrol, ucontrol,
1848 snd_hda_mixer_amp_switch_put);
1851 #define _DEFINE_CAPMIX(num) \
1853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1854 .name = "Capture Switch", \
1855 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1857 .info = alc_cap_sw_info, \
1858 .get = alc_cap_sw_get, \
1859 .put = alc_cap_sw_put, \
1862 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1863 .name = "Capture Volume", \
1864 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1865 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1866 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1868 .info = alc_cap_vol_info, \
1869 .get = alc_cap_vol_get, \
1870 .put = alc_cap_vol_put, \
1871 .tlv = { .c = alc_cap_vol_tlv }, \
1874 #define _DEFINE_CAPSRC(num) \
1876 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1877 /* .name = "Capture Source", */ \
1878 .name = "Input Source", \
1880 .info = alc_mux_enum_info, \
1881 .get = alc_mux_enum_get, \
1882 .put = alc_mux_enum_put, \
1885 #define DEFINE_CAPMIX(num) \
1886 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1887 _DEFINE_CAPMIX(num), \
1888 _DEFINE_CAPSRC(num), \
1892 #define DEFINE_CAPMIX_NOSRC(num) \
1893 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1894 _DEFINE_CAPMIX(num), \
1898 /* up to three ADCs */
1902 DEFINE_CAPMIX_NOSRC(1);
1903 DEFINE_CAPMIX_NOSRC(2);
1904 DEFINE_CAPMIX_NOSRC(3);
1907 * ALC880 5-stack model
1909 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1911 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1912 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1915 /* additional mixers to alc880_three_stack_mixer */
1916 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1917 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1918 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1922 /* channel source setting (6/8 channel selection for 5-stack) */
1924 static struct hda_verb alc880_fivestack_ch6_init[] = {
1925 /* set line-in to input, mute it */
1926 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1927 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1932 static struct hda_verb alc880_fivestack_ch8_init[] = {
1933 /* set line-in to output, unmute it */
1934 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1935 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1939 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1940 { 6, alc880_fivestack_ch6_init },
1941 { 8, alc880_fivestack_ch8_init },
1946 * ALC880 6-stack model
1948 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1949 * Side = 0x05 (0x0f)
1950 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1951 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1954 static hda_nid_t alc880_6st_dac_nids[4] = {
1955 /* front, rear, clfe, rear_surr */
1956 0x02, 0x03, 0x04, 0x05
1959 static struct hda_input_mux alc880_6stack_capture_source = {
1963 { "Front Mic", 0x1 },
1969 /* fixed 8-channels */
1970 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1974 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1975 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1976 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1977 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1978 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1979 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1980 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1981 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1982 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1983 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1984 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1985 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1986 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1992 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1995 .name = "Channel Mode",
1996 .info = alc_ch_mode_info,
1997 .get = alc_ch_mode_get,
1998 .put = alc_ch_mode_put,
2007 * W810 has rear IO for:
2010 * Center/LFE (DAC 04)
2013 * The system also has a pair of internal speakers, and a headphone jack.
2014 * These are both connected to Line2 on the codec, hence to DAC 02.
2016 * There is a variable resistor to control the speaker or headphone
2017 * volume. This is a hardware-only device without a software API.
2019 * Plugging headphones in will disable the internal speakers. This is
2020 * implemented in hardware, not via the driver using jack sense. In
2021 * a similar fashion, plugging into the rear socket marked "front" will
2022 * disable both the speakers and headphones.
2024 * For input, there's a microphone jack, and an "audio in" jack.
2025 * These may not do anything useful with this driver yet, because I
2026 * haven't setup any initialization verbs for these yet...
2029 static hda_nid_t alc880_w810_dac_nids[3] = {
2030 /* front, rear/surround, clfe */
2034 /* fixed 6 channels */
2035 static struct hda_channel_mode alc880_w810_modes[1] = {
2039 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2040 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2041 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2043 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2044 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2045 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2046 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2047 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2048 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2057 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2058 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2062 static hda_nid_t alc880_z71v_dac_nids[1] = {
2065 #define ALC880_Z71V_HP_DAC 0x03
2067 /* fixed 2 channels */
2068 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2072 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2073 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2074 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2075 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2076 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2077 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2078 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2086 * ALC880 F1734 model
2088 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2089 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2092 static hda_nid_t alc880_f1734_dac_nids[1] = {
2095 #define ALC880_F1734_HP_DAC 0x02
2097 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2099 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2100 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2101 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2102 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2103 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2109 static struct hda_input_mux alc880_f1734_capture_source = {
2121 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2122 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2123 * Mic = 0x18, Line = 0x1a
2126 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2127 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2129 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2130 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2133 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2136 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2137 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2145 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2146 .name = "Channel Mode",
2147 .info = alc_ch_mode_info,
2148 .get = alc_ch_mode_get,
2149 .put = alc_ch_mode_put,
2155 * ALC880 ASUS W1V model
2157 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2158 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2159 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2162 /* additional mixers to alc880_asus_mixer */
2163 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2164 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2165 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2170 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2171 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2172 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2174 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2175 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2178 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2179 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2184 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2185 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2186 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2187 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2188 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2189 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2190 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2191 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2192 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2193 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2194 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2202 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2203 .name = "Channel Mode",
2204 .info = alc_ch_mode_info,
2205 .get = alc_ch_mode_get,
2206 .put = alc_ch_mode_put,
2211 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2212 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2213 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2214 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2215 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2218 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2219 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2220 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2221 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2225 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2227 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2228 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2229 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2236 * virtual master controls
2240 * slave controls for virtual master
2242 static const char *alc_slave_vols[] = {
2243 "Front Playback Volume",
2244 "Surround Playback Volume",
2245 "Center Playback Volume",
2246 "LFE Playback Volume",
2247 "Side Playback Volume",
2248 "Headphone Playback Volume",
2249 "Speaker Playback Volume",
2250 "Mono Playback Volume",
2251 "Line-Out Playback Volume",
2252 "PCM Playback Volume",
2256 static const char *alc_slave_sws[] = {
2257 "Front Playback Switch",
2258 "Surround Playback Switch",
2259 "Center Playback Switch",
2260 "LFE Playback Switch",
2261 "Side Playback Switch",
2262 "Headphone Playback Switch",
2263 "Speaker Playback Switch",
2264 "Mono Playback Switch",
2265 "IEC958 Playback Switch",
2270 * build control elements
2273 static void alc_free_kctls(struct hda_codec *codec);
2275 /* additional beep mixers; the actual parameters are overwritten at build */
2276 static struct snd_kcontrol_new alc_beep_mixer[] = {
2277 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2278 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2282 static int alc_build_controls(struct hda_codec *codec)
2284 struct alc_spec *spec = codec->spec;
2288 for (i = 0; i < spec->num_mixers; i++) {
2289 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2293 if (spec->cap_mixer) {
2294 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2298 if (spec->multiout.dig_out_nid) {
2299 err = snd_hda_create_spdif_out_ctls(codec,
2300 spec->multiout.dig_out_nid);
2303 if (!spec->no_analog) {
2304 err = snd_hda_create_spdif_share_sw(codec,
2308 spec->multiout.share_spdif = 1;
2311 if (spec->dig_in_nid) {
2312 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2317 /* create beep controls if needed */
2318 if (spec->beep_amp) {
2319 struct snd_kcontrol_new *knew;
2320 for (knew = alc_beep_mixer; knew->name; knew++) {
2321 struct snd_kcontrol *kctl;
2322 kctl = snd_ctl_new1(knew, codec);
2325 kctl->private_value = spec->beep_amp;
2326 err = snd_hda_ctl_add(codec, kctl);
2332 /* if we have no master control, let's create it */
2333 if (!spec->no_analog &&
2334 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2335 unsigned int vmaster_tlv[4];
2336 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2337 HDA_OUTPUT, vmaster_tlv);
2338 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2339 vmaster_tlv, alc_slave_vols);
2343 if (!spec->no_analog &&
2344 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2345 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2346 NULL, alc_slave_sws);
2351 alc_free_kctls(codec); /* no longer needed */
2357 * initialize the codec volumes, etc
2361 * generic initialization of ADC, input mixers and output mixers
2363 static struct hda_verb alc880_volume_init_verbs[] = {
2365 * Unmute ADC0-2 and set the default input to mic-in
2367 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2369 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2371 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2372 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2374 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2376 * Note: PASD motherboards uses the Line In 2 as the input for front
2379 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2382 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2389 * Set up output mixers (0x0c - 0x0f)
2391 /* set vol=0 to output mixers */
2392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2393 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2395 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2396 /* set up input amps for analog loopback */
2397 /* Amp Indices: DAC = 0, mixer = 1 */
2398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2401 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2402 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2404 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2405 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2411 * 3-stack pin configuration:
2412 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2414 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2416 * preset connection lists of input pins
2417 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2419 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2420 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2421 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2424 * Set pin mode and muting
2426 /* set front pin widgets 0x14 for output */
2427 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2428 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2429 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2432 /* Mic2 (as headphone out) for HP output */
2433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2434 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2435 /* Line In pin widget for input */
2436 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2437 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2438 /* Line2 (as front mic) pin widget for input and vref at 80% */
2439 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2440 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2441 /* CD pin widget for input */
2442 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2448 * 5-stack pin configuration:
2449 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2450 * line-in/side = 0x1a, f-mic = 0x1b
2452 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2454 * preset connection lists of input pins
2455 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2457 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2458 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2461 * Set pin mode and muting
2463 /* set pin widgets 0x14-0x17 for output */
2464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2466 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2467 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2468 /* unmute pins for output (no gain on this amp) */
2469 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2471 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2472 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2474 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2475 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2476 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2477 /* Mic2 (as headphone out) for HP output */
2478 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2479 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2480 /* Line In pin widget for input */
2481 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2483 /* Line2 (as front mic) pin widget for input and vref at 80% */
2484 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2485 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2486 /* CD pin widget for input */
2487 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2493 * W810 pin configuration:
2494 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2496 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2497 /* hphone/speaker input selector: front DAC */
2498 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2503 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2504 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2505 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2514 * Z71V pin configuration:
2515 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2517 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2518 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2519 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2520 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2521 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2523 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2524 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2525 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2526 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2532 * 6-stack pin configuration:
2533 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2534 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2536 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2537 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2539 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2540 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2541 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2543 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2544 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2545 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2546 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2548 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2549 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2550 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2551 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2552 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2553 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2554 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2555 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2556 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2562 * Uniwill pin configuration:
2563 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2566 static struct hda_verb alc880_uniwill_init_verbs[] = {
2567 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2570 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2571 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2572 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2573 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2574 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2575 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2576 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2580 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2581 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2582 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2584 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2585 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2586 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2587 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2588 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2589 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2590 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2591 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2592 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2594 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2595 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2602 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2604 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2605 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2607 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2608 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2611 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2612 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2621 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2622 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2623 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2627 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2628 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2633 static struct hda_verb alc880_beep_init_verbs[] = {
2634 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2638 /* auto-toggle front mic */
2639 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2641 unsigned int present;
2644 present = snd_hda_codec_read(codec, 0x18, 0,
2645 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2646 bits = present ? HDA_AMP_MUTE : 0;
2647 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2650 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2652 struct alc_spec *spec = codec->spec;
2654 spec->autocfg.hp_pins[0] = 0x14;
2655 spec->autocfg.speaker_pins[0] = 0x15;
2656 spec->autocfg.speaker_pins[0] = 0x16;
2657 alc_automute_amp(codec);
2658 alc880_uniwill_mic_automute(codec);
2661 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2664 /* Looks like the unsol event is incompatible with the standard
2665 * definition. 4bit tag is placed at 28 bit!
2667 switch (res >> 28) {
2668 case ALC880_MIC_EVENT:
2669 alc880_uniwill_mic_automute(codec);
2672 alc_automute_amp_unsol_event(codec, res);
2677 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2679 struct alc_spec *spec = codec->spec;
2681 spec->autocfg.hp_pins[0] = 0x14;
2682 spec->autocfg.speaker_pins[0] = 0x15;
2683 alc_automute_amp(codec);
2686 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2688 unsigned int present;
2690 present = snd_hda_codec_read(codec, 0x21, 0,
2691 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2692 present &= HDA_AMP_VOLMASK;
2693 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2694 HDA_AMP_VOLMASK, present);
2695 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2696 HDA_AMP_VOLMASK, present);
2699 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2702 /* Looks like the unsol event is incompatible with the standard
2703 * definition. 4bit tag is placed at 28 bit!
2705 if ((res >> 28) == ALC880_DCVOL_EVENT)
2706 alc880_uniwill_p53_dcvol_automute(codec);
2708 alc_automute_amp_unsol_event(codec, res);
2712 * F1734 pin configuration:
2713 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2715 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2716 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2717 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2718 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2719 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2720 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2722 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2723 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2725 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2727 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2729 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2731 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2732 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2734 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2735 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2737 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2738 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2744 * ASUS pin configuration:
2745 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2747 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2748 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2749 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2750 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2751 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2757 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2759 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2765 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2775 /* Enable GPIO mask and set output */
2776 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2777 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2778 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2780 /* Clevo m520g init */
2781 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2782 /* headphone output */
2783 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2788 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2791 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2792 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2793 /* Mic1 (rear panel) */
2794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2796 /* Mic2 (front panel) */
2797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 /* change to EAPD mode */
2803 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2804 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2809 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2810 /* change to EAPD mode */
2811 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2812 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2814 /* Headphone output */
2815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2817 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2818 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2820 /* Line In pin widget for input */
2821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2822 /* CD pin widget for input */
2823 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2824 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2825 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2827 /* change to EAPD mode */
2828 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2829 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2835 * LG m1 express dual
2838 * Rear Line-In/Out (blue): 0x14
2839 * Build-in Mic-In: 0x15
2841 * HP-Out (green): 0x1b
2842 * Mic-In/Out (red): 0x19
2846 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2847 static hda_nid_t alc880_lg_dac_nids[3] = {
2851 /* seems analog CD is not working */
2852 static struct hda_input_mux alc880_lg_capture_source = {
2857 { "Internal Mic", 0x6 },
2861 /* 2,4,6 channel modes */
2862 static struct hda_verb alc880_lg_ch2_init[] = {
2863 /* set line-in and mic-in to input */
2864 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2865 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2869 static struct hda_verb alc880_lg_ch4_init[] = {
2870 /* set line-in to out and mic-in to input */
2871 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2872 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2876 static struct hda_verb alc880_lg_ch6_init[] = {
2877 /* set line-in and mic-in to output */
2878 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2879 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2883 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2884 { 2, alc880_lg_ch2_init },
2885 { 4, alc880_lg_ch4_init },
2886 { 6, alc880_lg_ch6_init },
2889 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2890 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2891 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2892 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2893 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2894 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2895 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2896 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2897 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2902 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2903 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2905 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2906 .name = "Channel Mode",
2907 .info = alc_ch_mode_info,
2908 .get = alc_ch_mode_get,
2909 .put = alc_ch_mode_put,
2914 static struct hda_verb alc880_lg_init_verbs[] = {
2915 /* set capture source to mic-in */
2916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2918 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2919 /* mute all amp mixer inputs */
2920 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2923 /* line-in to input */
2924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2925 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2930 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2931 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2932 /* mic-in to input */
2933 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2934 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2937 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2938 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2939 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2941 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2945 /* toggle speaker-output according to the hp-jack state */
2946 static void alc880_lg_init_hook(struct hda_codec *codec)
2948 struct alc_spec *spec = codec->spec;
2950 spec->autocfg.hp_pins[0] = 0x1b;
2951 spec->autocfg.speaker_pins[0] = 0x17;
2952 alc_automute_amp(codec);
2961 * Built-in Mic-In: 0x19
2967 static struct hda_input_mux alc880_lg_lw_capture_source = {
2971 { "Internal Mic", 0x1 },
2976 #define alc880_lg_lw_modes alc880_threestack_modes
2978 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2980 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2982 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2983 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2985 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2986 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2991 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2992 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2995 .name = "Channel Mode",
2996 .info = alc_ch_mode_info,
2997 .get = alc_ch_mode_get,
2998 .put = alc_ch_mode_put,
3003 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3004 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3005 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3006 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3008 /* set capture source to mic-in */
3009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3010 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3014 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3015 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3017 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3018 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3019 /* mic-in to input */
3020 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3021 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3023 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3024 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3026 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3030 /* toggle speaker-output according to the hp-jack state */
3031 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3033 struct alc_spec *spec = codec->spec;
3035 spec->autocfg.hp_pins[0] = 0x1b;
3036 spec->autocfg.speaker_pins[0] = 0x14;
3037 alc_automute_amp(codec);
3040 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3041 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3042 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3045 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3046 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3050 static struct hda_input_mux alc880_medion_rim_capture_source = {
3054 { "Internal Mic", 0x1 },
3058 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3059 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3062 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3065 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3066 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3067 /* Mic2 (as headphone out) for HP output */
3068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3070 /* Internal Speaker */
3071 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3072 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3074 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3075 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3077 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3081 /* toggle speaker-output according to the hp-jack state */
3082 static void alc880_medion_rim_automute(struct hda_codec *codec)
3084 struct alc_spec *spec = codec->spec;
3085 alc_automute_amp(codec);
3087 if (spec->jack_present)
3088 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3090 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3093 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3096 /* Looks like the unsol event is incompatible with the standard
3097 * definition. 4bit tag is placed at 28 bit!
3099 if ((res >> 28) == ALC880_HP_EVENT)
3100 alc880_medion_rim_automute(codec);
3103 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3105 struct alc_spec *spec = codec->spec;
3107 spec->autocfg.hp_pins[0] = 0x14;
3108 spec->autocfg.speaker_pins[0] = 0x1b;
3109 alc880_medion_rim_automute(codec);
3112 #ifdef CONFIG_SND_HDA_POWER_SAVE
3113 static struct hda_amp_list alc880_loopbacks[] = {
3114 { 0x0b, HDA_INPUT, 0 },
3115 { 0x0b, HDA_INPUT, 1 },
3116 { 0x0b, HDA_INPUT, 2 },
3117 { 0x0b, HDA_INPUT, 3 },
3118 { 0x0b, HDA_INPUT, 4 },
3122 static struct hda_amp_list alc880_lg_loopbacks[] = {
3123 { 0x0b, HDA_INPUT, 1 },
3124 { 0x0b, HDA_INPUT, 6 },
3125 { 0x0b, HDA_INPUT, 7 },
3134 static int alc_init(struct hda_codec *codec)
3136 struct alc_spec *spec = codec->spec;
3140 alc_auto_init_amp(codec, spec->init_amp);
3142 for (i = 0; i < spec->num_init_verbs; i++)
3143 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3145 if (spec->init_hook)
3146 spec->init_hook(codec);
3151 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3153 struct alc_spec *spec = codec->spec;
3155 if (spec->unsol_event)
3156 spec->unsol_event(codec, res);
3159 #ifdef CONFIG_SND_HDA_POWER_SAVE
3160 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3162 struct alc_spec *spec = codec->spec;
3163 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3168 * Analog playback callbacks
3170 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3171 struct hda_codec *codec,
3172 struct snd_pcm_substream *substream)
3174 struct alc_spec *spec = codec->spec;
3175 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3179 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3180 struct hda_codec *codec,
3181 unsigned int stream_tag,
3182 unsigned int format,
3183 struct snd_pcm_substream *substream)
3185 struct alc_spec *spec = codec->spec;
3186 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3187 stream_tag, format, substream);
3190 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3191 struct hda_codec *codec,
3192 struct snd_pcm_substream *substream)
3194 struct alc_spec *spec = codec->spec;
3195 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3201 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3202 struct hda_codec *codec,
3203 struct snd_pcm_substream *substream)
3205 struct alc_spec *spec = codec->spec;
3206 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3209 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3210 struct hda_codec *codec,
3211 unsigned int stream_tag,
3212 unsigned int format,
3213 struct snd_pcm_substream *substream)
3215 struct alc_spec *spec = codec->spec;
3216 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3217 stream_tag, format, substream);
3220 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3221 struct hda_codec *codec,
3222 struct snd_pcm_substream *substream)
3224 struct alc_spec *spec = codec->spec;
3225 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3228 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3229 struct hda_codec *codec,
3230 struct snd_pcm_substream *substream)
3232 struct alc_spec *spec = codec->spec;
3233 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3239 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3240 struct hda_codec *codec,
3241 unsigned int stream_tag,
3242 unsigned int format,
3243 struct snd_pcm_substream *substream)
3245 struct alc_spec *spec = codec->spec;
3247 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3248 stream_tag, 0, format);
3252 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3253 struct hda_codec *codec,
3254 struct snd_pcm_substream *substream)
3256 struct alc_spec *spec = codec->spec;
3258 snd_hda_codec_cleanup_stream(codec,
3259 spec->adc_nids[substream->number + 1]);
3266 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3270 /* NID is set in alc_build_pcms */
3272 .open = alc880_playback_pcm_open,
3273 .prepare = alc880_playback_pcm_prepare,
3274 .cleanup = alc880_playback_pcm_cleanup
3278 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3282 /* NID is set in alc_build_pcms */
3285 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3289 /* NID is set in alc_build_pcms */
3292 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3293 .substreams = 2, /* can be overridden */
3296 /* NID is set in alc_build_pcms */
3298 .prepare = alc880_alt_capture_pcm_prepare,
3299 .cleanup = alc880_alt_capture_pcm_cleanup
3303 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3307 /* NID is set in alc_build_pcms */
3309 .open = alc880_dig_playback_pcm_open,
3310 .close = alc880_dig_playback_pcm_close,
3311 .prepare = alc880_dig_playback_pcm_prepare,
3312 .cleanup = alc880_dig_playback_pcm_cleanup
3316 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3320 /* NID is set in alc_build_pcms */
3323 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3324 static struct hda_pcm_stream alc_pcm_null_stream = {
3330 static int alc_build_pcms(struct hda_codec *codec)
3332 struct alc_spec *spec = codec->spec;
3333 struct hda_pcm *info = spec->pcm_rec;
3336 codec->num_pcms = 1;
3337 codec->pcm_info = info;
3339 if (spec->no_analog)
3342 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3343 "%s Analog", codec->chip_name);
3344 info->name = spec->stream_name_analog;
3346 if (spec->stream_analog_playback) {
3347 if (snd_BUG_ON(!spec->multiout.dac_nids))
3349 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3350 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3352 if (spec->stream_analog_capture) {
3353 if (snd_BUG_ON(!spec->adc_nids))
3355 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3356 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3359 if (spec->channel_mode) {
3360 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3361 for (i = 0; i < spec->num_channel_mode; i++) {
3362 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3363 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3369 /* SPDIF for stream index #1 */
3370 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3371 snprintf(spec->stream_name_digital,
3372 sizeof(spec->stream_name_digital),
3373 "%s Digital", codec->chip_name);
3374 codec->num_pcms = 2;
3375 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3376 info = spec->pcm_rec + 1;
3377 info->name = spec->stream_name_digital;
3378 if (spec->dig_out_type)
3379 info->pcm_type = spec->dig_out_type;
3381 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3382 if (spec->multiout.dig_out_nid &&
3383 spec->stream_digital_playback) {
3384 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3385 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3387 if (spec->dig_in_nid &&
3388 spec->stream_digital_capture) {
3389 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3390 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3392 /* FIXME: do we need this for all Realtek codec models? */
3393 codec->spdif_status_reset = 1;
3396 if (spec->no_analog)
3399 /* If the use of more than one ADC is requested for the current
3400 * model, configure a second analog capture-only PCM.
3402 /* Additional Analaog capture for index #2 */
3403 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3404 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3405 codec->num_pcms = 3;
3406 info = spec->pcm_rec + 2;
3407 info->name = spec->stream_name_analog;
3408 if (spec->alt_dac_nid) {
3409 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3410 *spec->stream_analog_alt_playback;
3411 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3414 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3415 alc_pcm_null_stream;
3416 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3418 if (spec->num_adc_nids > 1) {
3419 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3420 *spec->stream_analog_alt_capture;
3421 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3423 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3424 spec->num_adc_nids - 1;
3426 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3427 alc_pcm_null_stream;
3428 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3435 static void alc_free_kctls(struct hda_codec *codec)
3437 struct alc_spec *spec = codec->spec;
3439 if (spec->kctls.list) {
3440 struct snd_kcontrol_new *kctl = spec->kctls.list;
3442 for (i = 0; i < spec->kctls.used; i++)
3443 kfree(kctl[i].name);
3445 snd_array_free(&spec->kctls);
3448 static void alc_free(struct hda_codec *codec)
3450 struct alc_spec *spec = codec->spec;
3455 alc_free_kctls(codec);
3457 snd_hda_detach_beep_device(codec);
3460 #ifdef SND_HDA_NEEDS_RESUME
3461 static int alc_resume(struct hda_codec *codec)
3463 codec->patch_ops.init(codec);
3464 snd_hda_codec_resume_amp(codec);
3465 snd_hda_codec_resume_cache(codec);
3472 static struct hda_codec_ops alc_patch_ops = {
3473 .build_controls = alc_build_controls,
3474 .build_pcms = alc_build_pcms,
3477 .unsol_event = alc_unsol_event,
3478 #ifdef SND_HDA_NEEDS_RESUME
3479 .resume = alc_resume,
3481 #ifdef CONFIG_SND_HDA_POWER_SAVE
3482 .check_power_status = alc_check_power_status,
3488 * Test configuration for debugging
3490 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3493 #ifdef CONFIG_SND_DEBUG
3494 static hda_nid_t alc880_test_dac_nids[4] = {
3495 0x02, 0x03, 0x04, 0x05
3498 static struct hda_input_mux alc880_test_capture_source = {
3507 { "Surround", 0x6 },
3511 static struct hda_channel_mode alc880_test_modes[4] = {
3518 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3519 struct snd_ctl_elem_info *uinfo)
3521 static char *texts[] = {
3522 "N/A", "Line Out", "HP Out",
3523 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3525 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3527 uinfo->value.enumerated.items = 8;
3528 if (uinfo->value.enumerated.item >= 8)
3529 uinfo->value.enumerated.item = 7;
3530 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3534 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3535 struct snd_ctl_elem_value *ucontrol)
3537 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3538 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3539 unsigned int pin_ctl, item = 0;
3541 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3542 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3543 if (pin_ctl & AC_PINCTL_OUT_EN) {
3544 if (pin_ctl & AC_PINCTL_HP_EN)
3548 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3549 switch (pin_ctl & AC_PINCTL_VREFEN) {
3550 case AC_PINCTL_VREF_HIZ: item = 3; break;
3551 case AC_PINCTL_VREF_50: item = 4; break;
3552 case AC_PINCTL_VREF_GRD: item = 5; break;
3553 case AC_PINCTL_VREF_80: item = 6; break;
3554 case AC_PINCTL_VREF_100: item = 7; break;
3557 ucontrol->value.enumerated.item[0] = item;
3561 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3562 struct snd_ctl_elem_value *ucontrol)
3564 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3565 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3566 static unsigned int ctls[] = {
3567 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3568 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3569 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3570 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3571 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3572 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3574 unsigned int old_ctl, new_ctl;
3576 old_ctl = snd_hda_codec_read(codec, nid, 0,
3577 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3578 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3579 if (old_ctl != new_ctl) {
3581 snd_hda_codec_write_cache(codec, nid, 0,
3582 AC_VERB_SET_PIN_WIDGET_CONTROL,
3584 val = ucontrol->value.enumerated.item[0] >= 3 ?
3586 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3593 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3594 struct snd_ctl_elem_info *uinfo)
3596 static char *texts[] = {
3597 "Front", "Surround", "CLFE", "Side"
3599 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3601 uinfo->value.enumerated.items = 4;
3602 if (uinfo->value.enumerated.item >= 4)
3603 uinfo->value.enumerated.item = 3;
3604 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3608 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3609 struct snd_ctl_elem_value *ucontrol)
3611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3612 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3615 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3616 ucontrol->value.enumerated.item[0] = sel & 3;
3620 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3621 struct snd_ctl_elem_value *ucontrol)
3623 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3624 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3627 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3628 if (ucontrol->value.enumerated.item[0] != sel) {
3629 sel = ucontrol->value.enumerated.item[0] & 3;
3630 snd_hda_codec_write_cache(codec, nid, 0,
3631 AC_VERB_SET_CONNECT_SEL, sel);
3637 #define PIN_CTL_TEST(xname,nid) { \
3638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3640 .info = alc_test_pin_ctl_info, \
3641 .get = alc_test_pin_ctl_get, \
3642 .put = alc_test_pin_ctl_put, \
3643 .private_value = nid \
3646 #define PIN_SRC_TEST(xname,nid) { \
3647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3649 .info = alc_test_pin_src_info, \
3650 .get = alc_test_pin_src_get, \
3651 .put = alc_test_pin_src_put, \
3652 .private_value = nid \
3655 static struct snd_kcontrol_new alc880_test_mixer[] = {
3656 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3658 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3659 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3660 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3661 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3662 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3663 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3664 PIN_CTL_TEST("Front Pin Mode", 0x14),
3665 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3666 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3667 PIN_CTL_TEST("Side Pin Mode", 0x17),
3668 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3669 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3670 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3671 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3672 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3673 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3674 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3675 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3676 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3677 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3678 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3679 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3680 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3681 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3682 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3683 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3684 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3685 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3687 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3688 .name = "Channel Mode",
3689 .info = alc_ch_mode_info,
3690 .get = alc_ch_mode_get,
3691 .put = alc_ch_mode_put,
3696 static struct hda_verb alc880_test_init_verbs[] = {
3697 /* Unmute inputs of 0x0c - 0x0f */
3698 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3699 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3700 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3703 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3704 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3705 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3706 /* Vol output for 0x0c-0x0f */
3707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3708 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3709 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3710 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3711 /* Set output pins 0x14-0x17 */
3712 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3713 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3714 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3715 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3716 /* Unmute output pins 0x14-0x17 */
3717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3719 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3721 /* Set input pins 0x18-0x1c */
3722 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3723 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3724 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3725 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3726 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3727 /* Mute input pins 0x18-0x1b */
3728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3729 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3730 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3731 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3734 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3736 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3737 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3738 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3739 /* Analog input/passthru */
3740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3741 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3744 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3752 static const char *alc880_models[ALC880_MODEL_LAST] = {
3753 [ALC880_3ST] = "3stack",
3754 [ALC880_TCL_S700] = "tcl",
3755 [ALC880_3ST_DIG] = "3stack-digout",
3756 [ALC880_CLEVO] = "clevo",
3757 [ALC880_5ST] = "5stack",
3758 [ALC880_5ST_DIG] = "5stack-digout",
3759 [ALC880_W810] = "w810",
3760 [ALC880_Z71V] = "z71v",
3761 [ALC880_6ST] = "6stack",
3762 [ALC880_6ST_DIG] = "6stack-digout",
3763 [ALC880_ASUS] = "asus",
3764 [ALC880_ASUS_W1V] = "asus-w1v",
3765 [ALC880_ASUS_DIG] = "asus-dig",
3766 [ALC880_ASUS_DIG2] = "asus-dig2",
3767 [ALC880_UNIWILL_DIG] = "uniwill",
3768 [ALC880_UNIWILL_P53] = "uniwill-p53",
3769 [ALC880_FUJITSU] = "fujitsu",
3770 [ALC880_F1734] = "F1734",
3772 [ALC880_LG_LW] = "lg-lw",
3773 [ALC880_MEDION_RIM] = "medion",
3774 #ifdef CONFIG_SND_DEBUG
3775 [ALC880_TEST] = "test",
3777 [ALC880_AUTO] = "auto",
3780 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3781 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3782 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3783 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3784 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3785 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3786 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3787 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3788 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3789 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3790 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3791 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3792 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3793 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3794 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3795 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3796 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3797 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3798 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3799 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3800 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3801 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3802 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3803 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3804 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3805 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3806 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3807 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3808 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3809 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3810 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3811 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3812 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3813 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3814 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3815 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3816 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3817 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3818 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3819 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3820 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3821 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3822 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3823 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3824 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3825 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3826 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3827 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3828 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3829 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3830 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3831 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3832 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3833 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3834 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3835 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3836 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3837 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3838 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3839 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3840 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3841 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3842 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3843 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3844 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3845 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3846 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3847 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3848 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3850 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3851 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3852 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3857 * ALC880 codec presets
3859 static struct alc_config_preset alc880_presets[] = {
3861 .mixers = { alc880_three_stack_mixer },
3862 .init_verbs = { alc880_volume_init_verbs,
3863 alc880_pin_3stack_init_verbs },
3864 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3865 .dac_nids = alc880_dac_nids,
3866 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3867 .channel_mode = alc880_threestack_modes,
3869 .input_mux = &alc880_capture_source,
3871 [ALC880_3ST_DIG] = {
3872 .mixers = { alc880_three_stack_mixer },
3873 .init_verbs = { alc880_volume_init_verbs,
3874 alc880_pin_3stack_init_verbs },
3875 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3876 .dac_nids = alc880_dac_nids,
3877 .dig_out_nid = ALC880_DIGOUT_NID,
3878 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3879 .channel_mode = alc880_threestack_modes,
3881 .input_mux = &alc880_capture_source,
3883 [ALC880_TCL_S700] = {
3884 .mixers = { alc880_tcl_s700_mixer },
3885 .init_verbs = { alc880_volume_init_verbs,
3886 alc880_pin_tcl_S700_init_verbs,
3887 alc880_gpio2_init_verbs },
3888 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3889 .dac_nids = alc880_dac_nids,
3890 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3891 .num_adc_nids = 1, /* single ADC */
3893 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3894 .channel_mode = alc880_2_jack_modes,
3895 .input_mux = &alc880_capture_source,
3898 .mixers = { alc880_three_stack_mixer,
3899 alc880_five_stack_mixer},
3900 .init_verbs = { alc880_volume_init_verbs,
3901 alc880_pin_5stack_init_verbs },
3902 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3903 .dac_nids = alc880_dac_nids,
3904 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3905 .channel_mode = alc880_fivestack_modes,
3906 .input_mux = &alc880_capture_source,
3908 [ALC880_5ST_DIG] = {
3909 .mixers = { alc880_three_stack_mixer,
3910 alc880_five_stack_mixer },
3911 .init_verbs = { alc880_volume_init_verbs,
3912 alc880_pin_5stack_init_verbs },
3913 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3914 .dac_nids = alc880_dac_nids,
3915 .dig_out_nid = ALC880_DIGOUT_NID,
3916 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3917 .channel_mode = alc880_fivestack_modes,
3918 .input_mux = &alc880_capture_source,
3921 .mixers = { alc880_six_stack_mixer },
3922 .init_verbs = { alc880_volume_init_verbs,
3923 alc880_pin_6stack_init_verbs },
3924 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3925 .dac_nids = alc880_6st_dac_nids,
3926 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3927 .channel_mode = alc880_sixstack_modes,
3928 .input_mux = &alc880_6stack_capture_source,
3930 [ALC880_6ST_DIG] = {
3931 .mixers = { alc880_six_stack_mixer },
3932 .init_verbs = { alc880_volume_init_verbs,
3933 alc880_pin_6stack_init_verbs },
3934 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3935 .dac_nids = alc880_6st_dac_nids,
3936 .dig_out_nid = ALC880_DIGOUT_NID,
3937 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3938 .channel_mode = alc880_sixstack_modes,
3939 .input_mux = &alc880_6stack_capture_source,
3942 .mixers = { alc880_w810_base_mixer },
3943 .init_verbs = { alc880_volume_init_verbs,
3944 alc880_pin_w810_init_verbs,
3945 alc880_gpio2_init_verbs },
3946 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3947 .dac_nids = alc880_w810_dac_nids,
3948 .dig_out_nid = ALC880_DIGOUT_NID,
3949 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3950 .channel_mode = alc880_w810_modes,
3951 .input_mux = &alc880_capture_source,
3954 .mixers = { alc880_z71v_mixer },
3955 .init_verbs = { alc880_volume_init_verbs,
3956 alc880_pin_z71v_init_verbs },
3957 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3958 .dac_nids = alc880_z71v_dac_nids,
3959 .dig_out_nid = ALC880_DIGOUT_NID,
3961 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3962 .channel_mode = alc880_2_jack_modes,
3963 .input_mux = &alc880_capture_source,
3966 .mixers = { alc880_f1734_mixer },
3967 .init_verbs = { alc880_volume_init_verbs,
3968 alc880_pin_f1734_init_verbs },
3969 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3970 .dac_nids = alc880_f1734_dac_nids,
3972 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3973 .channel_mode = alc880_2_jack_modes,
3974 .input_mux = &alc880_f1734_capture_source,
3975 .unsol_event = alc880_uniwill_p53_unsol_event,
3976 .init_hook = alc880_uniwill_p53_init_hook,
3979 .mixers = { alc880_asus_mixer },
3980 .init_verbs = { alc880_volume_init_verbs,
3981 alc880_pin_asus_init_verbs,
3982 alc880_gpio1_init_verbs },
3983 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3984 .dac_nids = alc880_asus_dac_nids,
3985 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3986 .channel_mode = alc880_asus_modes,
3988 .input_mux = &alc880_capture_source,
3990 [ALC880_ASUS_DIG] = {
3991 .mixers = { alc880_asus_mixer },
3992 .init_verbs = { alc880_volume_init_verbs,
3993 alc880_pin_asus_init_verbs,
3994 alc880_gpio1_init_verbs },
3995 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3996 .dac_nids = alc880_asus_dac_nids,
3997 .dig_out_nid = ALC880_DIGOUT_NID,
3998 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3999 .channel_mode = alc880_asus_modes,
4001 .input_mux = &alc880_capture_source,
4003 [ALC880_ASUS_DIG2] = {
4004 .mixers = { alc880_asus_mixer },
4005 .init_verbs = { alc880_volume_init_verbs,
4006 alc880_pin_asus_init_verbs,
4007 alc880_gpio2_init_verbs }, /* use GPIO2 */
4008 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4009 .dac_nids = alc880_asus_dac_nids,
4010 .dig_out_nid = ALC880_DIGOUT_NID,
4011 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4012 .channel_mode = alc880_asus_modes,
4014 .input_mux = &alc880_capture_source,
4016 [ALC880_ASUS_W1V] = {
4017 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4018 .init_verbs = { alc880_volume_init_verbs,
4019 alc880_pin_asus_init_verbs,
4020 alc880_gpio1_init_verbs },
4021 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4022 .dac_nids = alc880_asus_dac_nids,
4023 .dig_out_nid = ALC880_DIGOUT_NID,
4024 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4025 .channel_mode = alc880_asus_modes,
4027 .input_mux = &alc880_capture_source,
4029 [ALC880_UNIWILL_DIG] = {
4030 .mixers = { alc880_asus_mixer },
4031 .init_verbs = { alc880_volume_init_verbs,
4032 alc880_pin_asus_init_verbs },
4033 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4034 .dac_nids = alc880_asus_dac_nids,
4035 .dig_out_nid = ALC880_DIGOUT_NID,
4036 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4037 .channel_mode = alc880_asus_modes,
4039 .input_mux = &alc880_capture_source,
4041 [ALC880_UNIWILL] = {
4042 .mixers = { alc880_uniwill_mixer },
4043 .init_verbs = { alc880_volume_init_verbs,
4044 alc880_uniwill_init_verbs },
4045 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4046 .dac_nids = alc880_asus_dac_nids,
4047 .dig_out_nid = ALC880_DIGOUT_NID,
4048 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4049 .channel_mode = alc880_threestack_modes,
4051 .input_mux = &alc880_capture_source,
4052 .unsol_event = alc880_uniwill_unsol_event,
4053 .init_hook = alc880_uniwill_init_hook,
4055 [ALC880_UNIWILL_P53] = {
4056 .mixers = { alc880_uniwill_p53_mixer },
4057 .init_verbs = { alc880_volume_init_verbs,
4058 alc880_uniwill_p53_init_verbs },
4059 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4060 .dac_nids = alc880_asus_dac_nids,
4061 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4062 .channel_mode = alc880_threestack_modes,
4063 .input_mux = &alc880_capture_source,
4064 .unsol_event = alc880_uniwill_p53_unsol_event,
4065 .init_hook = alc880_uniwill_p53_init_hook,
4067 [ALC880_FUJITSU] = {
4068 .mixers = { alc880_fujitsu_mixer },
4069 .init_verbs = { alc880_volume_init_verbs,
4070 alc880_uniwill_p53_init_verbs,
4071 alc880_beep_init_verbs },
4072 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4073 .dac_nids = alc880_dac_nids,
4074 .dig_out_nid = ALC880_DIGOUT_NID,
4075 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4076 .channel_mode = alc880_2_jack_modes,
4077 .input_mux = &alc880_capture_source,
4078 .unsol_event = alc880_uniwill_p53_unsol_event,
4079 .init_hook = alc880_uniwill_p53_init_hook,
4082 .mixers = { alc880_three_stack_mixer },
4083 .init_verbs = { alc880_volume_init_verbs,
4084 alc880_pin_clevo_init_verbs },
4085 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4086 .dac_nids = alc880_dac_nids,
4088 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4089 .channel_mode = alc880_threestack_modes,
4091 .input_mux = &alc880_capture_source,
4094 .mixers = { alc880_lg_mixer },
4095 .init_verbs = { alc880_volume_init_verbs,
4096 alc880_lg_init_verbs },
4097 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4098 .dac_nids = alc880_lg_dac_nids,
4099 .dig_out_nid = ALC880_DIGOUT_NID,
4100 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4101 .channel_mode = alc880_lg_ch_modes,
4103 .input_mux = &alc880_lg_capture_source,
4104 .unsol_event = alc_automute_amp_unsol_event,
4105 .init_hook = alc880_lg_init_hook,
4106 #ifdef CONFIG_SND_HDA_POWER_SAVE
4107 .loopbacks = alc880_lg_loopbacks,
4111 .mixers = { alc880_lg_lw_mixer },
4112 .init_verbs = { alc880_volume_init_verbs,
4113 alc880_lg_lw_init_verbs },
4114 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4115 .dac_nids = alc880_dac_nids,
4116 .dig_out_nid = ALC880_DIGOUT_NID,
4117 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4118 .channel_mode = alc880_lg_lw_modes,
4119 .input_mux = &alc880_lg_lw_capture_source,
4120 .unsol_event = alc_automute_amp_unsol_event,
4121 .init_hook = alc880_lg_lw_init_hook,
4123 [ALC880_MEDION_RIM] = {
4124 .mixers = { alc880_medion_rim_mixer },
4125 .init_verbs = { alc880_volume_init_verbs,
4126 alc880_medion_rim_init_verbs,
4127 alc_gpio2_init_verbs },
4128 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4129 .dac_nids = alc880_dac_nids,
4130 .dig_out_nid = ALC880_DIGOUT_NID,
4131 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4132 .channel_mode = alc880_2_jack_modes,
4133 .input_mux = &alc880_medion_rim_capture_source,
4134 .unsol_event = alc880_medion_rim_unsol_event,
4135 .init_hook = alc880_medion_rim_init_hook,
4137 #ifdef CONFIG_SND_DEBUG
4139 .mixers = { alc880_test_mixer },
4140 .init_verbs = { alc880_test_init_verbs },
4141 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4142 .dac_nids = alc880_test_dac_nids,
4143 .dig_out_nid = ALC880_DIGOUT_NID,
4144 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4145 .channel_mode = alc880_test_modes,
4146 .input_mux = &alc880_test_capture_source,
4152 * Automatic parse of I/O pins from the BIOS configuration
4157 ALC_CTL_WIDGET_MUTE,
4160 static struct snd_kcontrol_new alc880_control_templates[] = {
4161 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4162 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4163 HDA_BIND_MUTE(NULL, 0, 0, 0),
4166 /* add dynamic controls */
4167 static int add_control(struct alc_spec *spec, int type, const char *name,
4170 struct snd_kcontrol_new *knew;
4172 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4173 knew = snd_array_new(&spec->kctls);
4176 *knew = alc880_control_templates[type];
4177 knew->name = kstrdup(name, GFP_KERNEL);
4180 knew->private_value = val;
4184 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4185 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4186 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4187 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4188 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4189 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4190 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4191 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4192 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4193 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4194 #define ALC880_PIN_CD_NID 0x1c
4196 /* fill in the dac_nids table from the parsed pin configuration */
4197 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4198 const struct auto_pin_cfg *cfg)
4204 memset(assigned, 0, sizeof(assigned));
4205 spec->multiout.dac_nids = spec->private_dac_nids;
4207 /* check the pins hardwired to audio widget */
4208 for (i = 0; i < cfg->line_outs; i++) {
4209 nid = cfg->line_out_pins[i];
4210 if (alc880_is_fixed_pin(nid)) {
4211 int idx = alc880_fixed_pin_idx(nid);
4212 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4216 /* left pins can be connect to any audio widget */
4217 for (i = 0; i < cfg->line_outs; i++) {
4218 nid = cfg->line_out_pins[i];
4219 if (alc880_is_fixed_pin(nid))
4221 /* search for an empty channel */
4222 for (j = 0; j < cfg->line_outs; j++) {
4224 spec->multiout.dac_nids[i] =
4225 alc880_idx_to_dac(j);
4231 spec->multiout.num_dacs = cfg->line_outs;
4235 /* add playback controls from the parsed DAC table */
4236 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4237 const struct auto_pin_cfg *cfg)
4240 static const char *chname[4] = {
4241 "Front", "Surround", NULL /*CLFE*/, "Side"
4246 for (i = 0; i < cfg->line_outs; i++) {
4247 if (!spec->multiout.dac_nids[i])
4249 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4252 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4253 "Center Playback Volume",
4254 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4258 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4259 "LFE Playback Volume",
4260 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4264 err = add_control(spec, ALC_CTL_BIND_MUTE,
4265 "Center Playback Switch",
4266 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4270 err = add_control(spec, ALC_CTL_BIND_MUTE,
4271 "LFE Playback Switch",
4272 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4277 sprintf(name, "%s Playback Volume", chname[i]);
4278 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4279 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4283 sprintf(name, "%s Playback Switch", chname[i]);
4284 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4285 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4294 /* add playback controls for speaker and HP outputs */
4295 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4305 if (alc880_is_fixed_pin(pin)) {
4306 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4307 /* specify the DAC as the extra output */
4308 if (!spec->multiout.hp_nid)
4309 spec->multiout.hp_nid = nid;
4311 spec->multiout.extra_out_nid[0] = nid;
4312 /* control HP volume/switch on the output mixer amp */
4313 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4314 sprintf(name, "%s Playback Volume", pfx);
4315 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4316 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4319 sprintf(name, "%s Playback Switch", pfx);
4320 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4321 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4324 } else if (alc880_is_multi_pin(pin)) {
4325 /* set manual connection */
4326 /* we have only a switch on HP-out PIN */
4327 sprintf(name, "%s Playback Switch", pfx);
4328 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4329 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4336 /* create input playback/capture controls for the given pin */
4337 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4338 const char *ctlname,
4339 int idx, hda_nid_t mix_nid)
4344 sprintf(name, "%s Playback Volume", ctlname);
4345 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4346 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4349 sprintf(name, "%s Playback Switch", ctlname);
4350 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4351 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4357 /* create playback/capture controls for input pins */
4358 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4359 const struct auto_pin_cfg *cfg)
4361 struct hda_input_mux *imux = &spec->private_imux[0];
4364 for (i = 0; i < AUTO_PIN_LAST; i++) {
4365 if (alc880_is_input_pin(cfg->input_pins[i])) {
4366 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4367 err = new_analog_input(spec, cfg->input_pins[i],
4368 auto_pin_cfg_labels[i],
4372 imux->items[imux->num_items].label =
4373 auto_pin_cfg_labels[i];
4374 imux->items[imux->num_items].index =
4375 alc880_input_pin_idx(cfg->input_pins[i]);
4382 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4383 unsigned int pin_type)
4385 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4388 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4392 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4393 hda_nid_t nid, int pin_type,
4396 alc_set_pin_output(codec, nid, pin_type);
4397 /* need the manual connection? */
4398 if (alc880_is_multi_pin(nid)) {
4399 struct alc_spec *spec = codec->spec;
4400 int idx = alc880_multi_pin_idx(nid);
4401 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4402 AC_VERB_SET_CONNECT_SEL,
4403 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4407 static int get_pin_type(int line_out_type)
4409 if (line_out_type == AUTO_PIN_HP_OUT)
4415 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4417 struct alc_spec *spec = codec->spec;
4420 for (i = 0; i < spec->autocfg.line_outs; i++) {
4421 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4422 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4423 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4427 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4429 struct alc_spec *spec = codec->spec;
4432 pin = spec->autocfg.speaker_pins[0];
4433 if (pin) /* connect to front */
4434 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4435 pin = spec->autocfg.hp_pins[0];
4436 if (pin) /* connect to front */
4437 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4440 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4442 struct alc_spec *spec = codec->spec;
4445 for (i = 0; i < AUTO_PIN_LAST; i++) {
4446 hda_nid_t nid = spec->autocfg.input_pins[i];
4447 if (alc880_is_input_pin(nid)) {
4448 alc_set_input_pin(codec, nid, i);
4449 if (nid != ALC880_PIN_CD_NID &&
4450 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4451 snd_hda_codec_write(codec, nid, 0,
4452 AC_VERB_SET_AMP_GAIN_MUTE,
4458 /* parse the BIOS configuration and set up the alc_spec */
4459 /* return 1 if successful, 0 if the proper config is not found,
4460 * or a negative error code
4462 static int alc880_parse_auto_config(struct hda_codec *codec)
4464 struct alc_spec *spec = codec->spec;
4466 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4468 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4472 if (!spec->autocfg.line_outs)
4473 return 0; /* can't find valid BIOS pin config */
4475 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4478 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4481 err = alc880_auto_create_extra_out(spec,
4482 spec->autocfg.speaker_pins[0],
4486 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4490 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4494 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4496 /* check multiple SPDIF-out (for recent codecs) */
4497 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4499 err = snd_hda_get_connections(codec,
4500 spec->autocfg.dig_out_pins[i],
4505 spec->multiout.dig_out_nid = dig_nid;
4507 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4508 spec->slave_dig_outs[i - 1] = dig_nid;
4509 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4513 if (spec->autocfg.dig_in_pin)
4514 spec->dig_in_nid = ALC880_DIGIN_NID;
4516 if (spec->kctls.list)
4517 add_mixer(spec, spec->kctls.list);
4519 add_verb(spec, alc880_volume_init_verbs);
4521 spec->num_mux_defs = 1;
4522 spec->input_mux = &spec->private_imux[0];
4524 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4529 /* additional initialization for auto-configuration model */
4530 static void alc880_auto_init(struct hda_codec *codec)
4532 struct alc_spec *spec = codec->spec;
4533 alc880_auto_init_multi_out(codec);
4534 alc880_auto_init_extra_out(codec);
4535 alc880_auto_init_analog_input(codec);
4536 if (spec->unsol_event)
4537 alc_inithook(codec);
4540 static void set_capture_mixer(struct alc_spec *spec)
4542 static struct snd_kcontrol_new *caps[2][3] = {
4543 { alc_capture_mixer_nosrc1,
4544 alc_capture_mixer_nosrc2,
4545 alc_capture_mixer_nosrc3 },
4546 { alc_capture_mixer1,
4548 alc_capture_mixer3 },
4550 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4552 if (spec->input_mux && spec->input_mux->num_items > 1)
4556 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4560 #define set_beep_amp(spec, nid, idx, dir) \
4561 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4564 * OK, here we have finally the patch for ALC880
4567 static int patch_alc880(struct hda_codec *codec)
4569 struct alc_spec *spec;
4573 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4579 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4582 if (board_config < 0) {
4583 printk(KERN_INFO "hda_codec: Unknown model for %s, "
4584 "trying auto-probe from BIOS...\n", codec->chip_name);
4585 board_config = ALC880_AUTO;
4588 if (board_config == ALC880_AUTO) {
4589 /* automatic parse from the BIOS config */
4590 err = alc880_parse_auto_config(codec);
4596 "hda_codec: Cannot set up configuration "
4597 "from BIOS. Using 3-stack mode...\n");
4598 board_config = ALC880_3ST;
4602 err = snd_hda_attach_beep_device(codec, 0x1);
4608 if (board_config != ALC880_AUTO)
4609 setup_preset(spec, &alc880_presets[board_config]);
4611 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4612 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4613 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4615 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4616 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4618 if (!spec->adc_nids && spec->input_mux) {
4619 /* check whether NID 0x07 is valid */
4620 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4622 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4623 if (wcap != AC_WID_AUD_IN) {
4624 spec->adc_nids = alc880_adc_nids_alt;
4625 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4627 spec->adc_nids = alc880_adc_nids;
4628 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4631 set_capture_mixer(spec);
4632 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4634 spec->vmaster_nid = 0x0c;
4636 codec->patch_ops = alc_patch_ops;
4637 if (board_config == ALC880_AUTO)
4638 spec->init_hook = alc880_auto_init;
4639 #ifdef CONFIG_SND_HDA_POWER_SAVE
4640 if (!spec->loopback.amplist)
4641 spec->loopback.amplist = alc880_loopbacks;
4643 codec->proc_widget_hook = print_realtek_coef;
4653 static hda_nid_t alc260_dac_nids[1] = {
4658 static hda_nid_t alc260_adc_nids[1] = {
4663 static hda_nid_t alc260_adc_nids_alt[1] = {
4668 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4669 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4671 static hda_nid_t alc260_dual_adc_nids[2] = {
4676 #define ALC260_DIGOUT_NID 0x03
4677 #define ALC260_DIGIN_NID 0x06
4679 static struct hda_input_mux alc260_capture_source = {
4683 { "Front Mic", 0x1 },
4689 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4690 * headphone jack and the internal CD lines since these are the only pins at
4691 * which audio can appear. For flexibility, also allow the option of
4692 * recording the mixer output on the second ADC (ADC0 doesn't have a
4693 * connection to the mixer output).
4695 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4699 { "Mic/Line", 0x0 },
4701 { "Headphone", 0x2 },
4707 { "Mic/Line", 0x0 },
4709 { "Headphone", 0x2 },
4716 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4717 * the Fujitsu S702x, but jacks are marked differently.
4719 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4726 { "Headphone", 0x5 },
4735 { "Headphone", 0x6 },
4741 /* Maxdata Favorit 100XS */
4742 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4746 { "Line/Mic", 0x0 },
4753 { "Line/Mic", 0x0 },
4761 * This is just place-holder, so there's something for alc_build_pcms to look
4762 * at when it calculates the maximum number of channels. ALC260 has no mixer
4763 * element which allows changing the channel mode, so the verb list is
4766 static struct hda_channel_mode alc260_modes[1] = {
4771 /* Mixer combinations
4773 * basic: base_output + input + pc_beep + capture
4774 * HP: base_output + input + capture_alt
4775 * HP_3013: hp_3013 + input + capture
4776 * fujitsu: fujitsu + capture
4777 * acer: acer + capture
4780 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4781 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4782 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4783 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4784 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4785 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4786 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4790 static struct snd_kcontrol_new alc260_input_mixer[] = {
4791 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4792 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4793 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4794 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4796 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4797 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4798 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4802 /* update HP, line and mono out pins according to the master switch */
4803 static void alc260_hp_master_update(struct hda_codec *codec,
4804 hda_nid_t hp, hda_nid_t line,
4807 struct alc_spec *spec = codec->spec;
4808 unsigned int val = spec->master_sw ? PIN_HP : 0;
4809 /* change HP and line-out pins */
4810 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4812 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4814 /* mono (speaker) depending on the HP jack sense */
4815 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4816 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4820 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4821 struct snd_ctl_elem_value *ucontrol)
4823 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4824 struct alc_spec *spec = codec->spec;
4825 *ucontrol->value.integer.value = spec->master_sw;
4829 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4830 struct snd_ctl_elem_value *ucontrol)
4832 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4833 struct alc_spec *spec = codec->spec;
4834 int val = !!*ucontrol->value.integer.value;
4835 hda_nid_t hp, line, mono;
4837 if (val == spec->master_sw)
4839 spec->master_sw = val;
4840 hp = (kcontrol->private_value >> 16) & 0xff;
4841 line = (kcontrol->private_value >> 8) & 0xff;
4842 mono = kcontrol->private_value & 0xff;
4843 alc260_hp_master_update(codec, hp, line, mono);
4847 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4849 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4850 .name = "Master Playback Switch",
4851 .info = snd_ctl_boolean_mono_info,
4852 .get = alc260_hp_master_sw_get,
4853 .put = alc260_hp_master_sw_put,
4854 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4856 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4857 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4858 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4859 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4860 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4862 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4866 static struct hda_verb alc260_hp_unsol_verbs[] = {
4867 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4871 static void alc260_hp_automute(struct hda_codec *codec)
4873 struct alc_spec *spec = codec->spec;
4874 unsigned int present;
4876 present = snd_hda_codec_read(codec, 0x10, 0,
4877 AC_VERB_GET_PIN_SENSE, 0);
4878 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4879 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4882 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4884 if ((res >> 26) == ALC880_HP_EVENT)
4885 alc260_hp_automute(codec);
4888 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4890 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4891 .name = "Master Playback Switch",
4892 .info = snd_ctl_boolean_mono_info,
4893 .get = alc260_hp_master_sw_get,
4894 .put = alc260_hp_master_sw_put,
4895 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4897 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4898 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4899 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4900 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4901 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4903 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4904 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4908 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4909 .ops = &snd_hda_bind_vol,
4911 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4912 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4913 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4918 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4919 .ops = &snd_hda_bind_sw,
4921 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4922 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4927 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4928 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4929 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4930 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4931 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4935 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4936 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4940 static void alc260_hp_3013_automute(struct hda_codec *codec)
4942 struct alc_spec *spec = codec->spec;
4943 unsigned int present;
4945 present = snd_hda_codec_read(codec, 0x15, 0,
4946 AC_VERB_GET_PIN_SENSE, 0);
4947 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4948 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4951 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4954 if ((res >> 26) == ALC880_HP_EVENT)
4955 alc260_hp_3013_automute(codec);
4958 static void alc260_hp_3012_automute(struct hda_codec *codec)
4960 unsigned int present, bits;
4962 present = snd_hda_codec_read(codec, 0x10, 0,
4963 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4965 bits = present ? 0 : PIN_OUT;
4966 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4968 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4970 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4974 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4977 if ((res >> 26) == ALC880_HP_EVENT)
4978 alc260_hp_3012_automute(codec);
4981 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4982 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4984 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4985 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4986 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4987 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4988 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4989 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4990 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4991 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4992 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4993 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4994 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4998 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4999 * versions of the ALC260 don't act on requests to enable mic bias from NID
5000 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5001 * datasheet doesn't mention this restriction. At this stage it's not clear
5002 * whether this behaviour is intentional or is a hardware bug in chip
5003 * revisions available in early 2006. Therefore for now allow the
5004 * "Headphone Jack Mode" control to span all choices, but if it turns out
5005 * that the lack of mic bias for this NID is intentional we could change the
5006 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5008 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5009 * don't appear to make the mic bias available from the "line" jack, even
5010 * though the NID used for this jack (0x14) can supply it. The theory is
5011 * that perhaps Acer have included blocking capacitors between the ALC260
5012 * and the output jack. If this turns out to be the case for all such
5013 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5014 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5016 * The C20x Tablet series have a mono internal speaker which is controlled
5017 * via the chip's Mono sum widget and pin complex, so include the necessary
5018 * controls for such models. On models without a "mono speaker" the control
5019 * won't do anything.
5021 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5022 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5023 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5024 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5025 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5027 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5029 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5030 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5032 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5033 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5034 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5035 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5036 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5040 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5042 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5043 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5044 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5045 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5046 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5047 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5048 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5052 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5053 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5055 static struct snd_kcontrol_new alc260_will_mixer[] = {
5056 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5057 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5059 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5060 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5061 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5062 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5063 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5064 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5065 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5069 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5070 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5072 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5073 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5074 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5076 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5077 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5078 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5079 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5080 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5081 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5082 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5087 * initialization verbs
5089 static struct hda_verb alc260_init_verbs[] = {
5090 /* Line In pin widget for input */
5091 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5092 /* CD pin widget for input */
5093 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5094 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5095 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5096 /* Mic2 (front panel) pin widget for input and vref at 80% */
5097 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5098 /* LINE-2 is used for line-out in rear */
5099 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5100 /* select line-out */
5101 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5103 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5105 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5107 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5108 /* mute capture amp left and right */
5109 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5110 /* set connection select to line in (default select for this ADC) */
5111 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5112 /* mute capture amp left and right */
5113 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5114 /* set connection select to line in (default select for this ADC) */
5115 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5116 /* set vol=0 Line-Out mixer amp left and right */
5117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5118 /* unmute pin widget amp left and right (no gain on this amp) */
5119 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5120 /* set vol=0 HP mixer amp left and right */
5121 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5122 /* unmute pin widget amp left and right (no gain on this amp) */
5123 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5124 /* set vol=0 Mono mixer amp left and right */
5125 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5126 /* unmute pin widget amp left and right (no gain on this amp) */
5127 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5128 /* unmute LINE-2 out pin */
5129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5130 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5133 /* mute analog inputs */
5134 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5135 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5136 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5138 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5139 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5140 /* mute Front out path */
5141 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5143 /* mute Headphone out path */
5144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5146 /* mute Mono out path */
5147 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5148 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5152 #if 0 /* should be identical with alc260_init_verbs? */
5153 static struct hda_verb alc260_hp_init_verbs[] = {
5154 /* Headphone and output */
5155 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5157 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5158 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5159 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5160 /* Mic2 (front panel) pin widget for input and vref at 80% */
5161 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5162 /* Line In pin widget for input */
5163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5164 /* Line-2 pin widget for output */
5165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5166 /* CD pin widget for input */
5167 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5168 /* unmute amp left and right */
5169 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5170 /* set connection select to line in (default select for this ADC) */
5171 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5172 /* unmute Line-Out mixer amp left and right (volume = 0) */
5173 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5174 /* mute pin widget amp left and right (no gain on this amp) */
5175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5176 /* unmute HP mixer amp left and right (volume = 0) */
5177 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5178 /* mute pin widget amp left and right (no gain on this amp) */
5179 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5180 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5183 /* mute analog inputs */
5184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5189 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5190 /* Unmute Front out path */
5191 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5192 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5193 /* Unmute Headphone out path */
5194 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5195 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5196 /* Unmute Mono out path */
5197 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5198 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5203 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5204 /* Line out and output */
5205 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5207 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5208 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5209 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5210 /* Mic2 (front panel) pin widget for input and vref at 80% */
5211 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5212 /* Line In pin widget for input */
5213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5214 /* Headphone pin widget for output */
5215 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5216 /* CD pin widget for input */
5217 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5218 /* unmute amp left and right */
5219 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5220 /* set connection select to line in (default select for this ADC) */
5221 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5222 /* unmute Line-Out mixer amp left and right (volume = 0) */
5223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5224 /* mute pin widget amp left and right (no gain on this amp) */
5225 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5226 /* unmute HP mixer amp left and right (volume = 0) */
5227 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5228 /* mute pin widget amp left and right (no gain on this amp) */
5229 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5230 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5233 /* mute analog inputs */
5234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5239 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5240 /* Unmute Front out path */
5241 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5243 /* Unmute Headphone out path */
5244 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5245 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5246 /* Unmute Mono out path */
5247 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5248 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5252 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5253 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5254 * audio = 0x16, internal speaker = 0x10.
5256 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5257 /* Disable all GPIOs */
5258 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5259 /* Internal speaker is connected to headphone pin */
5260 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5261 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5263 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5264 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5265 /* Ensure all other unused pins are disabled and muted. */
5266 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5267 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5268 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5269 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5270 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5271 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5275 /* Disable digital (SPDIF) pins */
5276 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5277 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5279 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5280 * when acting as an output.
5282 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5284 /* Start with output sum widgets muted and their output gains at min */
5285 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5287 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5288 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5291 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5292 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5293 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5295 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5296 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5297 /* Unmute Line1 pin widget output buffer since it starts as an output.
5298 * If the pin mode is changed by the user the pin mode control will
5299 * take care of enabling the pin's input/output buffers as needed.
5300 * Therefore there's no need to enable the input buffer at this
5303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5304 /* Unmute input buffer of pin widget used for Line-in (no equiv
5307 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5309 /* Mute capture amp left and right */
5310 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5311 /* Set ADC connection select to match default mixer setting - line
5314 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5316 /* Do the same for the second ADC: mute capture input amp and
5317 * set ADC connection to line in (on mic1 pin)
5319 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5320 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5322 /* Mute all inputs to mixer widget (even unconnected ones) */
5323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5324 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5335 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5336 * similar laptops (adapted from Fujitsu init verbs).
5338 static struct hda_verb alc260_acer_init_verbs[] = {
5339 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5340 * the headphone jack. Turn this on and rely on the standard mute
5341 * methods whenever the user wants to turn these outputs off.
5343 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5344 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5345 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5346 /* Internal speaker/Headphone jack is connected to Line-out pin */
5347 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5348 /* Internal microphone/Mic jack is connected to Mic1 pin */
5349 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5350 /* Line In jack is connected to Line1 pin */
5351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5352 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5353 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5354 /* Ensure all other unused pins are disabled and muted. */
5355 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5356 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5357 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5358 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5360 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5361 /* Disable digital (SPDIF) pins */
5362 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5363 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5365 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5366 * bus when acting as outputs.
5368 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5369 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5371 /* Start with output sum widgets muted and their output gains at min */
5372 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5373 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5374 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5376 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5377 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5378 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5379 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5380 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5382 /* Unmute Line-out pin widget amp left and right
5383 * (no equiv mixer ctrl)
5385 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5386 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5387 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5388 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5389 * inputs. If the pin mode is changed by the user the pin mode control
5390 * will take care of enabling the pin's input/output buffers as needed.
5391 * Therefore there's no need to enable the input buffer at this
5394 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5395 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5397 /* Mute capture amp left and right */
5398 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5399 /* Set ADC connection select to match default mixer setting - mic
5402 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5404 /* Do similar with the second ADC: mute capture input amp and
5405 * set ADC connection to mic to match ALSA's default state.
5407 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5408 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5410 /* Mute all inputs to mixer widget (even unconnected ones) */
5411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5423 /* Initialisation sequence for Maxdata Favorit 100XS
5424 * (adapted from Acer init verbs).
5426 static struct hda_verb alc260_favorit100_init_verbs[] = {
5427 /* GPIO 0 enables the output jack.
5428 * Turn this on and rely on the standard mute
5429 * methods whenever the user wants to turn these outputs off.
5431 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5432 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5433 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5434 /* Line/Mic input jack is connected to Mic1 pin */
5435 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5436 /* Ensure all other unused pins are disabled and muted. */
5437 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5438 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5439 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5440 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5441 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5442 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5447 /* Disable digital (SPDIF) pins */
5448 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5449 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5451 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5452 * bus when acting as outputs.
5454 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5455 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5457 /* Start with output sum widgets muted and their output gains at min */
5458 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5459 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5460 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5461 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5462 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5463 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5464 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5465 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5466 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5468 /* Unmute Line-out pin widget amp left and right
5469 * (no equiv mixer ctrl)
5471 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5472 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5473 * inputs. If the pin mode is changed by the user the pin mode control
5474 * will take care of enabling the pin's input/output buffers as needed.
5475 * Therefore there's no need to enable the input buffer at this
5478 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5480 /* Mute capture amp left and right */
5481 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5482 /* Set ADC connection select to match default mixer setting - mic
5485 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5487 /* Do similar with the second ADC: mute capture input amp and
5488 * set ADC connection to mic to match ALSA's default state.
5490 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5491 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5493 /* Mute all inputs to mixer widget (even unconnected ones) */
5494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5506 static struct hda_verb alc260_will_verbs[] = {
5507 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5508 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5509 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5510 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5511 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5512 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5516 static struct hda_verb alc260_replacer_672v_verbs[] = {
5517 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5518 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5519 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5521 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5522 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5523 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5525 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5529 /* toggle speaker-output according to the hp-jack state */
5530 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5532 unsigned int present;
5534 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5535 present = snd_hda_codec_read(codec, 0x0f, 0,
5536 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5538 snd_hda_codec_write_cache(codec, 0x01, 0,
5539 AC_VERB_SET_GPIO_DATA, 1);
5540 snd_hda_codec_write_cache(codec, 0x0f, 0,
5541 AC_VERB_SET_PIN_WIDGET_CONTROL,
5544 snd_hda_codec_write_cache(codec, 0x01, 0,
5545 AC_VERB_SET_GPIO_DATA, 0);
5546 snd_hda_codec_write_cache(codec, 0x0f, 0,
5547 AC_VERB_SET_PIN_WIDGET_CONTROL,
5552 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5555 if ((res >> 26) == ALC880_HP_EVENT)
5556 alc260_replacer_672v_automute(codec);
5559 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5560 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5561 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5562 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5563 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5564 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5565 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5566 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5567 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5568 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5569 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5573 /* Test configuration for debugging, modelled after the ALC880 test
5576 #ifdef CONFIG_SND_DEBUG
5577 static hda_nid_t alc260_test_dac_nids[1] = {
5580 static hda_nid_t alc260_test_adc_nids[2] = {
5583 /* For testing the ALC260, each input MUX needs its own definition since
5584 * the signal assignments are different. This assumes that the first ADC
5587 static struct hda_input_mux alc260_test_capture_sources[2] = {
5591 { "MIC1 pin", 0x0 },
5592 { "MIC2 pin", 0x1 },
5593 { "LINE1 pin", 0x2 },
5594 { "LINE2 pin", 0x3 },
5596 { "LINE-OUT pin", 0x5 },
5597 { "HP-OUT pin", 0x6 },
5603 { "MIC1 pin", 0x0 },
5604 { "MIC2 pin", 0x1 },
5605 { "LINE1 pin", 0x2 },
5606 { "LINE2 pin", 0x3 },
5609 { "LINE-OUT pin", 0x6 },
5610 { "HP-OUT pin", 0x7 },
5614 static struct snd_kcontrol_new alc260_test_mixer[] = {
5615 /* Output driver widgets */
5616 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5617 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5618 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5619 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5620 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5621 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5623 /* Modes for retasking pin widgets
5624 * Note: the ALC260 doesn't seem to act on requests to enable mic
5625 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5626 * mention this restriction. At this stage it's not clear whether
5627 * this behaviour is intentional or is a hardware bug in chip
5628 * revisions available at least up until early 2006. Therefore for
5629 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5630 * choices, but if it turns out that the lack of mic bias for these
5631 * NIDs is intentional we could change their modes from
5632 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5634 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5635 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5636 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5637 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5638 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5639 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5641 /* Loopback mixer controls */
5642 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5643 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5644 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5645 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5646 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5647 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5648 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5649 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5650 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5651 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5652 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5653 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5654 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5655 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5657 /* Controls for GPIO pins, assuming they are configured as outputs */
5658 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5659 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5660 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5661 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5663 /* Switches to allow the digital IO pins to be enabled. The datasheet
5664 * is ambigious as to which NID is which; testing on laptops which
5665 * make this output available should provide clarification.
5667 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5668 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5670 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5671 * this output to turn on an external amplifier.
5673 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5674 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5678 static struct hda_verb alc260_test_init_verbs[] = {
5679 /* Enable all GPIOs as outputs with an initial value of 0 */
5680 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5681 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5682 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5684 /* Enable retasking pins as output, initially without power amp */
5685 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5686 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5689 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5690 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5692 /* Disable digital (SPDIF) pins initially, but users can enable
5693 * them via a mixer switch. In the case of SPDIF-out, this initverb
5694 * payload also sets the generation to 0, output to be in "consumer"
5695 * PCM format, copyright asserted, no pre-emphasis and no validity
5698 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5699 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5701 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5702 * OUT1 sum bus when acting as an output.
5704 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5705 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5706 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5707 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5709 /* Start with output sum widgets muted and their output gains at min */
5710 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5711 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5712 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5713 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5714 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5715 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5716 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5717 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5718 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5720 /* Unmute retasking pin widget output buffers since the default
5721 * state appears to be output. As the pin mode is changed by the
5722 * user the pin mode control will take care of enabling the pin's
5723 * input/output buffers as needed.
5725 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5728 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5729 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5730 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5731 /* Also unmute the mono-out pin widget */
5732 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5734 /* Mute capture amp left and right */
5735 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5736 /* Set ADC connection select to match default mixer setting (mic1
5739 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5741 /* Do the same for the second ADC: mute capture input amp and
5742 * set ADC connection to mic1 pin
5744 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5745 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5747 /* Mute all inputs to mixer widget (even unconnected ones) */
5748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5761 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5762 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5764 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5765 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5768 * for BIOS auto-configuration
5771 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5772 const char *pfx, int *vol_bits)
5775 unsigned long vol_val, sw_val;
5779 if (nid >= 0x0f && nid < 0x11) {
5780 nid_vol = nid - 0x7;
5781 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5782 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5783 } else if (nid == 0x11) {
5784 nid_vol = nid - 0x7;
5785 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5786 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5787 } else if (nid >= 0x12 && nid <= 0x15) {
5789 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5790 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5794 if (!(*vol_bits & (1 << nid_vol))) {
5795 /* first control for the volume widget */
5796 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5797 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5800 *vol_bits |= (1 << nid_vol);
5802 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5803 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5809 /* add playback controls from the parsed DAC table */
5810 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5811 const struct auto_pin_cfg *cfg)
5817 spec->multiout.num_dacs = 1;
5818 spec->multiout.dac_nids = spec->private_dac_nids;
5819 spec->multiout.dac_nids[0] = 0x02;
5821 nid = cfg->line_out_pins[0];
5823 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5828 nid = cfg->speaker_pins[0];
5830 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5835 nid = cfg->hp_pins[0];
5837 err = alc260_add_playback_controls(spec, nid, "Headphone",
5845 /* create playback/capture controls for input pins */
5846 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5847 const struct auto_pin_cfg *cfg)
5849 struct hda_input_mux *imux = &spec->private_imux[0];
5852 for (i = 0; i < AUTO_PIN_LAST; i++) {
5853 if (cfg->input_pins[i] >= 0x12) {
5854 idx = cfg->input_pins[i] - 0x12;
5855 err = new_analog_input(spec, cfg->input_pins[i],
5856 auto_pin_cfg_labels[i], idx,
5860 imux->items[imux->num_items].label =
5861 auto_pin_cfg_labels[i];
5862 imux->items[imux->num_items].index = idx;
5865 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5866 idx = cfg->input_pins[i] - 0x09;
5867 err = new_analog_input(spec, cfg->input_pins[i],
5868 auto_pin_cfg_labels[i], idx,
5872 imux->items[imux->num_items].label =
5873 auto_pin_cfg_labels[i];
5874 imux->items[imux->num_items].index = idx;
5881 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5882 hda_nid_t nid, int pin_type,
5885 alc_set_pin_output(codec, nid, pin_type);
5886 /* need the manual connection? */
5888 int idx = nid - 0x12;
5889 snd_hda_codec_write(codec, idx + 0x0b, 0,
5890 AC_VERB_SET_CONNECT_SEL, sel_idx);
5894 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5896 struct alc_spec *spec = codec->spec;
5899 nid = spec->autocfg.line_out_pins[0];
5901 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5902 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5905 nid = spec->autocfg.speaker_pins[0];
5907 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5909 nid = spec->autocfg.hp_pins[0];
5911 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5914 #define ALC260_PIN_CD_NID 0x16
5915 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5917 struct alc_spec *spec = codec->spec;
5920 for (i = 0; i < AUTO_PIN_LAST; i++) {
5921 hda_nid_t nid = spec->autocfg.input_pins[i];
5923 alc_set_input_pin(codec, nid, i);
5924 if (nid != ALC260_PIN_CD_NID &&
5925 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5926 snd_hda_codec_write(codec, nid, 0,
5927 AC_VERB_SET_AMP_GAIN_MUTE,
5934 * generic initialization of ADC, input mixers and output mixers
5936 static struct hda_verb alc260_volume_init_verbs[] = {
5938 * Unmute ADC0-1 and set the default input to mic-in
5940 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5941 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5942 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5943 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5945 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5947 * Note: PASD motherboards uses the Line In 2 as the input for
5948 * front panel mic (mic 2)
5950 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5951 /* mute analog inputs */
5952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5959 * Set up output mixers (0x08 - 0x0a)
5961 /* set vol=0 to output mixers */
5962 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5963 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5964 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5965 /* set up input amps for analog loopback */
5966 /* Amp Indices: DAC = 0, mixer = 1 */
5967 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5968 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5969 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5970 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5971 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5972 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5977 static int alc260_parse_auto_config(struct hda_codec *codec)
5979 struct alc_spec *spec = codec->spec;
5981 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5983 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5987 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5990 if (!spec->kctls.list)
5991 return 0; /* can't find valid BIOS pin config */
5992 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5996 spec->multiout.max_channels = 2;
5998 if (spec->autocfg.dig_outs)
5999 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6000 if (spec->kctls.list)
6001 add_mixer(spec, spec->kctls.list);
6003 add_verb(spec, alc260_volume_init_verbs);
6005 spec->num_mux_defs = 1;
6006 spec->input_mux = &spec->private_imux[0];
6008 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6013 /* additional initialization for auto-configuration model */
6014 static void alc260_auto_init(struct hda_codec *codec)
6016 struct alc_spec *spec = codec->spec;
6017 alc260_auto_init_multi_out(codec);
6018 alc260_auto_init_analog_input(codec);
6019 if (spec->unsol_event)
6020 alc_inithook(codec);
6023 #ifdef CONFIG_SND_HDA_POWER_SAVE
6024 static struct hda_amp_list alc260_loopbacks[] = {
6025 { 0x07, HDA_INPUT, 0 },
6026 { 0x07, HDA_INPUT, 1 },
6027 { 0x07, HDA_INPUT, 2 },
6028 { 0x07, HDA_INPUT, 3 },
6029 { 0x07, HDA_INPUT, 4 },
6035 * ALC260 configurations
6037 static const char *alc260_models[ALC260_MODEL_LAST] = {
6038 [ALC260_BASIC] = "basic",
6040 [ALC260_HP_3013] = "hp-3013",
6041 [ALC260_HP_DC7600] = "hp-dc7600",
6042 [ALC260_FUJITSU_S702X] = "fujitsu",
6043 [ALC260_ACER] = "acer",
6044 [ALC260_WILL] = "will",
6045 [ALC260_REPLACER_672V] = "replacer",
6046 [ALC260_FAVORIT100] = "favorit100",
6047 #ifdef CONFIG_SND_DEBUG
6048 [ALC260_TEST] = "test",
6050 [ALC260_AUTO] = "auto",
6053 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6054 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6055 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6056 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6057 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6058 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6059 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6060 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6061 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6062 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6063 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6064 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6065 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6066 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6067 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6068 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6069 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6070 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6071 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6072 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6076 static struct alc_config_preset alc260_presets[] = {
6078 .mixers = { alc260_base_output_mixer,
6079 alc260_input_mixer },
6080 .init_verbs = { alc260_init_verbs },
6081 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6082 .dac_nids = alc260_dac_nids,
6083 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6084 .adc_nids = alc260_adc_nids,
6085 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6086 .channel_mode = alc260_modes,
6087 .input_mux = &alc260_capture_source,
6090 .mixers = { alc260_hp_output_mixer,
6091 alc260_input_mixer },
6092 .init_verbs = { alc260_init_verbs,
6093 alc260_hp_unsol_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_unsol_event,
6102 .init_hook = alc260_hp_automute,
6104 [ALC260_HP_DC7600] = {
6105 .mixers = { alc260_hp_dc7600_mixer,
6106 alc260_input_mixer },
6107 .init_verbs = { alc260_init_verbs,
6108 alc260_hp_dc7600_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_3012_unsol_event,
6117 .init_hook = alc260_hp_3012_automute,
6119 [ALC260_HP_3013] = {
6120 .mixers = { alc260_hp_3013_mixer,
6121 alc260_input_mixer },
6122 .init_verbs = { alc260_hp_3013_init_verbs,
6123 alc260_hp_3013_unsol_verbs },
6124 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6125 .dac_nids = alc260_dac_nids,
6126 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6127 .adc_nids = alc260_adc_nids_alt,
6128 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6129 .channel_mode = alc260_modes,
6130 .input_mux = &alc260_capture_source,
6131 .unsol_event = alc260_hp_3013_unsol_event,
6132 .init_hook = alc260_hp_3013_automute,
6134 [ALC260_FUJITSU_S702X] = {
6135 .mixers = { alc260_fujitsu_mixer },
6136 .init_verbs = { alc260_fujitsu_init_verbs },
6137 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6138 .dac_nids = alc260_dac_nids,
6139 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6140 .adc_nids = alc260_dual_adc_nids,
6141 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6142 .channel_mode = alc260_modes,
6143 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6144 .input_mux = alc260_fujitsu_capture_sources,
6147 .mixers = { alc260_acer_mixer },
6148 .init_verbs = { alc260_acer_init_verbs },
6149 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6150 .dac_nids = alc260_dac_nids,
6151 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6152 .adc_nids = alc260_dual_adc_nids,
6153 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6154 .channel_mode = alc260_modes,
6155 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6156 .input_mux = alc260_acer_capture_sources,
6158 [ALC260_FAVORIT100] = {
6159 .mixers = { alc260_favorit100_mixer },
6160 .init_verbs = { alc260_favorit100_init_verbs },
6161 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6162 .dac_nids = alc260_dac_nids,
6163 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6164 .adc_nids = alc260_dual_adc_nids,
6165 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6166 .channel_mode = alc260_modes,
6167 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6168 .input_mux = alc260_favorit100_capture_sources,
6171 .mixers = { alc260_will_mixer },
6172 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6173 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6174 .dac_nids = alc260_dac_nids,
6175 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6176 .adc_nids = alc260_adc_nids,
6177 .dig_out_nid = ALC260_DIGOUT_NID,
6178 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6179 .channel_mode = alc260_modes,
6180 .input_mux = &alc260_capture_source,
6182 [ALC260_REPLACER_672V] = {
6183 .mixers = { alc260_replacer_672v_mixer },
6184 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6185 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6186 .dac_nids = alc260_dac_nids,
6187 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6188 .adc_nids = alc260_adc_nids,
6189 .dig_out_nid = ALC260_DIGOUT_NID,
6190 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6191 .channel_mode = alc260_modes,
6192 .input_mux = &alc260_capture_source,
6193 .unsol_event = alc260_replacer_672v_unsol_event,
6194 .init_hook = alc260_replacer_672v_automute,
6196 #ifdef CONFIG_SND_DEBUG
6198 .mixers = { alc260_test_mixer },
6199 .init_verbs = { alc260_test_init_verbs },
6200 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6201 .dac_nids = alc260_test_dac_nids,
6202 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6203 .adc_nids = alc260_test_adc_nids,
6204 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6205 .channel_mode = alc260_modes,
6206 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6207 .input_mux = alc260_test_capture_sources,
6212 static int patch_alc260(struct hda_codec *codec)
6214 struct alc_spec *spec;
6215 int err, board_config;
6217 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6223 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6226 if (board_config < 0) {
6227 snd_printd(KERN_INFO "hda_codec: Unknown model for %s, "
6228 "trying auto-probe from BIOS...\n",
6230 board_config = ALC260_AUTO;
6233 if (board_config == ALC260_AUTO) {
6234 /* automatic parse from the BIOS config */
6235 err = alc260_parse_auto_config(codec);
6241 "hda_codec: Cannot set up configuration "
6242 "from BIOS. Using base mode...\n");
6243 board_config = ALC260_BASIC;
6247 err = snd_hda_attach_beep_device(codec, 0x1);
6253 if (board_config != ALC260_AUTO)
6254 setup_preset(spec, &alc260_presets[board_config]);
6256 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6257 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6259 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6260 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6262 if (!spec->adc_nids && spec->input_mux) {
6263 /* check whether NID 0x04 is valid */
6264 unsigned int wcap = get_wcaps(codec, 0x04);
6265 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6267 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6268 spec->adc_nids = alc260_adc_nids_alt;
6269 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6271 spec->adc_nids = alc260_adc_nids;
6272 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6275 set_capture_mixer(spec);
6276 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6278 spec->vmaster_nid = 0x08;
6280 codec->patch_ops = alc_patch_ops;
6281 if (board_config == ALC260_AUTO)
6282 spec->init_hook = alc260_auto_init;
6283 #ifdef CONFIG_SND_HDA_POWER_SAVE
6284 if (!spec->loopback.amplist)
6285 spec->loopback.amplist = alc260_loopbacks;
6287 codec->proc_widget_hook = print_realtek_coef;
6296 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6297 * configuration. Each pin widget can choose any input DACs and a mixer.
6298 * Each ADC is connected from a mixer of all inputs. This makes possible
6299 * 6-channel independent captures.
6301 * In addition, an independent DAC for the multi-playback (not used in this
6304 #define ALC882_DIGOUT_NID 0x06
6305 #define ALC882_DIGIN_NID 0x0a
6307 static struct hda_channel_mode alc882_ch_modes[1] = {
6311 static hda_nid_t alc882_dac_nids[4] = {
6312 /* front, rear, clfe, rear_surr */
6313 0x02, 0x03, 0x04, 0x05
6316 /* identical with ALC880 */
6317 #define alc882_adc_nids alc880_adc_nids
6318 #define alc882_adc_nids_alt alc880_adc_nids_alt
6320 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6321 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6324 /* FIXME: should be a matrix-type input source selection */
6326 static struct hda_input_mux alc882_capture_source = {
6330 { "Front Mic", 0x1 },
6336 static struct hda_input_mux mb5_capture_source = {
6348 static struct hda_verb alc882_3ST_ch2_init[] = {
6349 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6350 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6351 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6352 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6359 static struct hda_verb alc882_3ST_ch6_init[] = {
6360 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6361 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6362 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6363 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6364 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6365 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6369 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6370 { 2, alc882_3ST_ch2_init },
6371 { 6, alc882_3ST_ch6_init },
6377 static struct hda_verb alc882_sixstack_ch6_init[] = {
6378 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6379 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6380 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6381 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6388 static struct hda_verb alc882_sixstack_ch8_init[] = {
6389 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6390 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6391 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6392 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6396 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6397 { 6, alc882_sixstack_ch6_init },
6398 { 8, alc882_sixstack_ch8_init },
6402 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6408 static struct hda_verb alc885_mbp_ch2_init[] = {
6409 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6410 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6411 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6418 static struct hda_verb alc885_mbp_ch6_init[] = {
6419 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6420 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6421 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6422 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6423 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6427 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6428 { 2, alc885_mbp_ch2_init },
6429 { 6, alc885_mbp_ch6_init },
6434 * Speakers/Woofer/HP = Front
6437 static struct hda_verb alc885_mb5_ch2_init[] = {
6438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6439 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6445 * Speakers/HP = Front
6449 static struct hda_verb alc885_mb5_ch6_init[] = {
6450 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6451 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6452 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6456 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6457 { 2, alc885_mb5_ch2_init },
6458 { 6, alc885_mb5_ch6_init },
6461 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6462 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6464 static struct snd_kcontrol_new alc882_base_mixer[] = {
6465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6466 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6467 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6468 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6469 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6470 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6471 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6472 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6473 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6474 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6475 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6476 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6477 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6478 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6479 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6480 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6481 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6482 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6483 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6484 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6485 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6489 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6490 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6491 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6492 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6493 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6494 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6495 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6496 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6497 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6498 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6499 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6503 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6504 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6505 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6506 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6507 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6508 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6509 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6510 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6511 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6512 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6513 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6515 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6516 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6517 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6521 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6522 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6523 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6524 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6525 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6526 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6527 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6528 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6529 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6534 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6535 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6536 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6538 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6539 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6540 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6541 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6542 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6543 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6544 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6545 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6546 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6547 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6551 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6552 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6554 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6555 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6556 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6558 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6559 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6560 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6561 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6562 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6563 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6564 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6565 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6566 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6567 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6571 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6572 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6573 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6575 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6576 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6577 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6578 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6580 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6581 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6585 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6587 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6588 .name = "Channel Mode",
6589 .info = alc_ch_mode_info,
6590 .get = alc_ch_mode_get,
6591 .put = alc_ch_mode_put,
6596 static struct hda_verb alc882_init_verbs[] = {
6597 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6599 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6604 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6606 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6607 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6608 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6610 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6611 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6612 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6614 /* Front Pin: output 0 (0x0c) */
6615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6616 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6617 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6618 /* Rear Pin: output 1 (0x0d) */
6619 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6620 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6621 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6622 /* CLFE Pin: output 2 (0x0e) */
6623 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6624 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6625 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6626 /* Side Pin: output 3 (0x0f) */
6627 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6628 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6629 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6630 /* Mic (rear) pin: input vref at 80% */
6631 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6632 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6633 /* Front Mic pin: input vref at 80% */
6634 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6635 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6636 /* Line In pin: input */
6637 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6639 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6640 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6641 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6642 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6643 /* CD pin widget for input */
6644 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6646 /* FIXME: use matrix-type input source selection */
6647 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6648 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6650 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6651 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6652 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6661 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6663 /* ADC1: mute amp left and right */
6664 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6665 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6666 /* ADC2: mute amp left and right */
6667 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6668 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6669 /* ADC3: mute amp left and right */
6670 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6671 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6676 static struct hda_verb alc882_eapd_verbs[] = {
6677 /* change to EAPD mode */
6678 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6679 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6684 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6685 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6686 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6688 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6689 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6690 /* FIXME: this looks suspicious...
6691 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6692 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6697 static struct hda_verb alc882_macpro_init_verbs[] = {
6698 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6699 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6700 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6702 /* Front Pin: output 0 (0x0c) */
6703 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6704 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6705 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6706 /* Front Mic pin: input vref at 80% */
6707 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6708 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6709 /* Speaker: output */
6710 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6711 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6712 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6713 /* Headphone output (output 0 - 0x0c) */
6714 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6716 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6718 /* FIXME: use matrix-type input source selection */
6719 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6720 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6721 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6722 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6723 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6724 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6726 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6727 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6728 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6729 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6731 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6733 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6734 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6735 /* ADC1: mute amp left and right */
6736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6737 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6738 /* ADC2: mute amp left and right */
6739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6740 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6741 /* ADC3: mute amp left and right */
6742 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6743 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6749 static struct hda_verb alc885_mb5_init_verbs[] = {
6751 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6752 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6753 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6754 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6759 /* Surround mixer */
6760 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6761 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6762 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6764 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6765 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6766 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6769 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6770 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6771 /* Front Pin (0x0c) */
6772 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6774 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6775 /* LFE Pin (0x0e) */
6776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6778 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
6780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6781 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6782 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
6783 /* Front Mic pin: input vref at 80% */
6784 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6785 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6792 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6793 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6797 /* Macbook Pro rev3 */
6798 static struct hda_verb alc885_mbp3_init_verbs[] = {
6799 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6802 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6805 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6807 /* Front Pin: output 0 (0x0c) */
6808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6810 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6811 /* HP Pin: output 0 (0x0d) */
6812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6814 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6815 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6816 /* Mic (rear) pin: input vref at 80% */
6817 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6818 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6819 /* Front Mic pin: input vref at 80% */
6820 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6821 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6822 /* Line In pin: use output 1 when in LineOut mode */
6823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6824 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6825 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6827 /* FIXME: use matrix-type input source selection */
6828 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6829 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6830 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6831 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6832 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6833 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6835 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6836 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6837 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6838 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6842 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6844 /* ADC1: mute amp left and right */
6845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6846 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6847 /* ADC2: mute amp left and right */
6848 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6849 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6850 /* ADC3: mute amp left and right */
6851 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6852 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6857 /* iMac 24 mixer. */
6858 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6859 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6860 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6864 /* iMac 24 init verbs. */
6865 static struct hda_verb alc885_imac24_init_verbs[] = {
6866 /* Internal speakers: output 0 (0x0c) */
6867 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6868 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6869 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6870 /* Internal speakers: output 0 (0x0c) */
6871 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6872 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6873 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6874 /* Headphone: output 0 (0x0c) */
6875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6876 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6877 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6878 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6879 /* Front Mic: input vref at 80% */
6880 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6881 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6885 /* Toggle speaker-output according to the hp-jack state */
6886 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
6888 struct alc_spec *spec = codec->spec;
6890 spec->autocfg.hp_pins[0] = 0x14;
6891 spec->autocfg.speaker_pins[0] = 0x18;
6892 spec->autocfg.speaker_pins[1] = 0x1a;
6893 alc_automute_amp(codec);
6896 static void alc885_mbp3_init_hook(struct hda_codec *codec)
6898 struct alc_spec *spec = codec->spec;
6900 spec->autocfg.hp_pins[0] = 0x15;
6901 spec->autocfg.speaker_pins[0] = 0x14;
6902 alc_automute_amp(codec);
6906 static struct hda_verb alc882_targa_verbs[] = {
6907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6910 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6911 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6913 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6914 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6915 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6917 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6918 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6919 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6920 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6924 /* toggle speaker-output according to the hp-jack state */
6925 static void alc882_targa_automute(struct hda_codec *codec)
6927 struct alc_spec *spec = codec->spec;
6928 alc_automute_amp(codec);
6929 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6930 spec->jack_present ? 1 : 3);
6933 static void alc882_targa_init_hook(struct hda_codec *codec)
6935 struct alc_spec *spec = codec->spec;
6937 spec->autocfg.hp_pins[0] = 0x14;
6938 spec->autocfg.speaker_pins[0] = 0x1b;
6939 alc882_targa_automute(codec);
6942 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6944 if ((res >> 26) == ALC880_HP_EVENT)
6945 alc882_targa_automute(codec);
6948 static struct hda_verb alc882_asus_a7j_verbs[] = {
6949 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6954 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6956 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6957 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6958 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6960 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6961 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6962 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6966 static struct hda_verb alc882_asus_a7m_verbs[] = {
6967 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6971 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6974 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6976 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6978 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6979 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6980 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6984 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6986 unsigned int gpiostate, gpiomask, gpiodir;
6988 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6989 AC_VERB_GET_GPIO_DATA, 0);
6992 gpiostate |= (1 << pin);
6994 gpiostate &= ~(1 << pin);
6996 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6997 AC_VERB_GET_GPIO_MASK, 0);
6998 gpiomask |= (1 << pin);
7000 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7001 AC_VERB_GET_GPIO_DIRECTION, 0);
7002 gpiodir |= (1 << pin);
7005 snd_hda_codec_write(codec, codec->afg, 0,
7006 AC_VERB_SET_GPIO_MASK, gpiomask);
7007 snd_hda_codec_write(codec, codec->afg, 0,
7008 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7012 snd_hda_codec_write(codec, codec->afg, 0,
7013 AC_VERB_SET_GPIO_DATA, gpiostate);
7016 /* set up GPIO at initialization */
7017 static void alc885_macpro_init_hook(struct hda_codec *codec)
7019 alc882_gpio_mute(codec, 0, 0);
7020 alc882_gpio_mute(codec, 1, 0);
7023 /* set up GPIO and update auto-muting at initialization */
7024 static void alc885_imac24_init_hook(struct hda_codec *codec)
7026 alc885_macpro_init_hook(codec);
7027 alc885_imac24_automute_init_hook(codec);
7031 * generic initialization of ADC, input mixers and output mixers
7033 static struct hda_verb alc882_auto_init_verbs[] = {
7035 * Unmute ADC0-2 and set the default input to mic-in
7037 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7038 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7039 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7040 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7041 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7044 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7046 * Note: PASD motherboards uses the Line In 2 as the input for
7047 * front panel mic (mic 2)
7049 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7050 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7051 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7052 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7053 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7054 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7057 * Set up output mixers (0x0c - 0x0f)
7059 /* set vol=0 to output mixers */
7060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7061 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7062 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7063 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7064 /* set up input amps for analog loopback */
7065 /* Amp Indices: DAC = 0, mixer = 1 */
7066 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7068 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7069 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7070 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7071 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7072 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7073 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7074 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7075 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7077 /* FIXME: use matrix-type input source selection */
7078 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7079 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7085 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7086 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7087 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7088 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7098 #ifdef CONFIG_SND_HDA_POWER_SAVE
7099 #define alc882_loopbacks alc880_loopbacks
7102 /* pcm configuration: identical with ALC880 */
7103 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
7104 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
7105 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
7106 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
7109 * configuration and preset
7111 static const char *alc882_models[ALC882_MODEL_LAST] = {
7112 [ALC882_3ST_DIG] = "3stack-dig",
7113 [ALC882_6ST_DIG] = "6stack-dig",
7114 [ALC882_ARIMA] = "arima",
7115 [ALC882_W2JC] = "w2jc",
7116 [ALC882_TARGA] = "targa",
7117 [ALC882_ASUS_A7J] = "asus-a7j",
7118 [ALC882_ASUS_A7M] = "asus-a7m",
7119 [ALC885_MACPRO] = "macpro",
7120 [ALC885_MB5] = "mb5",
7121 [ALC885_MBP3] = "mbp3",
7122 [ALC885_IMAC24] = "imac24",
7123 [ALC882_AUTO] = "auto",
7126 static struct snd_pci_quirk alc882_cfg_tbl[] = {
7127 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
7128 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
7129 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
7130 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
7131 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
7132 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
7133 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
7134 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
7135 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
7136 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
7137 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
7138 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
7142 static struct alc_config_preset alc882_presets[] = {
7143 [ALC882_3ST_DIG] = {
7144 .mixers = { alc882_base_mixer },
7145 .init_verbs = { alc882_init_verbs },
7146 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7147 .dac_nids = alc882_dac_nids,
7148 .dig_out_nid = ALC882_DIGOUT_NID,
7149 .dig_in_nid = ALC882_DIGIN_NID,
7150 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7151 .channel_mode = alc882_ch_modes,
7153 .input_mux = &alc882_capture_source,
7155 [ALC882_6ST_DIG] = {
7156 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
7157 .init_verbs = { alc882_init_verbs },
7158 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7159 .dac_nids = alc882_dac_nids,
7160 .dig_out_nid = ALC882_DIGOUT_NID,
7161 .dig_in_nid = ALC882_DIGIN_NID,
7162 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
7163 .channel_mode = alc882_sixstack_modes,
7164 .input_mux = &alc882_capture_source,
7167 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
7168 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
7169 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7170 .dac_nids = alc882_dac_nids,
7171 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
7172 .channel_mode = alc882_sixstack_modes,
7173 .input_mux = &alc882_capture_source,
7176 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
7177 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7178 alc880_gpio1_init_verbs },
7179 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7180 .dac_nids = alc882_dac_nids,
7181 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7182 .channel_mode = alc880_threestack_modes,
7184 .input_mux = &alc882_capture_source,
7185 .dig_out_nid = ALC882_DIGOUT_NID,
7188 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
7189 .init_verbs = { alc885_mbp3_init_verbs,
7190 alc880_gpio1_init_verbs },
7191 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7192 .dac_nids = alc882_dac_nids,
7193 .channel_mode = alc885_mbp_6ch_modes,
7194 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
7195 .input_mux = &alc882_capture_source,
7196 .dig_out_nid = ALC882_DIGOUT_NID,
7197 .dig_in_nid = ALC882_DIGIN_NID,
7198 .unsol_event = alc_automute_amp_unsol_event,
7199 .init_hook = alc885_mbp3_init_hook,
7202 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
7203 .init_verbs = { alc885_mb5_init_verbs,
7204 alc880_gpio1_init_verbs },
7205 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7206 .dac_nids = alc882_dac_nids,
7207 .channel_mode = alc885_mb5_6ch_modes,
7208 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
7209 .input_mux = &mb5_capture_source,
7210 .dig_out_nid = ALC882_DIGOUT_NID,
7211 .dig_in_nid = ALC882_DIGIN_NID,
7214 .mixers = { alc882_macpro_mixer },
7215 .init_verbs = { alc882_macpro_init_verbs },
7216 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7217 .dac_nids = alc882_dac_nids,
7218 .dig_out_nid = ALC882_DIGOUT_NID,
7219 .dig_in_nid = ALC882_DIGIN_NID,
7220 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7221 .channel_mode = alc882_ch_modes,
7222 .input_mux = &alc882_capture_source,
7223 .init_hook = alc885_macpro_init_hook,
7226 .mixers = { alc885_imac24_mixer },
7227 .init_verbs = { alc885_imac24_init_verbs },
7228 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7229 .dac_nids = alc882_dac_nids,
7230 .dig_out_nid = ALC882_DIGOUT_NID,
7231 .dig_in_nid = ALC882_DIGIN_NID,
7232 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7233 .channel_mode = alc882_ch_modes,
7234 .input_mux = &alc882_capture_source,
7235 .unsol_event = alc_automute_amp_unsol_event,
7236 .init_hook = alc885_imac24_init_hook,
7239 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7240 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
7241 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7242 .dac_nids = alc882_dac_nids,
7243 .dig_out_nid = ALC882_DIGOUT_NID,
7244 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7245 .adc_nids = alc882_adc_nids,
7246 .capsrc_nids = alc882_capsrc_nids,
7247 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7248 .channel_mode = alc882_3ST_6ch_modes,
7250 .input_mux = &alc882_capture_source,
7251 .unsol_event = alc882_targa_unsol_event,
7252 .init_hook = alc882_targa_init_hook,
7254 [ALC882_ASUS_A7J] = {
7255 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
7256 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
7257 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7258 .dac_nids = alc882_dac_nids,
7259 .dig_out_nid = ALC882_DIGOUT_NID,
7260 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7261 .adc_nids = alc882_adc_nids,
7262 .capsrc_nids = alc882_capsrc_nids,
7263 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7264 .channel_mode = alc882_3ST_6ch_modes,
7266 .input_mux = &alc882_capture_source,
7268 [ALC882_ASUS_A7M] = {
7269 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7270 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7271 alc880_gpio1_init_verbs,
7272 alc882_asus_a7m_verbs },
7273 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7274 .dac_nids = alc882_dac_nids,
7275 .dig_out_nid = ALC882_DIGOUT_NID,
7276 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7277 .channel_mode = alc880_threestack_modes,
7279 .input_mux = &alc882_capture_source,
7288 PINFIX_ABIT_AW9D_MAX
7291 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7292 { 0x15, 0x01080104 }, /* side */
7293 { 0x16, 0x01011012 }, /* rear */
7294 { 0x17, 0x01016011 }, /* clfe */
7298 static const struct alc_pincfg *alc882_pin_fixes[] = {
7299 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7302 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7303 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7308 * BIOS auto configuration
7310 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7311 hda_nid_t nid, int pin_type,
7315 struct alc_spec *spec = codec->spec;
7318 alc_set_pin_output(codec, nid, pin_type);
7319 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7322 idx = spec->multiout.dac_nids[dac_idx] - 2;
7323 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7327 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7329 struct alc_spec *spec = codec->spec;
7332 for (i = 0; i <= HDA_SIDE; i++) {
7333 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7334 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7336 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7341 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7343 struct alc_spec *spec = codec->spec;
7346 pin = spec->autocfg.hp_pins[0];
7347 if (pin) /* connect to front */
7349 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7350 pin = spec->autocfg.speaker_pins[0];
7352 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7355 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7356 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7358 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7360 struct alc_spec *spec = codec->spec;
7363 for (i = 0; i < AUTO_PIN_LAST; i++) {
7364 hda_nid_t nid = spec->autocfg.input_pins[i];
7367 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7368 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7369 snd_hda_codec_write(codec, nid, 0,
7370 AC_VERB_SET_AMP_GAIN_MUTE,
7375 static void alc882_auto_init_input_src(struct hda_codec *codec)
7377 struct alc_spec *spec = codec->spec;
7380 for (c = 0; c < spec->num_adc_nids; c++) {
7381 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7382 hda_nid_t nid = spec->capsrc_nids[c];
7383 unsigned int mux_idx;
7384 const struct hda_input_mux *imux;
7385 int conns, mute, idx, item;
7387 conns = snd_hda_get_connections(codec, nid, conn_list,
7388 ARRAY_SIZE(conn_list));
7391 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7392 imux = &spec->input_mux[mux_idx];
7393 for (idx = 0; idx < conns; idx++) {
7394 /* if the current connection is the selected one,
7395 * unmute it as default - otherwise mute it
7397 mute = AMP_IN_MUTE(idx);
7398 for (item = 0; item < imux->num_items; item++) {
7399 if (imux->items[item].index == idx) {
7400 if (spec->cur_mux[c] == item)
7401 mute = AMP_IN_UNMUTE(idx);
7405 /* check if we have a selector or mixer
7406 * we could check for the widget type instead, but
7407 * just check for Amp-In presence (in case of mixer
7408 * without amp-in there is something wrong, this
7409 * function shouldn't be used or capsrc nid is wrong)
7411 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7412 snd_hda_codec_write(codec, nid, 0,
7413 AC_VERB_SET_AMP_GAIN_MUTE,
7415 else if (mute != AMP_IN_MUTE(idx))
7416 snd_hda_codec_write(codec, nid, 0,
7417 AC_VERB_SET_CONNECT_SEL,
7423 /* add mic boosts if needed */
7424 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7426 struct alc_spec *spec = codec->spec;
7430 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7431 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7432 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7434 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7438 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7439 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7440 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7442 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7449 /* almost identical with ALC880 parser... */
7450 static int alc882_parse_auto_config(struct hda_codec *codec)
7452 struct alc_spec *spec = codec->spec;
7453 int err = alc880_parse_auto_config(codec);
7458 return 0; /* no config found */
7460 err = alc_auto_add_mic_boost(codec);
7464 /* hack - override the init verbs */
7465 spec->init_verbs[0] = alc882_auto_init_verbs;
7467 return 1; /* config found */
7470 /* additional initialization for auto-configuration model */
7471 static void alc882_auto_init(struct hda_codec *codec)
7473 struct alc_spec *spec = codec->spec;
7474 alc882_auto_init_multi_out(codec);
7475 alc882_auto_init_hp_out(codec);
7476 alc882_auto_init_analog_input(codec);
7477 alc882_auto_init_input_src(codec);
7478 if (spec->unsol_event)
7479 alc_inithook(codec);
7482 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7484 static int patch_alc882(struct hda_codec *codec)
7486 struct alc_spec *spec;
7487 int err, board_config;
7489 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7495 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7499 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7500 /* Pick up systems that don't supply PCI SSID */
7501 switch (codec->subsystem_id) {
7502 case 0x106b0c00: /* Mac Pro */
7503 board_config = ALC885_MACPRO;
7505 case 0x106b1000: /* iMac 24 */
7506 case 0x106b2800: /* AppleTV */
7507 case 0x106b3e00: /* iMac 24 Aluminium */
7508 board_config = ALC885_IMAC24;
7510 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7511 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7512 case 0x106b00a4: /* MacbookPro4,1 */
7513 case 0x106b2c00: /* Macbook Pro rev3 */
7514 /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */
7515 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7516 board_config = ALC885_MBP3;
7518 case 0x106b3f00: /* Macbook 5,1 */
7519 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7520 * seems not working, so apparently
7521 * no perfect solution yet
7523 board_config = ALC885_MB5;
7526 /* ALC889A is handled better as ALC888-compatible */
7527 if (codec->revision_id == 0x100101 ||
7528 codec->revision_id == 0x100103) {
7530 return patch_alc883(codec);
7532 printk(KERN_INFO "hda_codec: Unknown model for %s, "
7533 "trying auto-probe from BIOS...\n",
7535 board_config = ALC882_AUTO;
7539 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7541 if (board_config == ALC882_AUTO) {
7542 /* automatic parse from the BIOS config */
7543 err = alc882_parse_auto_config(codec);
7549 "hda_codec: Cannot set up configuration "
7550 "from BIOS. Using base mode...\n");
7551 board_config = ALC882_3ST_DIG;
7555 err = snd_hda_attach_beep_device(codec, 0x1);
7561 if (board_config != ALC882_AUTO)
7562 setup_preset(spec, &alc882_presets[board_config]);
7564 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7565 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7566 /* FIXME: setup DAC5 */
7567 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7568 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7570 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7571 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7573 if (!spec->adc_nids && spec->input_mux) {
7574 /* check whether NID 0x07 is valid */
7575 unsigned int wcap = get_wcaps(codec, 0x07);
7577 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7578 if (wcap != AC_WID_AUD_IN) {
7579 spec->adc_nids = alc882_adc_nids_alt;
7580 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7581 spec->capsrc_nids = alc882_capsrc_nids_alt;
7583 spec->adc_nids = alc882_adc_nids;
7584 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7585 spec->capsrc_nids = alc882_capsrc_nids;
7588 set_capture_mixer(spec);
7589 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7591 spec->vmaster_nid = 0x0c;
7593 codec->patch_ops = alc_patch_ops;
7594 if (board_config == ALC882_AUTO)
7595 spec->init_hook = alc882_auto_init;
7596 #ifdef CONFIG_SND_HDA_POWER_SAVE
7597 if (!spec->loopback.amplist)
7598 spec->loopback.amplist = alc882_loopbacks;
7600 codec->proc_widget_hook = print_realtek_coef;
7608 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7609 * configuration. Each pin widget can choose any input DACs and a mixer.
7610 * Each ADC is connected from a mixer of all inputs. This makes possible
7611 * 6-channel independent captures.
7613 * In addition, an independent DAC for the multi-playback (not used in this
7616 #define ALC883_DIGOUT_NID 0x06
7617 #define ALC883_DIGIN_NID 0x0a
7619 #define ALC1200_DIGOUT_NID 0x10
7621 static hda_nid_t alc883_dac_nids[4] = {
7622 /* front, rear, clfe, rear_surr */
7623 0x02, 0x03, 0x04, 0x05
7626 static hda_nid_t alc883_adc_nids[2] = {
7631 static hda_nid_t alc883_adc_nids_alt[1] = {
7636 static hda_nid_t alc883_adc_nids_rev[2] = {
7641 #define alc889_adc_nids alc880_adc_nids
7643 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7645 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7647 #define alc889_capsrc_nids alc882_capsrc_nids
7650 /* FIXME: should be a matrix-type input source selection */
7652 static struct hda_input_mux alc883_capture_source = {
7656 { "Front Mic", 0x1 },
7662 static struct hda_input_mux alc883_3stack_6ch_intel = {
7666 { "Front Mic", 0x0 },
7672 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7680 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7690 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7698 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7702 { "Front Mic", 0x1 },
7707 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7715 static struct hda_input_mux alc889A_mb31_capture_source = {
7719 /* Front Mic (0x01) unused */
7721 /* Line 2 (0x03) unused */
7722 /* CD (0x04) unsused? */
7729 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7736 static struct hda_verb alc883_3ST_ch2_init[] = {
7737 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7738 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7739 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7740 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7747 static struct hda_verb alc883_3ST_ch4_init[] = {
7748 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7749 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7750 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7751 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7752 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7759 static struct hda_verb alc883_3ST_ch6_init[] = {
7760 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7761 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7762 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7763 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7764 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7765 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7769 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7770 { 2, alc883_3ST_ch2_init },
7771 { 4, alc883_3ST_ch4_init },
7772 { 6, alc883_3ST_ch6_init },
7779 static struct hda_verb alc883_4ST_ch2_init[] = {
7780 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7781 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7782 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7783 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7784 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7785 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7792 static struct hda_verb alc883_4ST_ch4_init[] = {
7793 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7794 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7795 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7796 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
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_ch6_init[] = {
7807 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7808 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7809 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7810 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7811 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7812 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7813 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7814 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7821 static struct hda_verb alc883_4ST_ch8_init[] = {
7822 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7823 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7824 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7825 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7826 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7827 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7828 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7829 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7830 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7834 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7835 { 2, alc883_4ST_ch2_init },
7836 { 4, alc883_4ST_ch4_init },
7837 { 6, alc883_4ST_ch6_init },
7838 { 8, alc883_4ST_ch8_init },
7845 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7846 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7847 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7848 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7849 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7856 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7857 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7858 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7859 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7860 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7861 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7868 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7869 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7870 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7871 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7872 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7873 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7874 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7878 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7879 { 2, alc883_3ST_ch2_intel_init },
7880 { 4, alc883_3ST_ch4_intel_init },
7881 { 6, alc883_3ST_ch6_intel_init },
7887 static struct hda_verb alc883_sixstack_ch6_init[] = {
7888 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7889 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7890 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7891 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7898 static struct hda_verb alc883_sixstack_ch8_init[] = {
7899 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7900 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7901 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7902 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7906 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7907 { 6, alc883_sixstack_ch6_init },
7908 { 8, alc883_sixstack_ch8_init },
7911 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7912 static struct hda_verb alc889A_mb31_ch2_init[] = {
7913 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7914 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7915 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7916 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7920 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7921 static struct hda_verb alc889A_mb31_ch4_init[] = {
7922 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7923 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7924 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7925 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7929 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7930 static struct hda_verb alc889A_mb31_ch5_init[] = {
7931 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7932 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7938 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7939 static struct hda_verb alc889A_mb31_ch6_init[] = {
7940 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7942 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7947 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7948 { 2, alc889A_mb31_ch2_init },
7949 { 4, alc889A_mb31_ch4_init },
7950 { 5, alc889A_mb31_ch5_init },
7951 { 6, alc889A_mb31_ch6_init },
7954 static struct hda_verb alc883_medion_eapd_verbs[] = {
7955 /* eanable EAPD on medion laptop */
7956 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7957 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7961 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7962 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7965 static struct snd_kcontrol_new alc883_base_mixer[] = {
7966 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7967 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7968 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7969 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7970 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7971 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7972 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7973 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7975 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7976 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7977 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7978 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7980 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7986 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7990 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7991 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7992 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7993 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7994 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7995 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7996 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8000 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8001 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8002 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8003 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8007 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8008 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8009 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8011 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8017 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8021 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8022 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8023 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8025 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8029 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8030 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8031 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8035 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8036 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8037 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8038 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8039 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8040 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8042 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8044 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8045 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8046 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8047 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8048 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8052 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8053 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8054 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8056 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8057 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8058 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8059 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8060 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8062 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8063 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8064 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8065 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8069 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8070 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8071 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8075 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8076 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8077 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8079 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8080 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8082 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8083 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8084 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8085 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8086 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8087 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8088 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8089 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8091 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8093 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8094 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8095 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8099 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8101 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8103 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8104 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8105 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8106 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8107 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8108 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8114 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8115 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8116 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8117 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8118 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8122 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8124 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8125 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8126 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8127 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8128 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8129 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8130 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8131 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8132 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8133 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8134 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8135 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8142 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8143 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8144 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8145 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8146 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8147 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8149 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8151 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8152 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8153 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8157 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8160 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8161 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8162 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8164 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8169 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8170 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8171 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8173 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8174 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8177 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8178 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8182 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8184 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8185 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8186 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8187 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8190 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8191 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8195 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8197 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8202 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8207 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8208 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8209 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8210 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8211 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8212 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8213 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8215 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8220 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8221 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8222 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8224 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8225 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8226 0x0d, 1, 0x0, HDA_OUTPUT),
8227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8230 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8231 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8235 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8237 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8239 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8240 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8241 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8245 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8247 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8248 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8250 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8251 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8253 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8254 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8255 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8256 /* Output switches */
8257 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8258 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8259 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8261 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8262 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8266 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8267 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8271 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8273 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8276 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8277 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8281 static struct hda_bind_ctls alc883_bind_cap_vol = {
8282 .ops = &snd_hda_bind_vol,
8284 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8285 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8290 static struct hda_bind_ctls alc883_bind_cap_switch = {
8291 .ops = &snd_hda_bind_sw,
8293 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8294 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8299 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8300 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8301 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8302 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8303 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8304 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8306 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8311 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8312 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8313 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8315 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8316 /* .name = "Capture Source", */
8317 .name = "Input Source",
8319 .info = alc_mux_enum_info,
8320 .get = alc_mux_enum_get,
8321 .put = alc_mux_enum_put,
8326 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8328 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8329 .name = "Channel Mode",
8330 .info = alc_ch_mode_info,
8331 .get = alc_ch_mode_get,
8332 .put = alc_ch_mode_put,
8337 static struct hda_verb alc883_init_verbs[] = {
8338 /* ADC1: mute amp left and right */
8339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8340 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8341 /* ADC2: mute amp left and right */
8342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8343 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8344 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8350 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8351 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8353 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8361 /* mute analog input loopbacks */
8362 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8363 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8364 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8368 /* Front Pin: output 0 (0x0c) */
8369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8370 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8371 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8372 /* Rear Pin: output 1 (0x0d) */
8373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8374 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8375 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8376 /* CLFE Pin: output 2 (0x0e) */
8377 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8378 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8379 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8380 /* Side Pin: output 3 (0x0f) */
8381 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8382 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8383 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8384 /* Mic (rear) pin: input vref at 80% */
8385 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8386 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8387 /* Front Mic pin: input vref at 80% */
8388 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8389 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8390 /* Line In pin: input */
8391 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8392 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8393 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8394 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8395 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8396 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8397 /* CD pin widget for input */
8398 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8400 /* FIXME: use matrix-type input source selection */
8401 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8408 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8415 /* toggle speaker-output according to the hp-jack state */
8416 static void alc883_mitac_init_hook(struct hda_codec *codec)
8418 struct alc_spec *spec = codec->spec;
8420 spec->autocfg.hp_pins[0] = 0x15;
8421 spec->autocfg.speaker_pins[0] = 0x14;
8422 spec->autocfg.speaker_pins[1] = 0x17;
8423 alc_automute_amp(codec);
8426 /* auto-toggle front mic */
8428 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8430 unsigned int present;
8433 present = snd_hda_codec_read(codec, 0x18, 0,
8434 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8435 bits = present ? HDA_AMP_MUTE : 0;
8436 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8440 static struct hda_verb alc883_mitac_verbs[] = {
8442 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8445 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8446 {0x17, 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_clevo_m720_verbs[] = {
8457 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8458 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8460 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8461 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8463 /* enable unsolicited event */
8464 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8465 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8470 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8472 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8475 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8478 /* enable unsolicited event */
8479 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8484 static struct hda_verb alc883_targa_verbs[] = {
8485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8486 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8488 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8491 /* Connect Line-Out side jack (SPDIF) to Side */
8492 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8493 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8494 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8495 /* Connect Mic jack to CLFE */
8496 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8497 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8498 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8499 /* Connect Line-in jack to Surround */
8500 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8501 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8502 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8503 /* Connect HP out jack to Front */
8504 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8505 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8506 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8508 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8513 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8514 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8515 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8516 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8520 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8523 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8524 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8528 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8531 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8532 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8533 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8537 static struct hda_verb alc883_haier_w66_verbs[] = {
8538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8541 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8543 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8544 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8545 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8550 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8553 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8554 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8555 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8556 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8557 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8558 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8562 static struct hda_verb alc888_6st_dell_verbs[] = {
8563 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8567 static struct hda_verb alc883_vaiott_verbs[] = {
8569 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8572 /* enable unsolicited event */
8573 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8578 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8580 struct alc_spec *spec = codec->spec;
8582 spec->autocfg.hp_pins[0] = 0x1b;
8583 spec->autocfg.speaker_pins[0] = 0x14;
8584 spec->autocfg.speaker_pins[1] = 0x16;
8585 spec->autocfg.speaker_pins[2] = 0x18;
8586 alc_automute_amp(codec);
8589 static struct hda_verb alc888_3st_hp_verbs[] = {
8590 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8591 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8592 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8593 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8600 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8601 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8602 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8603 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8604 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8611 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8612 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8613 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8614 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8615 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8616 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8623 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8624 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8625 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8626 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8627 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8628 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8629 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8633 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8634 { 2, alc888_3st_hp_2ch_init },
8635 { 4, alc888_3st_hp_4ch_init },
8636 { 6, alc888_3st_hp_6ch_init },
8639 /* toggle front-jack and RCA according to the hp-jack state */
8640 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8642 unsigned int present;
8644 present = snd_hda_codec_read(codec, 0x1b, 0,
8645 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8646 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8647 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8648 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8649 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8652 /* toggle RCA according to the front-jack state */
8653 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8655 unsigned int present;
8657 present = snd_hda_codec_read(codec, 0x14, 0,
8658 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8659 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8660 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8663 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8666 if ((res >> 26) == ALC880_HP_EVENT)
8667 alc888_lenovo_ms7195_front_automute(codec);
8668 if ((res >> 26) == ALC880_FRONT_EVENT)
8669 alc888_lenovo_ms7195_rca_automute(codec);
8672 static struct hda_verb alc883_medion_md2_verbs[] = {
8673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8676 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8678 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8682 /* toggle speaker-output according to the hp-jack state */
8683 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8685 struct alc_spec *spec = codec->spec;
8687 spec->autocfg.hp_pins[0] = 0x14;
8688 spec->autocfg.speaker_pins[0] = 0x15;
8689 alc_automute_amp(codec);
8692 /* toggle speaker-output according to the hp-jack state */
8693 #define alc883_targa_init_hook alc882_targa_init_hook
8694 #define alc883_targa_unsol_event alc882_targa_unsol_event
8696 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8698 unsigned int present;
8700 present = snd_hda_codec_read(codec, 0x18, 0,
8701 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8702 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8703 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8706 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8708 struct alc_spec *spec = codec->spec;
8710 spec->autocfg.hp_pins[0] = 0x15;
8711 spec->autocfg.speaker_pins[0] = 0x14;
8712 alc_automute_amp(codec);
8713 alc883_clevo_m720_mic_automute(codec);
8716 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8719 switch (res >> 26) {
8720 case ALC880_MIC_EVENT:
8721 alc883_clevo_m720_mic_automute(codec);
8724 alc_automute_amp_unsol_event(codec, res);
8729 /* toggle speaker-output according to the hp-jack state */
8730 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8732 struct alc_spec *spec = codec->spec;
8734 spec->autocfg.hp_pins[0] = 0x14;
8735 spec->autocfg.speaker_pins[0] = 0x15;
8736 alc_automute_amp(codec);
8739 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8741 struct alc_spec *spec = codec->spec;
8743 spec->autocfg.hp_pins[0] = 0x1b;
8744 spec->autocfg.speaker_pins[0] = 0x14;
8745 alc_automute_amp(codec);
8748 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8750 unsigned int present;
8753 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8754 & AC_PINSENSE_PRESENCE;
8755 bits = present ? HDA_AMP_MUTE : 0;
8756 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8757 HDA_AMP_MUTE, bits);
8760 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8762 unsigned int present;
8765 present = snd_hda_codec_read(codec, 0x1b, 0,
8766 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8767 bits = present ? HDA_AMP_MUTE : 0;
8768 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8769 HDA_AMP_MUTE, bits);
8770 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8771 HDA_AMP_MUTE, bits);
8774 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8777 if ((res >> 26) == ALC880_HP_EVENT)
8778 alc883_lenovo_101e_all_automute(codec);
8779 if ((res >> 26) == ALC880_FRONT_EVENT)
8780 alc883_lenovo_101e_ispeaker_automute(codec);
8783 /* toggle speaker-output according to the hp-jack state */
8784 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8786 struct alc_spec *spec = codec->spec;
8788 spec->autocfg.hp_pins[0] = 0x14;
8789 spec->autocfg.speaker_pins[0] = 0x15;
8790 spec->autocfg.speaker_pins[1] = 0x16;
8791 alc_automute_amp(codec);
8794 static struct hda_verb alc883_acer_eapd_verbs[] = {
8795 /* HP Pin: output 0 (0x0c) */
8796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8798 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8799 /* Front Pin: output 0 (0x0c) */
8800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8801 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8802 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8803 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8804 /* eanable EAPD on medion laptop */
8805 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8806 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8807 /* enable unsolicited event */
8808 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8812 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8814 struct alc_spec *spec = codec->spec;
8816 spec->autocfg.hp_pins[0] = 0x1b;
8817 spec->autocfg.speaker_pins[0] = 0x14;
8818 spec->autocfg.speaker_pins[1] = 0x15;
8819 spec->autocfg.speaker_pins[2] = 0x16;
8820 spec->autocfg.speaker_pins[3] = 0x17;
8821 alc_automute_amp(codec);
8824 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8826 struct alc_spec *spec = codec->spec;
8828 spec->autocfg.hp_pins[0] = 0x1b;
8829 spec->autocfg.speaker_pins[0] = 0x14;
8830 spec->autocfg.speaker_pins[1] = 0x15;
8831 spec->autocfg.speaker_pins[2] = 0x16;
8832 spec->autocfg.speaker_pins[3] = 0x17;
8833 spec->autocfg.speaker_pins[4] = 0x1a;
8834 alc_automute_amp(codec);
8837 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8839 struct alc_spec *spec = codec->spec;
8841 spec->autocfg.hp_pins[0] = 0x15;
8842 spec->autocfg.speaker_pins[0] = 0x14;
8843 spec->autocfg.speaker_pins[1] = 0x17;
8844 alc_automute_amp(codec);
8848 * generic initialization of ADC, input mixers and output mixers
8850 static struct hda_verb alc883_auto_init_verbs[] = {
8852 * Unmute ADC0-2 and set the default input to mic-in
8854 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8856 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8857 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8859 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8861 * Note: PASD motherboards uses the Line In 2 as the input for
8862 * front panel mic (mic 2)
8864 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8865 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8866 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8867 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8868 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8872 * Set up output mixers (0x0c - 0x0f)
8874 /* set vol=0 to output mixers */
8875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8877 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8878 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8879 /* set up input amps for analog loopback */
8880 /* Amp Indices: DAC = 0, mixer = 1 */
8881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8886 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8888 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8889 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8890 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8892 /* FIXME: use matrix-type input source selection */
8893 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8895 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8896 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8897 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8898 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8899 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8904 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8905 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8910 static struct hda_verb alc888_asus_m90v_verbs[] = {
8911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8912 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8913 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8914 /* enable unsolicited event */
8915 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8916 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8920 static void alc883_nb_mic_automute(struct hda_codec *codec)
8922 unsigned int present;
8924 present = snd_hda_codec_read(codec, 0x18, 0,
8925 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8926 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8927 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8928 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8929 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8932 static void alc883_M90V_init_hook(struct hda_codec *codec)
8934 struct alc_spec *spec = codec->spec;
8936 spec->autocfg.hp_pins[0] = 0x1b;
8937 spec->autocfg.speaker_pins[0] = 0x14;
8938 spec->autocfg.speaker_pins[1] = 0x15;
8939 spec->autocfg.speaker_pins[2] = 0x16;
8940 alc_automute_pin(codec);
8943 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8946 switch (res >> 26) {
8947 case ALC880_MIC_EVENT:
8948 alc883_nb_mic_automute(codec);
8951 alc_sku_unsol_event(codec, res);
8956 static void alc883_mode2_inithook(struct hda_codec *codec)
8958 alc883_M90V_init_hook(codec);
8959 alc883_nb_mic_automute(codec);
8962 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8963 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8966 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8967 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8968 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8969 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8970 /* enable unsolicited event */
8971 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8975 static void alc883_eee1601_inithook(struct hda_codec *codec)
8977 struct alc_spec *spec = codec->spec;
8979 spec->autocfg.hp_pins[0] = 0x14;
8980 spec->autocfg.speaker_pins[0] = 0x1b;
8981 alc_automute_pin(codec);
8984 static struct hda_verb alc889A_mb31_verbs[] = {
8985 /* Init rear pin (used as headphone output) */
8986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8987 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8988 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8989 /* Init line pin (used as output in 4ch and 6ch mode) */
8990 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8991 /* Init line 2 pin (used as headphone out by default) */
8992 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8993 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8997 /* Mute speakers according to the headphone jack state */
8998 static void alc889A_mb31_automute(struct hda_codec *codec)
9000 unsigned int present;
9002 /* Mute only in 2ch or 4ch mode */
9003 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9005 present = snd_hda_codec_read(codec, 0x15, 0,
9006 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
9007 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9008 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9009 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9010 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9014 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9016 if ((res >> 26) == ALC880_HP_EVENT)
9017 alc889A_mb31_automute(codec);
9020 #ifdef CONFIG_SND_HDA_POWER_SAVE
9021 #define alc883_loopbacks alc880_loopbacks
9024 /* pcm configuration: identical with ALC880 */
9025 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
9026 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
9027 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
9028 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
9029 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
9032 * configuration and preset
9034 static const char *alc883_models[ALC883_MODEL_LAST] = {
9035 [ALC883_3ST_2ch_DIG] = "3stack-dig",
9036 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9037 [ALC883_3ST_6ch] = "3stack-6ch",
9038 [ALC883_6ST_DIG] = "6stack-dig",
9039 [ALC883_TARGA_DIG] = "targa-dig",
9040 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9041 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9042 [ALC883_ACER] = "acer",
9043 [ALC883_ACER_ASPIRE] = "acer-aspire",
9044 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9045 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9046 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9047 [ALC883_MEDION] = "medion",
9048 [ALC883_MEDION_MD2] = "medion-md2",
9049 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9050 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9051 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9052 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9053 [ALC888_LENOVO_SKY] = "lenovo-sky",
9054 [ALC883_HAIER_W66] = "haier-w66",
9055 [ALC888_3ST_HP] = "3stack-hp",
9056 [ALC888_6ST_DELL] = "6stack-dell",
9057 [ALC883_MITAC] = "mitac",
9058 [ALC883_CLEVO_M720] = "clevo-m720",
9059 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9060 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9061 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9062 [ALC1200_ASUS_P5Q] = "asus-p5q",
9063 [ALC889A_MB31] = "mb31",
9064 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9065 [ALC883_AUTO] = "auto",
9068 static struct snd_pci_quirk alc883_cfg_tbl[] = {
9069 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
9070 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9071 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9072 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9073 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9074 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9075 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9076 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9077 ALC888_ACER_ASPIRE_4930G),
9078 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9079 ALC888_ACER_ASPIRE_4930G),
9080 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9081 ALC888_ACER_ASPIRE_8930G),
9082 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9083 ALC888_ACER_ASPIRE_8930G),
9084 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
9085 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
9086 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9087 ALC888_ACER_ASPIRE_6530G),
9088 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9089 ALC888_ACER_ASPIRE_6530G),
9090 /* default Acer -- disabled as it causes more problems.
9091 * model=auto should work fine now
9093 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9094 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9095 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9096 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9097 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9098 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9099 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9100 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9101 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9102 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9103 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9104 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9105 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9106 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9107 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
9108 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9109 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9110 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9111 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9112 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9113 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
9114 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9115 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9116 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9117 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
9118 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9119 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9120 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9121 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9122 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9123 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9124 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9125 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9126 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9127 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9128 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9129 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9130 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9131 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9132 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9133 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9134 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9135 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9136 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9137 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9138 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9139 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9140 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9141 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9142 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9143 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9144 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9145 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9146 ALC883_FUJITSU_PI2515),
9147 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9148 ALC888_FUJITSU_XA3530),
9149 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9150 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9151 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9152 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9153 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9154 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9155 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9156 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9157 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9158 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9159 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9160 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9161 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
9162 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9163 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9167 static hda_nid_t alc883_slave_dig_outs[] = {
9168 ALC1200_DIGOUT_NID, 0,
9171 static hda_nid_t alc1200_slave_dig_outs[] = {
9172 ALC883_DIGOUT_NID, 0,
9175 static struct alc_config_preset alc883_presets[] = {
9176 [ALC883_3ST_2ch_DIG] = {
9177 .mixers = { alc883_3ST_2ch_mixer },
9178 .init_verbs = { alc883_init_verbs },
9179 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9180 .dac_nids = alc883_dac_nids,
9181 .dig_out_nid = ALC883_DIGOUT_NID,
9182 .dig_in_nid = ALC883_DIGIN_NID,
9183 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9184 .channel_mode = alc883_3ST_2ch_modes,
9185 .input_mux = &alc883_capture_source,
9187 [ALC883_3ST_6ch_DIG] = {
9188 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9189 .init_verbs = { alc883_init_verbs },
9190 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9191 .dac_nids = alc883_dac_nids,
9192 .dig_out_nid = ALC883_DIGOUT_NID,
9193 .dig_in_nid = ALC883_DIGIN_NID,
9194 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9195 .channel_mode = alc883_3ST_6ch_modes,
9197 .input_mux = &alc883_capture_source,
9199 [ALC883_3ST_6ch] = {
9200 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9201 .init_verbs = { alc883_init_verbs },
9202 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9203 .dac_nids = alc883_dac_nids,
9204 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9205 .channel_mode = alc883_3ST_6ch_modes,
9207 .input_mux = &alc883_capture_source,
9209 [ALC883_3ST_6ch_INTEL] = {
9210 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9211 .init_verbs = { alc883_init_verbs },
9212 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9213 .dac_nids = alc883_dac_nids,
9214 .dig_out_nid = ALC883_DIGOUT_NID,
9215 .dig_in_nid = ALC883_DIGIN_NID,
9216 .slave_dig_outs = alc883_slave_dig_outs,
9217 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9218 .channel_mode = alc883_3ST_6ch_intel_modes,
9220 .input_mux = &alc883_3stack_6ch_intel,
9222 [ALC883_6ST_DIG] = {
9223 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9224 .init_verbs = { alc883_init_verbs },
9225 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9226 .dac_nids = alc883_dac_nids,
9227 .dig_out_nid = ALC883_DIGOUT_NID,
9228 .dig_in_nid = ALC883_DIGIN_NID,
9229 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9230 .channel_mode = alc883_sixstack_modes,
9231 .input_mux = &alc883_capture_source,
9233 [ALC883_TARGA_DIG] = {
9234 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9235 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
9236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9237 .dac_nids = alc883_dac_nids,
9238 .dig_out_nid = ALC883_DIGOUT_NID,
9239 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9240 .channel_mode = alc883_3ST_6ch_modes,
9242 .input_mux = &alc883_capture_source,
9243 .unsol_event = alc883_targa_unsol_event,
9244 .init_hook = alc883_targa_init_hook,
9246 [ALC883_TARGA_2ch_DIG] = {
9247 .mixers = { alc883_targa_2ch_mixer},
9248 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
9249 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9250 .dac_nids = alc883_dac_nids,
9251 .adc_nids = alc883_adc_nids_alt,
9252 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9253 .dig_out_nid = ALC883_DIGOUT_NID,
9254 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9255 .channel_mode = alc883_3ST_2ch_modes,
9256 .input_mux = &alc883_capture_source,
9257 .unsol_event = alc883_targa_unsol_event,
9258 .init_hook = alc883_targa_init_hook,
9260 [ALC883_TARGA_8ch_DIG] = {
9261 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9262 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9263 alc883_targa_verbs },
9264 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9265 .dac_nids = alc883_dac_nids,
9266 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9267 .adc_nids = alc883_adc_nids_rev,
9268 .capsrc_nids = alc883_capsrc_nids_rev,
9269 .dig_out_nid = ALC883_DIGOUT_NID,
9270 .dig_in_nid = ALC883_DIGIN_NID,
9271 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9272 .channel_mode = alc883_4ST_8ch_modes,
9274 .input_mux = &alc883_capture_source,
9275 .unsol_event = alc883_targa_unsol_event,
9276 .init_hook = alc883_targa_init_hook,
9279 .mixers = { alc883_base_mixer },
9280 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9281 * and the headphone jack. Turn this on and rely on the
9282 * standard mute methods whenever the user wants to turn
9283 * these outputs off.
9285 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9287 .dac_nids = alc883_dac_nids,
9288 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9289 .channel_mode = alc883_3ST_2ch_modes,
9290 .input_mux = &alc883_capture_source,
9292 [ALC883_ACER_ASPIRE] = {
9293 .mixers = { alc883_acer_aspire_mixer },
9294 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9295 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9296 .dac_nids = alc883_dac_nids,
9297 .dig_out_nid = ALC883_DIGOUT_NID,
9298 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9299 .channel_mode = alc883_3ST_2ch_modes,
9300 .input_mux = &alc883_capture_source,
9301 .unsol_event = alc_automute_amp_unsol_event,
9302 .init_hook = alc883_acer_aspire_init_hook,
9304 [ALC888_ACER_ASPIRE_4930G] = {
9305 .mixers = { alc888_base_mixer,
9306 alc883_chmode_mixer },
9307 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9308 alc888_acer_aspire_4930g_verbs },
9309 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9310 .dac_nids = alc883_dac_nids,
9311 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9312 .adc_nids = alc883_adc_nids_rev,
9313 .capsrc_nids = alc883_capsrc_nids_rev,
9314 .dig_out_nid = ALC883_DIGOUT_NID,
9315 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9316 .channel_mode = alc883_3ST_6ch_modes,
9319 ARRAY_SIZE(alc888_2_capture_sources),
9320 .input_mux = alc888_2_capture_sources,
9321 .unsol_event = alc_automute_amp_unsol_event,
9322 .init_hook = alc888_acer_aspire_4930g_init_hook,
9324 [ALC888_ACER_ASPIRE_6530G] = {
9325 .mixers = { alc888_acer_aspire_6530_mixer },
9326 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9327 alc888_acer_aspire_6530g_verbs },
9328 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9329 .dac_nids = alc883_dac_nids,
9330 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9331 .adc_nids = alc883_adc_nids_rev,
9332 .capsrc_nids = alc883_capsrc_nids_rev,
9333 .dig_out_nid = ALC883_DIGOUT_NID,
9334 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9335 .channel_mode = alc883_3ST_2ch_modes,
9337 ARRAY_SIZE(alc888_2_capture_sources),
9338 .input_mux = alc888_acer_aspire_6530_sources,
9339 .unsol_event = alc_automute_amp_unsol_event,
9340 .init_hook = alc888_acer_aspire_6530g_init_hook,
9342 [ALC888_ACER_ASPIRE_8930G] = {
9343 .mixers = { alc888_base_mixer,
9344 alc883_chmode_mixer },
9345 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9346 alc889_acer_aspire_8930g_verbs },
9347 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9348 .dac_nids = alc883_dac_nids,
9349 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9350 .adc_nids = alc889_adc_nids,
9351 .capsrc_nids = alc889_capsrc_nids,
9352 .dig_out_nid = ALC883_DIGOUT_NID,
9353 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9354 .channel_mode = alc883_3ST_6ch_modes,
9356 .const_channel_count = 6,
9358 ARRAY_SIZE(alc889_capture_sources),
9359 .input_mux = alc889_capture_sources,
9360 .unsol_event = alc_automute_amp_unsol_event,
9361 .init_hook = alc889_acer_aspire_8930g_init_hook,
9364 .mixers = { alc883_fivestack_mixer,
9365 alc883_chmode_mixer },
9366 .init_verbs = { alc883_init_verbs,
9367 alc883_medion_eapd_verbs },
9368 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9369 .dac_nids = alc883_dac_nids,
9370 .adc_nids = alc883_adc_nids_alt,
9371 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9372 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9373 .channel_mode = alc883_sixstack_modes,
9374 .input_mux = &alc883_capture_source,
9376 [ALC883_MEDION_MD2] = {
9377 .mixers = { alc883_medion_md2_mixer},
9378 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9379 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9380 .dac_nids = alc883_dac_nids,
9381 .dig_out_nid = ALC883_DIGOUT_NID,
9382 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9383 .channel_mode = alc883_3ST_2ch_modes,
9384 .input_mux = &alc883_capture_source,
9385 .unsol_event = alc_automute_amp_unsol_event,
9386 .init_hook = alc883_medion_md2_init_hook,
9388 [ALC883_LAPTOP_EAPD] = {
9389 .mixers = { alc883_base_mixer },
9390 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9391 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9392 .dac_nids = alc883_dac_nids,
9393 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9394 .channel_mode = alc883_3ST_2ch_modes,
9395 .input_mux = &alc883_capture_source,
9397 [ALC883_CLEVO_M720] = {
9398 .mixers = { alc883_clevo_m720_mixer },
9399 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9400 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9401 .dac_nids = alc883_dac_nids,
9402 .dig_out_nid = ALC883_DIGOUT_NID,
9403 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9404 .channel_mode = alc883_3ST_2ch_modes,
9405 .input_mux = &alc883_capture_source,
9406 .unsol_event = alc883_clevo_m720_unsol_event,
9407 .init_hook = alc883_clevo_m720_init_hook,
9409 [ALC883_LENOVO_101E_2ch] = {
9410 .mixers = { alc883_lenovo_101e_2ch_mixer},
9411 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9412 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9413 .dac_nids = alc883_dac_nids,
9414 .adc_nids = alc883_adc_nids_alt,
9415 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9416 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9417 .channel_mode = alc883_3ST_2ch_modes,
9418 .input_mux = &alc883_lenovo_101e_capture_source,
9419 .unsol_event = alc883_lenovo_101e_unsol_event,
9420 .init_hook = alc883_lenovo_101e_all_automute,
9422 [ALC883_LENOVO_NB0763] = {
9423 .mixers = { alc883_lenovo_nb0763_mixer },
9424 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9425 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9426 .dac_nids = alc883_dac_nids,
9427 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9428 .channel_mode = alc883_3ST_2ch_modes,
9430 .input_mux = &alc883_lenovo_nb0763_capture_source,
9431 .unsol_event = alc_automute_amp_unsol_event,
9432 .init_hook = alc883_medion_md2_init_hook,
9434 [ALC888_LENOVO_MS7195_DIG] = {
9435 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9436 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9437 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9438 .dac_nids = alc883_dac_nids,
9439 .dig_out_nid = ALC883_DIGOUT_NID,
9440 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9441 .channel_mode = alc883_3ST_6ch_modes,
9443 .input_mux = &alc883_capture_source,
9444 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9445 .init_hook = alc888_lenovo_ms7195_front_automute,
9447 [ALC883_HAIER_W66] = {
9448 .mixers = { alc883_targa_2ch_mixer},
9449 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9450 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9451 .dac_nids = alc883_dac_nids,
9452 .dig_out_nid = ALC883_DIGOUT_NID,
9453 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9454 .channel_mode = alc883_3ST_2ch_modes,
9455 .input_mux = &alc883_capture_source,
9456 .unsol_event = alc_automute_amp_unsol_event,
9457 .init_hook = alc883_haier_w66_init_hook,
9460 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9461 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9462 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9463 .dac_nids = alc883_dac_nids,
9464 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9465 .channel_mode = alc888_3st_hp_modes,
9467 .input_mux = &alc883_capture_source,
9468 .unsol_event = alc_automute_amp_unsol_event,
9469 .init_hook = alc888_3st_hp_init_hook,
9471 [ALC888_6ST_DELL] = {
9472 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9473 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9474 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9475 .dac_nids = alc883_dac_nids,
9476 .dig_out_nid = ALC883_DIGOUT_NID,
9477 .dig_in_nid = ALC883_DIGIN_NID,
9478 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9479 .channel_mode = alc883_sixstack_modes,
9480 .input_mux = &alc883_capture_source,
9481 .unsol_event = alc_automute_amp_unsol_event,
9482 .init_hook = alc888_6st_dell_init_hook,
9485 .mixers = { alc883_mitac_mixer },
9486 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9487 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9488 .dac_nids = alc883_dac_nids,
9489 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9490 .channel_mode = alc883_3ST_2ch_modes,
9491 .input_mux = &alc883_capture_source,
9492 .unsol_event = alc_automute_amp_unsol_event,
9493 .init_hook = alc883_mitac_init_hook,
9495 [ALC883_FUJITSU_PI2515] = {
9496 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9497 .init_verbs = { alc883_init_verbs,
9498 alc883_2ch_fujitsu_pi2515_verbs},
9499 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9500 .dac_nids = alc883_dac_nids,
9501 .dig_out_nid = ALC883_DIGOUT_NID,
9502 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9503 .channel_mode = alc883_3ST_2ch_modes,
9504 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9505 .unsol_event = alc_automute_amp_unsol_event,
9506 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9508 [ALC888_FUJITSU_XA3530] = {
9509 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9510 .init_verbs = { alc883_init_verbs,
9511 alc888_fujitsu_xa3530_verbs },
9512 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9513 .dac_nids = alc883_dac_nids,
9514 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9515 .adc_nids = alc883_adc_nids_rev,
9516 .capsrc_nids = alc883_capsrc_nids_rev,
9517 .dig_out_nid = ALC883_DIGOUT_NID,
9518 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9519 .channel_mode = alc888_4ST_8ch_intel_modes,
9521 ARRAY_SIZE(alc888_2_capture_sources),
9522 .input_mux = alc888_2_capture_sources,
9523 .unsol_event = alc_automute_amp_unsol_event,
9524 .init_hook = alc888_fujitsu_xa3530_init_hook,
9526 [ALC888_LENOVO_SKY] = {
9527 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9528 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9529 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9530 .dac_nids = alc883_dac_nids,
9531 .dig_out_nid = ALC883_DIGOUT_NID,
9532 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9533 .channel_mode = alc883_sixstack_modes,
9535 .input_mux = &alc883_lenovo_sky_capture_source,
9536 .unsol_event = alc_automute_amp_unsol_event,
9537 .init_hook = alc888_lenovo_sky_init_hook,
9539 [ALC888_ASUS_M90V] = {
9540 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9541 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_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_6ch_modes),
9547 .channel_mode = alc883_3ST_6ch_modes,
9549 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9550 .unsol_event = alc883_mode2_unsol_event,
9551 .init_hook = alc883_mode2_inithook,
9553 [ALC888_ASUS_EEE1601] = {
9554 .mixers = { alc883_asus_eee1601_mixer },
9555 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9556 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9557 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9558 .dac_nids = alc883_dac_nids,
9559 .dig_out_nid = ALC883_DIGOUT_NID,
9560 .dig_in_nid = ALC883_DIGIN_NID,
9561 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9562 .channel_mode = alc883_3ST_2ch_modes,
9564 .input_mux = &alc883_asus_eee1601_capture_source,
9565 .unsol_event = alc_sku_unsol_event,
9566 .init_hook = alc883_eee1601_inithook,
9568 [ALC1200_ASUS_P5Q] = {
9569 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9570 .init_verbs = { alc883_init_verbs },
9571 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9572 .dac_nids = alc883_dac_nids,
9573 .dig_out_nid = ALC1200_DIGOUT_NID,
9574 .dig_in_nid = ALC883_DIGIN_NID,
9575 .slave_dig_outs = alc1200_slave_dig_outs,
9576 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9577 .channel_mode = alc883_sixstack_modes,
9578 .input_mux = &alc883_capture_source,
9581 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9582 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9583 alc880_gpio1_init_verbs },
9584 .adc_nids = alc883_adc_nids,
9585 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9586 .dac_nids = alc883_dac_nids,
9587 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9588 .channel_mode = alc889A_mb31_6ch_modes,
9589 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9590 .input_mux = &alc889A_mb31_capture_source,
9591 .dig_out_nid = ALC883_DIGOUT_NID,
9592 .unsol_event = alc889A_mb31_unsol_event,
9593 .init_hook = alc889A_mb31_automute,
9595 [ALC883_SONY_VAIO_TT] = {
9596 .mixers = { alc883_vaiott_mixer },
9597 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9598 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9599 .dac_nids = alc883_dac_nids,
9600 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9601 .channel_mode = alc883_3ST_2ch_modes,
9602 .input_mux = &alc883_capture_source,
9603 .unsol_event = alc_automute_amp_unsol_event,
9604 .init_hook = alc883_vaiott_init_hook,
9610 * BIOS auto configuration
9612 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9613 hda_nid_t nid, int pin_type,
9617 struct alc_spec *spec = codec->spec;
9620 alc_set_pin_output(codec, nid, pin_type);
9621 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9624 idx = spec->multiout.dac_nids[dac_idx] - 2;
9625 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9629 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9631 struct alc_spec *spec = codec->spec;
9634 for (i = 0; i <= HDA_SIDE; i++) {
9635 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9636 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9638 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9643 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9645 struct alc_spec *spec = codec->spec;
9648 pin = spec->autocfg.hp_pins[0];
9649 if (pin) /* connect to front */
9651 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9652 pin = spec->autocfg.speaker_pins[0];
9654 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9657 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9658 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9660 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9662 struct alc_spec *spec = codec->spec;
9665 for (i = 0; i < AUTO_PIN_LAST; i++) {
9666 hda_nid_t nid = spec->autocfg.input_pins[i];
9667 if (alc883_is_input_pin(nid)) {
9668 alc_set_input_pin(codec, nid, i);
9669 if (nid != ALC883_PIN_CD_NID &&
9670 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9671 snd_hda_codec_write(codec, nid, 0,
9672 AC_VERB_SET_AMP_GAIN_MUTE,
9678 #define alc883_auto_init_input_src alc882_auto_init_input_src
9680 /* almost identical with ALC880 parser... */
9681 static int alc883_parse_auto_config(struct hda_codec *codec)
9683 struct alc_spec *spec = codec->spec;
9684 int err = alc880_parse_auto_config(codec);
9685 struct auto_pin_cfg *cfg = &spec->autocfg;
9691 return 0; /* no config found */
9693 err = alc_auto_add_mic_boost(codec);
9697 /* hack - override the init verbs */
9698 spec->init_verbs[0] = alc883_auto_init_verbs;
9700 /* setup input_mux for ALC889 */
9701 if (codec->vendor_id == 0x10ec0889) {
9702 /* digital-mic input pin is excluded in alc880_auto_create..()
9703 * because it's under 0x18
9705 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9706 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9707 struct hda_input_mux *imux = &spec->private_imux[0];
9708 for (i = 1; i < 3; i++)
9709 memcpy(&spec->private_imux[i],
9710 &spec->private_imux[0],
9711 sizeof(spec->private_imux[0]));
9712 imux->items[imux->num_items].label = "Int DMic";
9713 imux->items[imux->num_items].index = 0x0b;
9715 spec->num_mux_defs = 3;
9716 spec->input_mux = spec->private_imux;
9720 return 1; /* config found */
9723 /* additional initialization for auto-configuration model */
9724 static void alc883_auto_init(struct hda_codec *codec)
9726 struct alc_spec *spec = codec->spec;
9727 alc883_auto_init_multi_out(codec);
9728 alc883_auto_init_hp_out(codec);
9729 alc883_auto_init_analog_input(codec);
9730 alc883_auto_init_input_src(codec);
9731 if (spec->unsol_event)
9732 alc_inithook(codec);
9735 static int patch_alc883(struct hda_codec *codec)
9737 struct alc_spec *spec;
9738 int err, board_config;
9740 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9746 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9748 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9751 if (board_config < 0 || board_config >= ALC883_MODEL_LAST) {
9752 /* Pick up systems that don't supply PCI SSID */
9753 switch (codec->subsystem_id) {
9754 case 0x106b3600: /* Macbook 3.1 */
9755 board_config = ALC889A_MB31;
9759 "hda_codec: Unknown model for %s, trying "
9760 "auto-probe from BIOS...\n", codec->chip_name);
9761 board_config = ALC883_AUTO;
9765 if (board_config == ALC883_AUTO) {
9766 /* automatic parse from the BIOS config */
9767 err = alc883_parse_auto_config(codec);
9773 "hda_codec: Cannot set up configuration "
9774 "from BIOS. Using base mode...\n");
9775 board_config = ALC883_3ST_2ch_DIG;
9779 err = snd_hda_attach_beep_device(codec, 0x1);
9785 if (board_config != ALC883_AUTO)
9786 setup_preset(spec, &alc883_presets[board_config]);
9788 switch (codec->vendor_id) {
9790 if (!spec->num_adc_nids) {
9791 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9792 spec->adc_nids = alc883_adc_nids;
9794 if (!spec->capsrc_nids)
9795 spec->capsrc_nids = alc883_capsrc_nids;
9796 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9799 if (!spec->num_adc_nids) {
9800 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9801 spec->adc_nids = alc889_adc_nids;
9803 if (!spec->capsrc_nids)
9804 spec->capsrc_nids = alc889_capsrc_nids;
9807 if (!spec->num_adc_nids) {
9808 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9809 spec->adc_nids = alc883_adc_nids;
9811 if (!spec->capsrc_nids)
9812 spec->capsrc_nids = alc883_capsrc_nids;
9816 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9817 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9818 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9820 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9821 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9823 if (!spec->cap_mixer)
9824 set_capture_mixer(spec);
9825 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9827 spec->vmaster_nid = 0x0c;
9829 codec->patch_ops = alc_patch_ops;
9830 if (board_config == ALC883_AUTO)
9831 spec->init_hook = alc883_auto_init;
9833 #ifdef CONFIG_SND_HDA_POWER_SAVE
9834 if (!spec->loopback.amplist)
9835 spec->loopback.amplist = alc883_loopbacks;
9837 codec->proc_widget_hook = print_realtek_coef;
9846 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9847 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9849 #define alc262_dac_nids alc260_dac_nids
9850 #define alc262_adc_nids alc882_adc_nids
9851 #define alc262_adc_nids_alt alc882_adc_nids_alt
9852 #define alc262_capsrc_nids alc882_capsrc_nids
9853 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9855 #define alc262_modes alc260_modes
9856 #define alc262_capture_source alc882_capture_source
9858 static hda_nid_t alc262_dmic_adc_nids[1] = {
9863 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9865 static struct snd_kcontrol_new alc262_base_mixer[] = {
9866 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9867 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9868 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9869 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9870 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9871 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9872 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9873 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9874 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9877 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9878 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9879 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9880 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9881 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9885 /* update HP, line and mono-out pins according to the master switch */
9886 static void alc262_hp_master_update(struct hda_codec *codec)
9888 struct alc_spec *spec = codec->spec;
9889 int val = spec->master_sw;
9892 snd_hda_codec_write_cache(codec, 0x1b, 0,
9893 AC_VERB_SET_PIN_WIDGET_CONTROL,
9895 snd_hda_codec_write_cache(codec, 0x15, 0,
9896 AC_VERB_SET_PIN_WIDGET_CONTROL,
9898 /* mono (speaker) depending on the HP jack sense */
9899 val = val && !spec->jack_present;
9900 snd_hda_codec_write_cache(codec, 0x16, 0,
9901 AC_VERB_SET_PIN_WIDGET_CONTROL,
9905 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9907 struct alc_spec *spec = codec->spec;
9908 unsigned int presence;
9909 presence = snd_hda_codec_read(codec, 0x1b, 0,
9910 AC_VERB_GET_PIN_SENSE, 0);
9911 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9912 alc262_hp_master_update(codec);
9915 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9917 if ((res >> 26) != ALC880_HP_EVENT)
9919 alc262_hp_bpc_automute(codec);
9922 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9924 struct alc_spec *spec = codec->spec;
9925 unsigned int presence;
9926 presence = snd_hda_codec_read(codec, 0x15, 0,
9927 AC_VERB_GET_PIN_SENSE, 0);
9928 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9929 alc262_hp_master_update(codec);
9932 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9935 if ((res >> 26) != ALC880_HP_EVENT)
9937 alc262_hp_wildwest_automute(codec);
9940 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9942 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9943 struct snd_ctl_elem_value *ucontrol)
9945 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9946 struct alc_spec *spec = codec->spec;
9947 int val = !!*ucontrol->value.integer.value;
9949 if (val == spec->master_sw)
9951 spec->master_sw = val;
9952 alc262_hp_master_update(codec);
9956 #define ALC262_HP_MASTER_SWITCH \
9958 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9959 .name = "Master Playback Switch", \
9960 .info = snd_ctl_boolean_mono_info, \
9961 .get = alc262_hp_master_sw_get, \
9962 .put = alc262_hp_master_sw_put, \
9965 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9966 ALC262_HP_MASTER_SWITCH,
9967 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9968 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9969 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9970 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9972 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9976 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9977 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9978 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9979 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9982 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9983 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9984 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9985 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9989 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9990 ALC262_HP_MASTER_SWITCH,
9991 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9992 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9995 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9997 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9999 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10000 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10001 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10002 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10003 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10004 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10005 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10009 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10010 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10011 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10012 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10016 /* mute/unmute internal speaker according to the hp jack and mute state */
10017 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
10019 struct alc_spec *spec = codec->spec;
10021 spec->autocfg.hp_pins[0] = 0x15;
10022 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10023 alc_automute_amp(codec);
10026 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10027 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10028 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10029 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10037 static struct hda_verb alc262_hp_t5735_verbs[] = {
10038 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10039 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10041 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10045 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10046 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10047 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10048 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10049 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10050 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10051 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10055 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10056 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10057 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10058 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10059 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10060 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10061 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10062 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10064 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10069 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10076 /* bind hp and internal speaker mute (with plug check) as master switch */
10077 static void alc262_hippo_master_update(struct hda_codec *codec)
10079 struct alc_spec *spec = codec->spec;
10080 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10081 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10082 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10086 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10087 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10088 HDA_AMP_MUTE, mute);
10089 /* mute internal speaker per jack sense */
10090 if (spec->jack_present)
10091 mute = HDA_AMP_MUTE;
10093 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10094 HDA_AMP_MUTE, mute);
10095 if (speaker_nid && speaker_nid != line_nid)
10096 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10097 HDA_AMP_MUTE, mute);
10100 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10102 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10103 struct snd_ctl_elem_value *ucontrol)
10105 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10106 struct alc_spec *spec = codec->spec;
10107 int val = !!*ucontrol->value.integer.value;
10109 if (val == spec->master_sw)
10111 spec->master_sw = val;
10112 alc262_hippo_master_update(codec);
10116 #define ALC262_HIPPO_MASTER_SWITCH \
10118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10119 .name = "Master Playback Switch", \
10120 .info = snd_ctl_boolean_mono_info, \
10121 .get = alc262_hippo_master_sw_get, \
10122 .put = alc262_hippo_master_sw_put, \
10125 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10126 ALC262_HIPPO_MASTER_SWITCH,
10127 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10128 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10129 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10134 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10135 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10136 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10137 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10138 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10142 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10143 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10144 ALC262_HIPPO_MASTER_SWITCH,
10145 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10146 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10147 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10148 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10151 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10152 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10153 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10154 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10158 /* mute/unmute internal speaker according to the hp jack and mute state */
10159 static void alc262_hippo_automute(struct hda_codec *codec)
10161 struct alc_spec *spec = codec->spec;
10162 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10163 unsigned int present;
10165 /* need to execute and sync at first */
10166 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10167 present = snd_hda_codec_read(codec, hp_nid, 0,
10168 AC_VERB_GET_PIN_SENSE, 0);
10169 spec->jack_present = (present & 0x80000000) != 0;
10170 alc262_hippo_master_update(codec);
10173 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10175 if ((res >> 26) != ALC880_HP_EVENT)
10177 alc262_hippo_automute(codec);
10180 static void alc262_hippo_init_hook(struct hda_codec *codec)
10182 struct alc_spec *spec = codec->spec;
10184 spec->autocfg.hp_pins[0] = 0x15;
10185 spec->autocfg.speaker_pins[0] = 0x14;
10186 alc262_hippo_automute(codec);
10189 static void alc262_hippo1_init_hook(struct hda_codec *codec)
10191 struct alc_spec *spec = codec->spec;
10193 spec->autocfg.hp_pins[0] = 0x1b;
10194 spec->autocfg.speaker_pins[0] = 0x14;
10195 alc262_hippo_automute(codec);
10199 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10200 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10201 ALC262_HIPPO_MASTER_SWITCH,
10202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10204 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10205 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10209 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10210 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10211 ALC262_HIPPO_MASTER_SWITCH,
10212 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10213 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10214 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10215 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10216 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10220 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10221 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10222 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10223 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10224 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10225 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10226 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10227 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10228 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10230 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10231 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10232 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10236 static struct hda_verb alc262_tyan_verbs[] = {
10237 /* Headphone automute */
10238 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10239 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10240 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10242 /* P11 AUX_IN, white 4-pin connector */
10243 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10244 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10245 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10246 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10251 /* unsolicited event for HP jack sensing */
10252 static void alc262_tyan_init_hook(struct hda_codec *codec)
10254 struct alc_spec *spec = codec->spec;
10256 spec->autocfg.hp_pins[0] = 0x1b;
10257 spec->autocfg.speaker_pins[0] = 0x15;
10258 alc_automute_amp(codec);
10262 #define alc262_capture_mixer alc882_capture_mixer
10263 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10266 * generic initialization of ADC, input mixers and output mixers
10268 static struct hda_verb alc262_init_verbs[] = {
10270 * Unmute ADC0-2 and set the default input to mic-in
10272 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10274 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10275 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10276 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10277 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10279 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10281 * Note: PASD motherboards uses the Line In 2 as the input for
10282 * front panel mic (mic 2)
10284 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10292 * Set up output mixers (0x0c - 0x0e)
10294 /* set vol=0 to output mixers */
10295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10298 /* set up input amps for analog loopback */
10299 /* Amp Indices: DAC = 0, mixer = 1 */
10300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10303 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10304 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10305 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10309 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10310 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10311 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10312 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10314 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10315 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10316 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10317 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10318 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10320 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10321 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10323 /* FIXME: use matrix-type input source selection */
10324 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10325 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10327 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10328 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10344 static struct hda_verb alc262_eapd_verbs[] = {
10345 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10346 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10350 static struct hda_verb alc262_hippo_unsol_verbs[] = {
10351 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10356 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10357 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10358 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10359 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10361 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10362 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10366 static struct hda_verb alc262_sony_unsol_verbs[] = {
10367 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10368 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10369 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10371 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10376 static struct hda_input_mux alc262_dmic_capture_source = {
10379 { "Int DMic", 0x9 },
10384 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10386 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10387 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10388 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10389 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10393 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10394 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10395 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10397 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10398 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10400 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10401 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10405 static void alc262_dmic_automute(struct hda_codec *codec)
10407 unsigned int present;
10409 present = snd_hda_codec_read(codec, 0x18, 0,
10410 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10411 snd_hda_codec_write(codec, 0x22, 0,
10412 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10416 /* unsolicited event for HP jack sensing */
10417 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10420 if ((res >> 26) == ALC880_MIC_EVENT)
10421 alc262_dmic_automute(codec);
10423 alc_sku_unsol_event(codec, res);
10426 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10428 struct alc_spec *spec = codec->spec;
10430 spec->autocfg.hp_pins[0] = 0x15;
10431 spec->autocfg.speaker_pins[0] = 0x14;
10432 alc_automute_pin(codec);
10433 alc262_dmic_automute(codec);
10439 * 0x16 = internal speaker
10440 * 0x18 = external mic
10443 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10444 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10445 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10448 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10449 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10451 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10452 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10456 static struct hda_verb alc262_nec_verbs[] = {
10457 /* Unmute Speaker */
10458 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10461 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10464 /* External mic to headphone */
10465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10466 /* External mic to speaker */
10467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10473 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10474 * 0x1b = port replicator headphone out
10477 #define ALC_HP_EVENT 0x37
10479 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10480 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10481 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10482 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10483 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10487 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10488 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10493 static struct hda_input_mux alc262_fujitsu_capture_source = {
10497 { "Int Mic", 0x1 },
10502 static struct hda_input_mux alc262_HP_capture_source = {
10506 { "Front Mic", 0x1 },
10513 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10517 { "Front Mic", 0x2 },
10523 /* mute/unmute internal speaker according to the hp jacks and mute state */
10524 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10526 struct alc_spec *spec = codec->spec;
10529 if (force || !spec->sense_updated) {
10530 unsigned int present;
10531 /* need to execute and sync at first */
10532 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10533 /* check laptop HP jack */
10534 present = snd_hda_codec_read(codec, 0x14, 0,
10535 AC_VERB_GET_PIN_SENSE, 0);
10536 /* need to execute and sync at first */
10537 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10538 /* check docking HP jack */
10539 present |= snd_hda_codec_read(codec, 0x1b, 0,
10540 AC_VERB_GET_PIN_SENSE, 0);
10541 if (present & AC_PINSENSE_PRESENCE)
10542 spec->jack_present = 1;
10544 spec->jack_present = 0;
10545 spec->sense_updated = 1;
10547 /* unmute internal speaker only if both HPs are unplugged and
10548 * master switch is on
10550 if (spec->jack_present)
10551 mute = HDA_AMP_MUTE;
10553 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10554 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10555 HDA_AMP_MUTE, mute);
10558 /* unsolicited event for HP jack sensing */
10559 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10562 if ((res >> 26) != ALC_HP_EVENT)
10564 alc262_fujitsu_automute(codec, 1);
10567 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10569 alc262_fujitsu_automute(codec, 1);
10572 /* bind volumes of both NID 0x0c and 0x0d */
10573 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10574 .ops = &snd_hda_bind_vol,
10576 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10577 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10582 /* mute/unmute internal speaker according to the hp jack and mute state */
10583 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10585 struct alc_spec *spec = codec->spec;
10588 if (force || !spec->sense_updated) {
10589 unsigned int present_int_hp;
10590 /* need to execute and sync at first */
10591 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10592 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10593 AC_VERB_GET_PIN_SENSE, 0);
10594 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10595 spec->sense_updated = 1;
10597 if (spec->jack_present) {
10598 /* mute internal speaker */
10599 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10600 HDA_AMP_MUTE, HDA_AMP_MUTE);
10601 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10602 HDA_AMP_MUTE, HDA_AMP_MUTE);
10604 /* unmute internal speaker if necessary */
10605 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10606 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10607 HDA_AMP_MUTE, mute);
10608 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10609 HDA_AMP_MUTE, mute);
10613 /* unsolicited event for HP jack sensing */
10614 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10617 if ((res >> 26) != ALC_HP_EVENT)
10619 alc262_lenovo_3000_automute(codec, 1);
10622 /* bind hp and internal speaker mute (with plug check) */
10623 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10624 struct snd_ctl_elem_value *ucontrol)
10626 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10627 long *valp = ucontrol->value.integer.value;
10630 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10632 valp ? 0 : HDA_AMP_MUTE);
10633 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10635 valp ? 0 : HDA_AMP_MUTE);
10638 alc262_fujitsu_automute(codec, 0);
10642 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10643 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10645 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10646 .name = "Master Playback Switch",
10647 .info = snd_hda_mixer_amp_switch_info,
10648 .get = snd_hda_mixer_amp_switch_get,
10649 .put = alc262_fujitsu_master_sw_put,
10650 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10652 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10653 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10654 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10657 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10658 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10659 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10663 /* bind hp and internal speaker mute (with plug check) */
10664 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10665 struct snd_ctl_elem_value *ucontrol)
10667 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10668 long *valp = ucontrol->value.integer.value;
10671 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10673 valp ? 0 : HDA_AMP_MUTE);
10676 alc262_lenovo_3000_automute(codec, 0);
10680 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10681 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10683 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10684 .name = "Master Playback Switch",
10685 .info = snd_hda_mixer_amp_switch_info,
10686 .get = snd_hda_mixer_amp_switch_get,
10687 .put = alc262_lenovo_3000_master_sw_put,
10688 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10690 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10691 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10692 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10693 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10694 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10695 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10696 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10697 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10701 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10702 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10703 ALC262_HIPPO_MASTER_SWITCH,
10704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10706 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10707 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10709 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10713 /* additional init verbs for Benq laptops */
10714 static struct hda_verb alc262_EAPD_verbs[] = {
10715 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10716 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10720 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10721 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10722 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10724 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10725 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10729 /* Samsung Q1 Ultra Vista model setup */
10730 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10731 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10732 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10733 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10734 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10735 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10736 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10740 static struct hda_verb alc262_ultra_verbs[] = {
10742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10747 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10749 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10754 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10755 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10757 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10759 /* ADC, choose mic */
10760 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10763 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10765 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10766 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10773 /* mute/unmute internal speaker according to the hp jack and mute state */
10774 static void alc262_ultra_automute(struct hda_codec *codec)
10776 struct alc_spec *spec = codec->spec;
10780 /* auto-mute only when HP is used as HP */
10781 if (!spec->cur_mux[0]) {
10782 unsigned int present;
10783 /* need to execute and sync at first */
10784 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10785 present = snd_hda_codec_read(codec, 0x15, 0,
10786 AC_VERB_GET_PIN_SENSE, 0);
10787 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10788 if (spec->jack_present)
10789 mute = HDA_AMP_MUTE;
10791 /* mute/unmute internal speaker */
10792 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10793 HDA_AMP_MUTE, mute);
10794 /* mute/unmute HP */
10795 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10796 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10799 /* unsolicited event for HP jack sensing */
10800 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10803 if ((res >> 26) != ALC880_HP_EVENT)
10805 alc262_ultra_automute(codec);
10808 static struct hda_input_mux alc262_ultra_capture_source = {
10812 { "Headphone", 0x7 },
10816 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10817 struct snd_ctl_elem_value *ucontrol)
10819 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10820 struct alc_spec *spec = codec->spec;
10823 ret = alc_mux_enum_put(kcontrol, ucontrol);
10826 /* reprogram the HP pin as mic or HP according to the input source */
10827 snd_hda_codec_write_cache(codec, 0x15, 0,
10828 AC_VERB_SET_PIN_WIDGET_CONTROL,
10829 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10830 alc262_ultra_automute(codec); /* mute/unmute HP */
10834 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10835 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10836 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10839 .name = "Capture Source",
10840 .info = alc_mux_enum_info,
10841 .get = alc_mux_enum_get,
10842 .put = alc262_ultra_mux_enum_put,
10847 /* add playback controls from the parsed DAC table */
10848 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10849 const struct auto_pin_cfg *cfg)
10854 spec->multiout.num_dacs = 1; /* only use one dac */
10855 spec->multiout.dac_nids = spec->private_dac_nids;
10856 spec->multiout.dac_nids[0] = 2;
10858 nid = cfg->line_out_pins[0];
10860 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10861 "Front Playback Volume",
10862 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10865 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10866 "Front Playback Switch",
10867 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10872 nid = cfg->speaker_pins[0];
10875 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10876 "Speaker Playback Volume",
10877 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10881 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10882 "Speaker Playback Switch",
10883 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10888 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10889 "Speaker Playback Switch",
10890 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10896 nid = cfg->hp_pins[0];
10898 /* spec->multiout.hp_nid = 2; */
10900 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10901 "Headphone Playback Volume",
10902 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10906 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10907 "Headphone Playback Switch",
10908 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10913 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10914 "Headphone Playback Switch",
10915 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10924 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10925 const struct auto_pin_cfg *cfg)
10929 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10932 /* digital-mic input pin is excluded in alc880_auto_create..()
10933 * because it's under 0x18
10935 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10936 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10937 struct hda_input_mux *imux = &spec->private_imux[0];
10938 imux->items[imux->num_items].label = "Int Mic";
10939 imux->items[imux->num_items].index = 0x09;
10947 * generic initialization of ADC, input mixers and output mixers
10949 static struct hda_verb alc262_volume_init_verbs[] = {
10951 * Unmute ADC0-2 and set the default input to mic-in
10953 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10955 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10956 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10957 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10958 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10960 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10962 * Note: PASD motherboards uses the Line In 2 as the input for
10963 * front panel mic (mic 2)
10965 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10966 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10967 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10968 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10973 * Set up output mixers (0x0c - 0x0f)
10975 /* set vol=0 to output mixers */
10976 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10977 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10978 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10980 /* set up input amps for analog loopback */
10981 /* Amp Indices: DAC = 0, mixer = 1 */
10982 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10983 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10984 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10985 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10986 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10987 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10989 /* FIXME: use matrix-type input source selection */
10990 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10991 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10992 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10993 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10994 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10995 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10997 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10998 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10999 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11000 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11004 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11005 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11010 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11012 * Unmute ADC0-2 and set the default input to mic-in
11014 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11016 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11017 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11018 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11019 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11021 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11023 * Note: PASD motherboards uses the Line In 2 as the input for
11024 * front panel mic (mic 2)
11026 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11036 * Set up output mixers (0x0c - 0x0e)
11038 /* set vol=0 to output mixers */
11039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11040 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11041 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11043 /* set up input amps for analog loopback */
11044 /* Amp Indices: DAC = 0, mixer = 1 */
11045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11047 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11050 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11052 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11053 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11054 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11056 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11059 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11060 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11063 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11064 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11066 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11068 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11070 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11072 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11073 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11076 /* FIXME: use matrix-type input source selection */
11077 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11078 /* Input mixer1: only unmute Mic */
11079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11089 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11090 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11109 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11114 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11116 * Unmute ADC0-2 and set the default input to mic-in
11118 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11120 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11122 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11123 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11125 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11127 * Note: PASD motherboards uses the Line In 2 as the input for front
11128 * panel mic (mic 2)
11130 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11140 * Set up output mixers (0x0c - 0x0e)
11142 /* set vol=0 to output mixers */
11143 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11147 /* set up input amps for analog loopback */
11148 /* Amp Indices: DAC = 0, mixer = 1 */
11149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11153 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11154 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11158 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11159 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11160 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11161 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11162 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11163 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11165 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11166 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11168 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11169 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11171 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11172 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11173 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11174 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11175 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11176 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11178 /* FIXME: use matrix-type input source selection */
11179 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11180 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11186 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11187 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11194 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11202 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11205 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11210 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11212 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11213 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11214 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11216 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11217 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11218 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11219 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11221 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11222 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11223 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11228 #ifdef CONFIG_SND_HDA_POWER_SAVE
11229 #define alc262_loopbacks alc880_loopbacks
11232 /* pcm configuration: identical with ALC880 */
11233 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11234 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11235 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11236 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11239 * BIOS auto configuration
11241 static int alc262_parse_auto_config(struct hda_codec *codec)
11243 struct alc_spec *spec = codec->spec;
11245 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11247 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11251 if (!spec->autocfg.line_outs) {
11252 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11253 spec->multiout.max_channels = 2;
11254 spec->no_analog = 1;
11257 return 0; /* can't find valid BIOS pin config */
11259 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11262 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11266 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11269 if (spec->autocfg.dig_outs) {
11270 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11271 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11273 if (spec->autocfg.dig_in_pin)
11274 spec->dig_in_nid = ALC262_DIGIN_NID;
11276 if (spec->kctls.list)
11277 add_mixer(spec, spec->kctls.list);
11279 add_verb(spec, alc262_volume_init_verbs);
11280 spec->num_mux_defs = 1;
11281 spec->input_mux = &spec->private_imux[0];
11283 err = alc_auto_add_mic_boost(codec);
11287 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11292 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11293 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11294 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11295 #define alc262_auto_init_input_src alc882_auto_init_input_src
11298 /* init callback for auto-configuration model -- overriding the default init */
11299 static void alc262_auto_init(struct hda_codec *codec)
11301 struct alc_spec *spec = codec->spec;
11302 alc262_auto_init_multi_out(codec);
11303 alc262_auto_init_hp_out(codec);
11304 alc262_auto_init_analog_input(codec);
11305 alc262_auto_init_input_src(codec);
11306 if (spec->unsol_event)
11307 alc_inithook(codec);
11311 * configuration and preset
11313 static const char *alc262_models[ALC262_MODEL_LAST] = {
11314 [ALC262_BASIC] = "basic",
11315 [ALC262_HIPPO] = "hippo",
11316 [ALC262_HIPPO_1] = "hippo_1",
11317 [ALC262_FUJITSU] = "fujitsu",
11318 [ALC262_HP_BPC] = "hp-bpc",
11319 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11320 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11321 [ALC262_HP_RP5700] = "hp-rp5700",
11322 [ALC262_BENQ_ED8] = "benq",
11323 [ALC262_BENQ_T31] = "benq-t31",
11324 [ALC262_SONY_ASSAMD] = "sony-assamd",
11325 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11326 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11327 [ALC262_ULTRA] = "ultra",
11328 [ALC262_LENOVO_3000] = "lenovo-3000",
11329 [ALC262_NEC] = "nec",
11330 [ALC262_TYAN] = "tyan",
11331 [ALC262_AUTO] = "auto",
11334 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11335 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11336 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11337 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11339 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11341 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11343 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11344 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11345 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11346 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11347 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11348 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11349 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11350 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11351 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11352 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11353 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11354 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11355 ALC262_HP_TC_T5735),
11356 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11357 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11358 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11359 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11360 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11361 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11362 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11363 ALC262_SONY_ASSAMD),
11364 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11365 ALC262_TOSHIBA_RX1),
11366 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11367 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11368 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11369 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11370 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11372 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11373 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11374 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11375 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11376 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11380 static struct alc_config_preset alc262_presets[] = {
11382 .mixers = { alc262_base_mixer },
11383 .init_verbs = { alc262_init_verbs },
11384 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11385 .dac_nids = alc262_dac_nids,
11387 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11388 .channel_mode = alc262_modes,
11389 .input_mux = &alc262_capture_source,
11392 .mixers = { alc262_hippo_mixer },
11393 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
11394 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11395 .dac_nids = alc262_dac_nids,
11397 .dig_out_nid = ALC262_DIGOUT_NID,
11398 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11399 .channel_mode = alc262_modes,
11400 .input_mux = &alc262_capture_source,
11401 .unsol_event = alc262_hippo_unsol_event,
11402 .init_hook = alc262_hippo_init_hook,
11404 [ALC262_HIPPO_1] = {
11405 .mixers = { alc262_hippo1_mixer },
11406 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11407 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11408 .dac_nids = alc262_dac_nids,
11410 .dig_out_nid = ALC262_DIGOUT_NID,
11411 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11412 .channel_mode = alc262_modes,
11413 .input_mux = &alc262_capture_source,
11414 .unsol_event = alc262_hippo_unsol_event,
11415 .init_hook = alc262_hippo1_init_hook,
11417 [ALC262_FUJITSU] = {
11418 .mixers = { alc262_fujitsu_mixer },
11419 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11420 alc262_fujitsu_unsol_verbs },
11421 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11422 .dac_nids = alc262_dac_nids,
11424 .dig_out_nid = ALC262_DIGOUT_NID,
11425 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11426 .channel_mode = alc262_modes,
11427 .input_mux = &alc262_fujitsu_capture_source,
11428 .unsol_event = alc262_fujitsu_unsol_event,
11429 .init_hook = alc262_fujitsu_init_hook,
11431 [ALC262_HP_BPC] = {
11432 .mixers = { alc262_HP_BPC_mixer },
11433 .init_verbs = { alc262_HP_BPC_init_verbs },
11434 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11435 .dac_nids = alc262_dac_nids,
11437 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11438 .channel_mode = alc262_modes,
11439 .input_mux = &alc262_HP_capture_source,
11440 .unsol_event = alc262_hp_bpc_unsol_event,
11441 .init_hook = alc262_hp_bpc_automute,
11443 [ALC262_HP_BPC_D7000_WF] = {
11444 .mixers = { alc262_HP_BPC_WildWest_mixer },
11445 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11446 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11447 .dac_nids = alc262_dac_nids,
11449 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11450 .channel_mode = alc262_modes,
11451 .input_mux = &alc262_HP_D7000_capture_source,
11452 .unsol_event = alc262_hp_wildwest_unsol_event,
11453 .init_hook = alc262_hp_wildwest_automute,
11455 [ALC262_HP_BPC_D7000_WL] = {
11456 .mixers = { alc262_HP_BPC_WildWest_mixer,
11457 alc262_HP_BPC_WildWest_option_mixer },
11458 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11459 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11460 .dac_nids = alc262_dac_nids,
11462 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11463 .channel_mode = alc262_modes,
11464 .input_mux = &alc262_HP_D7000_capture_source,
11465 .unsol_event = alc262_hp_wildwest_unsol_event,
11466 .init_hook = alc262_hp_wildwest_automute,
11468 [ALC262_HP_TC_T5735] = {
11469 .mixers = { alc262_hp_t5735_mixer },
11470 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11471 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11472 .dac_nids = alc262_dac_nids,
11474 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11475 .channel_mode = alc262_modes,
11476 .input_mux = &alc262_capture_source,
11477 .unsol_event = alc_automute_amp_unsol_event,
11478 .init_hook = alc262_hp_t5735_init_hook,
11480 [ALC262_HP_RP5700] = {
11481 .mixers = { alc262_hp_rp5700_mixer },
11482 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11483 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11484 .dac_nids = alc262_dac_nids,
11485 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11486 .channel_mode = alc262_modes,
11487 .input_mux = &alc262_hp_rp5700_capture_source,
11489 [ALC262_BENQ_ED8] = {
11490 .mixers = { alc262_base_mixer },
11491 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11492 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11493 .dac_nids = alc262_dac_nids,
11495 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11496 .channel_mode = alc262_modes,
11497 .input_mux = &alc262_capture_source,
11499 [ALC262_SONY_ASSAMD] = {
11500 .mixers = { alc262_sony_mixer },
11501 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11502 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11503 .dac_nids = alc262_dac_nids,
11505 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11506 .channel_mode = alc262_modes,
11507 .input_mux = &alc262_capture_source,
11508 .unsol_event = alc262_hippo_unsol_event,
11509 .init_hook = alc262_hippo_init_hook,
11511 [ALC262_BENQ_T31] = {
11512 .mixers = { alc262_benq_t31_mixer },
11513 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11514 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11515 .dac_nids = alc262_dac_nids,
11517 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11518 .channel_mode = alc262_modes,
11519 .input_mux = &alc262_capture_source,
11520 .unsol_event = alc262_hippo_unsol_event,
11521 .init_hook = alc262_hippo_init_hook,
11524 .mixers = { alc262_ultra_mixer },
11525 .cap_mixer = alc262_ultra_capture_mixer,
11526 .init_verbs = { alc262_ultra_verbs },
11527 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11528 .dac_nids = alc262_dac_nids,
11529 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11530 .channel_mode = alc262_modes,
11531 .input_mux = &alc262_ultra_capture_source,
11532 .adc_nids = alc262_adc_nids, /* ADC0 */
11533 .capsrc_nids = alc262_capsrc_nids,
11534 .num_adc_nids = 1, /* single ADC */
11535 .unsol_event = alc262_ultra_unsol_event,
11536 .init_hook = alc262_ultra_automute,
11538 [ALC262_LENOVO_3000] = {
11539 .mixers = { alc262_lenovo_3000_mixer },
11540 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11541 alc262_lenovo_3000_unsol_verbs },
11542 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11543 .dac_nids = alc262_dac_nids,
11545 .dig_out_nid = ALC262_DIGOUT_NID,
11546 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11547 .channel_mode = alc262_modes,
11548 .input_mux = &alc262_fujitsu_capture_source,
11549 .unsol_event = alc262_lenovo_3000_unsol_event,
11552 .mixers = { alc262_nec_mixer },
11553 .init_verbs = { alc262_nec_verbs },
11554 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11555 .dac_nids = alc262_dac_nids,
11557 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11558 .channel_mode = alc262_modes,
11559 .input_mux = &alc262_capture_source,
11561 [ALC262_TOSHIBA_S06] = {
11562 .mixers = { alc262_toshiba_s06_mixer },
11563 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11564 alc262_eapd_verbs },
11565 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11566 .capsrc_nids = alc262_dmic_capsrc_nids,
11567 .dac_nids = alc262_dac_nids,
11568 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11569 .num_adc_nids = 1, /* single ADC */
11570 .dig_out_nid = ALC262_DIGOUT_NID,
11571 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11572 .channel_mode = alc262_modes,
11573 .input_mux = &alc262_dmic_capture_source,
11574 .unsol_event = alc262_toshiba_s06_unsol_event,
11575 .init_hook = alc262_toshiba_s06_init_hook,
11577 [ALC262_TOSHIBA_RX1] = {
11578 .mixers = { alc262_toshiba_rx1_mixer },
11579 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11580 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11581 .dac_nids = alc262_dac_nids,
11583 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11584 .channel_mode = alc262_modes,
11585 .input_mux = &alc262_capture_source,
11586 .unsol_event = alc262_hippo_unsol_event,
11587 .init_hook = alc262_hippo_init_hook,
11590 .mixers = { alc262_tyan_mixer },
11591 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11592 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11593 .dac_nids = alc262_dac_nids,
11595 .dig_out_nid = ALC262_DIGOUT_NID,
11596 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11597 .channel_mode = alc262_modes,
11598 .input_mux = &alc262_capture_source,
11599 .unsol_event = alc_automute_amp_unsol_event,
11600 .init_hook = alc262_tyan_init_hook,
11604 static int patch_alc262(struct hda_codec *codec)
11606 struct alc_spec *spec;
11610 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11614 codec->spec = spec;
11616 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11621 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11622 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11623 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11624 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11628 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11630 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11634 if (board_config < 0) {
11635 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11636 "trying auto-probe from BIOS...\n", codec->chip_name);
11637 board_config = ALC262_AUTO;
11640 if (board_config == ALC262_AUTO) {
11641 /* automatic parse from the BIOS config */
11642 err = alc262_parse_auto_config(codec);
11648 "hda_codec: Cannot set up configuration "
11649 "from BIOS. Using base mode...\n");
11650 board_config = ALC262_BASIC;
11654 if (!spec->no_analog) {
11655 err = snd_hda_attach_beep_device(codec, 0x1);
11662 if (board_config != ALC262_AUTO)
11663 setup_preset(spec, &alc262_presets[board_config]);
11665 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11666 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11668 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11669 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11671 if (!spec->adc_nids && spec->input_mux) {
11673 /* check whether the digital-mic has to be supported */
11674 for (i = 0; i < spec->input_mux->num_items; i++) {
11675 if (spec->input_mux->items[i].index >= 9)
11678 if (i < spec->input_mux->num_items) {
11679 /* use only ADC0 */
11680 spec->adc_nids = alc262_dmic_adc_nids;
11681 spec->num_adc_nids = 1;
11682 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11684 /* all analog inputs */
11685 /* check whether NID 0x07 is valid */
11686 unsigned int wcap = get_wcaps(codec, 0x07);
11689 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11690 if (wcap != AC_WID_AUD_IN) {
11691 spec->adc_nids = alc262_adc_nids_alt;
11692 spec->num_adc_nids =
11693 ARRAY_SIZE(alc262_adc_nids_alt);
11694 spec->capsrc_nids = alc262_capsrc_nids_alt;
11696 spec->adc_nids = alc262_adc_nids;
11697 spec->num_adc_nids =
11698 ARRAY_SIZE(alc262_adc_nids);
11699 spec->capsrc_nids = alc262_capsrc_nids;
11703 if (!spec->cap_mixer && !spec->no_analog)
11704 set_capture_mixer(spec);
11705 if (!spec->no_analog)
11706 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11708 spec->vmaster_nid = 0x0c;
11710 codec->patch_ops = alc_patch_ops;
11711 if (board_config == ALC262_AUTO)
11712 spec->init_hook = alc262_auto_init;
11713 #ifdef CONFIG_SND_HDA_POWER_SAVE
11714 if (!spec->loopback.amplist)
11715 spec->loopback.amplist = alc262_loopbacks;
11717 codec->proc_widget_hook = print_realtek_coef;
11723 * ALC268 channel source setting (2 channel)
11725 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11726 #define alc268_modes alc260_modes
11728 static hda_nid_t alc268_dac_nids[2] = {
11733 static hda_nid_t alc268_adc_nids[2] = {
11738 static hda_nid_t alc268_adc_nids_alt[1] = {
11743 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11745 static struct snd_kcontrol_new alc268_base_mixer[] = {
11746 /* output mixer control */
11747 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11748 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11749 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11750 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11751 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11752 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11753 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11757 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11758 /* output mixer control */
11759 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11760 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11761 ALC262_HIPPO_MASTER_SWITCH,
11762 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11763 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11764 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11768 /* bind Beep switches of both NID 0x0f and 0x10 */
11769 static struct hda_bind_ctls alc268_bind_beep_sw = {
11770 .ops = &snd_hda_bind_sw,
11772 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11773 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11778 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11779 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11780 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11784 static struct hda_verb alc268_eapd_verbs[] = {
11785 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11786 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11790 /* Toshiba specific */
11791 static struct hda_verb alc268_toshiba_verbs[] = {
11792 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11796 static struct hda_input_mux alc268_acer_lc_capture_source = {
11804 /* Acer specific */
11805 /* bind volumes of both NID 0x02 and 0x03 */
11806 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11807 .ops = &snd_hda_bind_vol,
11809 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11810 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11815 /* mute/unmute internal speaker according to the hp jack and mute state */
11816 static void alc268_acer_automute(struct hda_codec *codec, int force)
11818 struct alc_spec *spec = codec->spec;
11821 if (force || !spec->sense_updated) {
11822 unsigned int present;
11823 present = snd_hda_codec_read(codec, 0x14, 0,
11824 AC_VERB_GET_PIN_SENSE, 0);
11825 spec->jack_present = (present & 0x80000000) != 0;
11826 spec->sense_updated = 1;
11828 if (spec->jack_present)
11829 mute = HDA_AMP_MUTE; /* mute internal speaker */
11830 else /* unmute internal speaker if necessary */
11831 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11832 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11833 HDA_AMP_MUTE, mute);
11837 /* bind hp and internal speaker mute (with plug check) */
11838 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11839 struct snd_ctl_elem_value *ucontrol)
11841 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11842 long *valp = ucontrol->value.integer.value;
11845 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11847 valp[0] ? 0 : HDA_AMP_MUTE);
11848 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11850 valp[1] ? 0 : HDA_AMP_MUTE);
11852 alc268_acer_automute(codec, 0);
11856 static struct snd_kcontrol_new alc268_acer_aspire_one_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 Capture Volume", 0x18, 0, HDA_INPUT),
11871 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11872 /* output mixer control */
11873 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11875 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11876 .name = "Master Playback Switch",
11877 .info = snd_hda_mixer_amp_switch_info,
11878 .get = snd_hda_mixer_amp_switch_get,
11879 .put = alc268_acer_master_sw_put,
11880 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11882 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11883 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11884 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11888 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11889 /* output mixer control */
11890 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11892 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11893 .name = "Master Playback Switch",
11894 .info = snd_hda_mixer_amp_switch_info,
11895 .get = snd_hda_mixer_amp_switch_get,
11896 .put = alc268_acer_master_sw_put,
11897 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11899 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11900 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11904 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11905 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11906 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11907 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11908 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11909 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11910 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11914 static struct hda_verb alc268_acer_verbs[] = {
11915 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11916 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11919 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11920 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11921 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11925 /* unsolicited event for HP jack sensing */
11926 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11927 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11929 static void alc268_acer_unsol_event(struct hda_codec *codec,
11932 if ((res >> 26) != ALC880_HP_EVENT)
11934 alc268_acer_automute(codec, 1);
11937 static void alc268_acer_init_hook(struct hda_codec *codec)
11939 alc268_acer_automute(codec, 1);
11942 /* toggle speaker-output according to the hp-jack state */
11943 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11945 unsigned int present;
11946 unsigned char bits;
11948 present = snd_hda_codec_read(codec, 0x15, 0,
11949 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11950 bits = present ? AMP_IN_MUTE(0) : 0;
11951 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11952 AMP_IN_MUTE(0), bits);
11953 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11954 AMP_IN_MUTE(0), bits);
11958 static void alc268_acer_mic_automute(struct hda_codec *codec)
11960 unsigned int present;
11962 present = snd_hda_codec_read(codec, 0x18, 0,
11963 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11964 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11965 present ? 0x0 : 0x6);
11968 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11971 if ((res >> 26) == ALC880_HP_EVENT)
11972 alc268_aspire_one_speaker_automute(codec);
11973 if ((res >> 26) == ALC880_MIC_EVENT)
11974 alc268_acer_mic_automute(codec);
11977 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11979 alc268_aspire_one_speaker_automute(codec);
11980 alc268_acer_mic_automute(codec);
11983 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11984 /* output mixer control */
11985 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11986 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11987 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11989 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11990 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11994 static struct hda_verb alc268_dell_verbs[] = {
11995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11997 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12001 /* mute/unmute internal speaker according to the hp jack and mute state */
12002 static void alc268_dell_init_hook(struct hda_codec *codec)
12004 struct alc_spec *spec = codec->spec;
12006 spec->autocfg.hp_pins[0] = 0x15;
12007 spec->autocfg.speaker_pins[0] = 0x14;
12008 alc_automute_pin(codec);
12011 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12012 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12013 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12014 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12015 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12016 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12017 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12018 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12019 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12023 static struct hda_verb alc267_quanta_il1_verbs[] = {
12024 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12025 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12029 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
12031 unsigned int present;
12033 present = snd_hda_codec_read(codec, 0x18, 0,
12034 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12035 snd_hda_codec_write(codec, 0x23, 0,
12036 AC_VERB_SET_CONNECT_SEL,
12037 present ? 0x00 : 0x01);
12040 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
12042 struct alc_spec *spec = codec->spec;
12044 spec->autocfg.hp_pins[0] = 0x15;
12045 spec->autocfg.speaker_pins[0] = 0x14;
12046 alc_automute_pin(codec);
12047 alc267_quanta_il1_mic_automute(codec);
12050 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
12053 switch (res >> 26) {
12054 case ALC880_MIC_EVENT:
12055 alc267_quanta_il1_mic_automute(codec);
12058 alc_sku_unsol_event(codec, res);
12064 * generic initialization of ADC, input mixers and output mixers
12066 static struct hda_verb alc268_base_init_verbs[] = {
12067 /* Unmute DAC0-1 and set vol = 0 */
12068 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12069 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12072 * Set up output mixers (0x0c - 0x0e)
12074 /* set vol=0 to output mixers */
12075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12076 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12078 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12079 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12081 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12082 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12083 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12084 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12085 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12086 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12087 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12088 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12092 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12093 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12094 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12096 /* set PCBEEP vol = 0, mute connections */
12097 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12098 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12099 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12101 /* Unmute Selector 23h,24h and set the default input to mic-in */
12103 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12105 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12112 * generic initialization of ADC, input mixers and output mixers
12114 static struct hda_verb alc268_volume_init_verbs[] = {
12115 /* set output DAC */
12116 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12117 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12119 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12120 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12121 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12122 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12123 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12125 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12126 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12127 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12129 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12130 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12132 /* set PCBEEP vol = 0, mute connections */
12133 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12134 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12135 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12140 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12141 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12142 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12144 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12145 /* The multiple "Capture Source" controls confuse alsamixer
12146 * So call somewhat different..
12148 /* .name = "Capture Source", */
12149 .name = "Input Source",
12151 .info = alc_mux_enum_info,
12152 .get = alc_mux_enum_get,
12153 .put = alc_mux_enum_put,
12158 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12159 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12160 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12161 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12162 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12164 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12165 /* The multiple "Capture Source" controls confuse alsamixer
12166 * So call somewhat different..
12168 /* .name = "Capture Source", */
12169 .name = "Input Source",
12171 .info = alc_mux_enum_info,
12172 .get = alc_mux_enum_get,
12173 .put = alc_mux_enum_put,
12178 static struct hda_input_mux alc268_capture_source = {
12182 { "Front Mic", 0x1 },
12188 static struct hda_input_mux alc268_acer_capture_source = {
12192 { "Internal Mic", 0x1 },
12197 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12201 { "Internal Mic", 0x6 },
12206 #ifdef CONFIG_SND_DEBUG
12207 static struct snd_kcontrol_new alc268_test_mixer[] = {
12208 /* Volume widgets */
12209 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12210 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12211 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12212 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12213 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12214 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12215 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12216 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12217 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12218 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12219 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12220 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12221 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12222 /* The below appears problematic on some hardwares */
12223 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12224 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12225 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12226 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12227 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12229 /* Modes for retasking pin widgets */
12230 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12231 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12232 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12233 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12235 /* Controls for GPIO pins, assuming they are configured as outputs */
12236 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12237 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12238 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12239 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12241 /* Switches to allow the digital SPDIF output pin to be enabled.
12242 * The ALC268 does not have an SPDIF input.
12244 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12246 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12247 * this output to turn on an external amplifier.
12249 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12250 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12256 /* create input playback/capture controls for the given pin */
12257 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12258 const char *ctlname, int idx)
12263 sprintf(name, "%s Playback Volume", ctlname);
12265 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12266 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
12270 } else if (nid == 0x15) {
12271 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12272 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
12278 sprintf(name, "%s Playback Switch", ctlname);
12279 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12280 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12286 /* add playback controls from the parsed DAC table */
12287 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12288 const struct auto_pin_cfg *cfg)
12293 spec->multiout.num_dacs = 2; /* only use one dac */
12294 spec->multiout.dac_nids = spec->private_dac_nids;
12295 spec->multiout.dac_nids[0] = 2;
12296 spec->multiout.dac_nids[1] = 3;
12298 nid = cfg->line_out_pins[0];
12300 alc268_new_analog_output(spec, nid, "Front", 0);
12302 nid = cfg->speaker_pins[0];
12304 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12305 "Speaker Playback Volume",
12306 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12310 nid = cfg->hp_pins[0];
12312 alc268_new_analog_output(spec, nid, "Headphone", 0);
12314 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12316 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12317 "Mono Playback Switch",
12318 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
12325 /* create playback/capture controls for input pins */
12326 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12327 const struct auto_pin_cfg *cfg)
12329 struct hda_input_mux *imux = &spec->private_imux[0];
12332 for (i = 0; i < AUTO_PIN_LAST; i++) {
12333 switch(cfg->input_pins[i]) {
12335 idx1 = 0; /* Mic 1 */
12338 idx1 = 1; /* Mic 2 */
12341 idx1 = 2; /* Line In */
12348 idx1 = 6; /* digital mics */
12353 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12354 imux->items[imux->num_items].index = idx1;
12360 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12362 struct alc_spec *spec = codec->spec;
12363 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12364 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12365 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12366 unsigned int dac_vol1, dac_vol2;
12369 snd_hda_codec_write(codec, speaker_nid, 0,
12370 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12371 snd_hda_codec_write(codec, 0x0f, 0,
12372 AC_VERB_SET_AMP_GAIN_MUTE,
12374 snd_hda_codec_write(codec, 0x10, 0,
12375 AC_VERB_SET_AMP_GAIN_MUTE,
12378 snd_hda_codec_write(codec, 0x0f, 0,
12379 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12380 snd_hda_codec_write(codec, 0x10, 0,
12381 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12384 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12385 if (line_nid == 0x14)
12386 dac_vol2 = AMP_OUT_ZERO;
12387 else if (line_nid == 0x15)
12388 dac_vol1 = AMP_OUT_ZERO;
12389 if (hp_nid == 0x14)
12390 dac_vol2 = AMP_OUT_ZERO;
12391 else if (hp_nid == 0x15)
12392 dac_vol1 = AMP_OUT_ZERO;
12393 if (line_nid != 0x16 || hp_nid != 0x16 ||
12394 spec->autocfg.line_out_pins[1] != 0x16 ||
12395 spec->autocfg.line_out_pins[2] != 0x16)
12396 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12398 snd_hda_codec_write(codec, 0x02, 0,
12399 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12400 snd_hda_codec_write(codec, 0x03, 0,
12401 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12404 /* pcm configuration: identical with ALC880 */
12405 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12406 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12407 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12408 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12411 * BIOS auto configuration
12413 static int alc268_parse_auto_config(struct hda_codec *codec)
12415 struct alc_spec *spec = codec->spec;
12417 static hda_nid_t alc268_ignore[] = { 0 };
12419 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12423 if (!spec->autocfg.line_outs) {
12424 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12425 spec->multiout.max_channels = 2;
12426 spec->no_analog = 1;
12429 return 0; /* can't find valid BIOS pin config */
12431 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12434 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12438 spec->multiout.max_channels = 2;
12441 /* digital only support output */
12442 if (spec->autocfg.dig_outs) {
12443 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12444 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12446 if (spec->kctls.list)
12447 add_mixer(spec, spec->kctls.list);
12449 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12450 add_mixer(spec, alc268_beep_mixer);
12452 add_verb(spec, alc268_volume_init_verbs);
12453 spec->num_mux_defs = 1;
12454 spec->input_mux = &spec->private_imux[0];
12456 err = alc_auto_add_mic_boost(codec);
12463 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12464 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12465 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12467 /* init callback for auto-configuration model -- overriding the default init */
12468 static void alc268_auto_init(struct hda_codec *codec)
12470 struct alc_spec *spec = codec->spec;
12471 alc268_auto_init_multi_out(codec);
12472 alc268_auto_init_hp_out(codec);
12473 alc268_auto_init_mono_speaker_out(codec);
12474 alc268_auto_init_analog_input(codec);
12475 if (spec->unsol_event)
12476 alc_inithook(codec);
12480 * configuration and preset
12482 static const char *alc268_models[ALC268_MODEL_LAST] = {
12483 [ALC267_QUANTA_IL1] = "quanta-il1",
12484 [ALC268_3ST] = "3stack",
12485 [ALC268_TOSHIBA] = "toshiba",
12486 [ALC268_ACER] = "acer",
12487 [ALC268_ACER_DMIC] = "acer-dmic",
12488 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12489 [ALC268_DELL] = "dell",
12490 [ALC268_ZEPTO] = "zepto",
12491 #ifdef CONFIG_SND_DEBUG
12492 [ALC268_TEST] = "test",
12494 [ALC268_AUTO] = "auto",
12497 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12498 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12499 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12500 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12501 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12502 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12503 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12504 ALC268_ACER_ASPIRE_ONE),
12505 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12506 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12507 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12509 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12510 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12511 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12513 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12514 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12515 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12516 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12520 static struct alc_config_preset alc268_presets[] = {
12521 [ALC267_QUANTA_IL1] = {
12522 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12523 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12524 alc267_quanta_il1_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,
12530 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12531 .channel_mode = alc268_modes,
12532 .input_mux = &alc268_capture_source,
12533 .unsol_event = alc267_quanta_il1_unsol_event,
12534 .init_hook = alc267_quanta_il1_init_hook,
12537 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12538 alc268_beep_mixer },
12539 .init_verbs = { alc268_base_init_verbs },
12540 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12541 .dac_nids = alc268_dac_nids,
12542 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12543 .adc_nids = alc268_adc_nids_alt,
12544 .capsrc_nids = alc268_capsrc_nids,
12546 .dig_out_nid = ALC268_DIGOUT_NID,
12547 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12548 .channel_mode = alc268_modes,
12549 .input_mux = &alc268_capture_source,
12551 [ALC268_TOSHIBA] = {
12552 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12553 alc268_beep_mixer },
12554 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12555 alc268_toshiba_verbs },
12556 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12557 .dac_nids = alc268_dac_nids,
12558 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12559 .adc_nids = alc268_adc_nids_alt,
12560 .capsrc_nids = alc268_capsrc_nids,
12562 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12563 .channel_mode = alc268_modes,
12564 .input_mux = &alc268_capture_source,
12565 .unsol_event = alc268_toshiba_unsol_event,
12566 .init_hook = alc268_toshiba_init_hook,
12569 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12570 alc268_beep_mixer },
12571 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12572 alc268_acer_verbs },
12573 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12574 .dac_nids = alc268_dac_nids,
12575 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12576 .adc_nids = alc268_adc_nids_alt,
12577 .capsrc_nids = alc268_capsrc_nids,
12579 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12580 .channel_mode = alc268_modes,
12581 .input_mux = &alc268_acer_capture_source,
12582 .unsol_event = alc268_acer_unsol_event,
12583 .init_hook = alc268_acer_init_hook,
12585 [ALC268_ACER_DMIC] = {
12586 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12587 alc268_beep_mixer },
12588 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12589 alc268_acer_verbs },
12590 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12591 .dac_nids = alc268_dac_nids,
12592 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12593 .adc_nids = alc268_adc_nids_alt,
12594 .capsrc_nids = alc268_capsrc_nids,
12596 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12597 .channel_mode = alc268_modes,
12598 .input_mux = &alc268_acer_dmic_capture_source,
12599 .unsol_event = alc268_acer_unsol_event,
12600 .init_hook = alc268_acer_init_hook,
12602 [ALC268_ACER_ASPIRE_ONE] = {
12603 .mixers = { alc268_acer_aspire_one_mixer,
12605 alc268_capture_alt_mixer },
12606 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12607 alc268_acer_aspire_one_verbs },
12608 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12609 .dac_nids = alc268_dac_nids,
12610 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12611 .adc_nids = alc268_adc_nids_alt,
12612 .capsrc_nids = alc268_capsrc_nids,
12614 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12615 .channel_mode = alc268_modes,
12616 .input_mux = &alc268_acer_lc_capture_source,
12617 .unsol_event = alc268_acer_lc_unsol_event,
12618 .init_hook = alc268_acer_lc_init_hook,
12621 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12622 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12623 alc268_dell_verbs },
12624 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12625 .dac_nids = alc268_dac_nids,
12627 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12628 .channel_mode = alc268_modes,
12629 .unsol_event = alc_sku_unsol_event,
12630 .init_hook = alc268_dell_init_hook,
12631 .input_mux = &alc268_capture_source,
12634 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12635 alc268_beep_mixer },
12636 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12637 alc268_toshiba_verbs },
12638 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12639 .dac_nids = alc268_dac_nids,
12640 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12641 .adc_nids = alc268_adc_nids_alt,
12642 .capsrc_nids = alc268_capsrc_nids,
12644 .dig_out_nid = ALC268_DIGOUT_NID,
12645 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12646 .channel_mode = alc268_modes,
12647 .input_mux = &alc268_capture_source,
12648 .unsol_event = alc268_toshiba_unsol_event,
12649 .init_hook = alc268_toshiba_init_hook
12651 #ifdef CONFIG_SND_DEBUG
12653 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12654 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12655 alc268_volume_init_verbs },
12656 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12657 .dac_nids = alc268_dac_nids,
12658 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12659 .adc_nids = alc268_adc_nids_alt,
12660 .capsrc_nids = alc268_capsrc_nids,
12662 .dig_out_nid = ALC268_DIGOUT_NID,
12663 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12664 .channel_mode = alc268_modes,
12665 .input_mux = &alc268_capture_source,
12670 static int patch_alc268(struct hda_codec *codec)
12672 struct alc_spec *spec;
12674 int i, has_beep, err;
12676 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12680 codec->spec = spec;
12682 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12686 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12687 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12688 "trying auto-probe from BIOS...\n", codec->chip_name);
12689 board_config = ALC268_AUTO;
12692 if (board_config == ALC268_AUTO) {
12693 /* automatic parse from the BIOS config */
12694 err = alc268_parse_auto_config(codec);
12700 "hda_codec: Cannot set up configuration "
12701 "from BIOS. Using base mode...\n");
12702 board_config = ALC268_3ST;
12706 if (board_config != ALC268_AUTO)
12707 setup_preset(spec, &alc268_presets[board_config]);
12709 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12710 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12711 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12713 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12716 for (i = 0; i < spec->num_mixers; i++) {
12717 if (spec->mixers[i] == alc268_beep_mixer) {
12724 err = snd_hda_attach_beep_device(codec, 0x1);
12729 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12730 /* override the amp caps for beep generator */
12731 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12732 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12733 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12734 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12735 (0 << AC_AMPCAP_MUTE_SHIFT));
12738 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12739 /* check whether NID 0x07 is valid */
12740 unsigned int wcap = get_wcaps(codec, 0x07);
12744 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12745 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12746 spec->adc_nids = alc268_adc_nids_alt;
12747 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12748 add_mixer(spec, alc268_capture_alt_mixer);
12750 spec->adc_nids = alc268_adc_nids;
12751 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12752 add_mixer(spec, alc268_capture_mixer);
12754 spec->capsrc_nids = alc268_capsrc_nids;
12755 /* set default input source */
12756 for (i = 0; i < spec->num_adc_nids; i++)
12757 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12758 0, AC_VERB_SET_CONNECT_SEL,
12759 spec->input_mux->items[0].index);
12762 spec->vmaster_nid = 0x02;
12764 codec->patch_ops = alc_patch_ops;
12765 if (board_config == ALC268_AUTO)
12766 spec->init_hook = alc268_auto_init;
12768 codec->proc_widget_hook = print_realtek_coef;
12774 * ALC269 channel source setting (2 channel)
12776 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12778 #define alc269_dac_nids alc260_dac_nids
12780 static hda_nid_t alc269_adc_nids[1] = {
12785 static hda_nid_t alc269_capsrc_nids[1] = {
12789 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12793 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12801 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12809 #define alc269_modes alc260_modes
12810 #define alc269_capture_source alc880_lg_lw_capture_source
12812 static struct snd_kcontrol_new alc269_base_mixer[] = {
12813 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12814 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12815 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12816 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12818 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12819 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12820 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12821 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12822 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12823 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12824 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12828 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12829 /* output mixer control */
12830 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12832 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12833 .name = "Master Playback Switch",
12834 .info = snd_hda_mixer_amp_switch_info,
12835 .get = snd_hda_mixer_amp_switch_get,
12836 .put = alc268_acer_master_sw_put,
12837 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12841 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12842 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12843 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12844 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12848 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12849 /* output mixer control */
12850 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12852 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12853 .name = "Master Playback Switch",
12854 .info = snd_hda_mixer_amp_switch_info,
12855 .get = snd_hda_mixer_amp_switch_get,
12856 .put = alc268_acer_master_sw_put,
12857 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12861 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12862 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12863 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12864 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12865 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12866 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12867 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12871 /* bind volumes of both NID 0x0c and 0x0d */
12872 static struct hda_bind_ctls alc269_epc_bind_vol = {
12873 .ops = &snd_hda_bind_vol,
12875 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12876 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12881 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12882 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12883 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12884 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12888 /* capture mixer elements */
12889 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12890 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12891 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12892 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12897 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12898 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12899 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12900 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12904 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12905 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12906 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12907 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12908 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12909 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12910 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12914 static struct hda_verb alc269_lifebook_verbs[] = {
12915 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12916 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12917 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12919 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12920 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12921 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12922 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12923 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12924 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12928 /* toggle speaker-output according to the hp-jack state */
12929 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12931 unsigned int present;
12932 unsigned char bits;
12934 present = snd_hda_codec_read(codec, 0x15, 0,
12935 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12936 bits = present ? AMP_IN_MUTE(0) : 0;
12937 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12938 AMP_IN_MUTE(0), bits);
12939 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12940 AMP_IN_MUTE(0), bits);
12942 snd_hda_codec_write(codec, 0x20, 0,
12943 AC_VERB_SET_COEF_INDEX, 0x0c);
12944 snd_hda_codec_write(codec, 0x20, 0,
12945 AC_VERB_SET_PROC_COEF, 0x680);
12947 snd_hda_codec_write(codec, 0x20, 0,
12948 AC_VERB_SET_COEF_INDEX, 0x0c);
12949 snd_hda_codec_write(codec, 0x20, 0,
12950 AC_VERB_SET_PROC_COEF, 0x480);
12953 /* toggle speaker-output according to the hp-jacks state */
12954 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12956 unsigned int present;
12957 unsigned char bits;
12959 /* Check laptop headphone socket */
12960 present = snd_hda_codec_read(codec, 0x15, 0,
12961 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12963 /* Check port replicator headphone socket */
12964 present |= snd_hda_codec_read(codec, 0x1a, 0,
12965 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12967 bits = present ? AMP_IN_MUTE(0) : 0;
12968 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12969 AMP_IN_MUTE(0), bits);
12970 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12971 AMP_IN_MUTE(0), bits);
12973 snd_hda_codec_write(codec, 0x20, 0,
12974 AC_VERB_SET_COEF_INDEX, 0x0c);
12975 snd_hda_codec_write(codec, 0x20, 0,
12976 AC_VERB_SET_PROC_COEF, 0x680);
12978 snd_hda_codec_write(codec, 0x20, 0,
12979 AC_VERB_SET_COEF_INDEX, 0x0c);
12980 snd_hda_codec_write(codec, 0x20, 0,
12981 AC_VERB_SET_PROC_COEF, 0x480);
12984 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12986 unsigned int present;
12988 present = snd_hda_codec_read(codec, 0x18, 0,
12989 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12990 snd_hda_codec_write(codec, 0x23, 0,
12991 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12994 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12996 unsigned int present_laptop;
12997 unsigned int present_dock;
12999 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
13000 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13002 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
13003 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13005 /* Laptop mic port overrides dock mic port, design decision */
13007 snd_hda_codec_write(codec, 0x23, 0,
13008 AC_VERB_SET_CONNECT_SEL, 0x3);
13009 if (present_laptop)
13010 snd_hda_codec_write(codec, 0x23, 0,
13011 AC_VERB_SET_CONNECT_SEL, 0x0);
13012 if (!present_dock && !present_laptop)
13013 snd_hda_codec_write(codec, 0x23, 0,
13014 AC_VERB_SET_CONNECT_SEL, 0x1);
13017 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13020 if ((res >> 26) == ALC880_HP_EVENT)
13021 alc269_quanta_fl1_speaker_automute(codec);
13022 if ((res >> 26) == ALC880_MIC_EVENT)
13023 alc269_quanta_fl1_mic_automute(codec);
13026 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13029 if ((res >> 26) == ALC880_HP_EVENT)
13030 alc269_lifebook_speaker_automute(codec);
13031 if ((res >> 26) == ALC880_MIC_EVENT)
13032 alc269_lifebook_mic_autoswitch(codec);
13035 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13037 alc269_quanta_fl1_speaker_automute(codec);
13038 alc269_quanta_fl1_mic_automute(codec);
13041 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13043 alc269_lifebook_speaker_automute(codec);
13044 alc269_lifebook_mic_autoswitch(codec);
13047 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13048 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13049 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13050 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13051 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13052 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13054 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13058 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13059 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13060 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13061 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13063 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13068 /* toggle speaker-output according to the hp-jack state */
13069 static void alc269_speaker_automute(struct hda_codec *codec)
13071 unsigned int present;
13072 unsigned char bits;
13074 present = snd_hda_codec_read(codec, 0x15, 0,
13075 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13076 bits = present ? AMP_IN_MUTE(0) : 0;
13077 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13078 AMP_IN_MUTE(0), bits);
13079 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13080 AMP_IN_MUTE(0), bits);
13083 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
13085 unsigned int present;
13087 present = snd_hda_codec_read(codec, 0x18, 0,
13088 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13089 snd_hda_codec_write(codec, 0x23, 0,
13090 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
13093 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
13095 unsigned int present;
13097 present = snd_hda_codec_read(codec, 0x18, 0,
13098 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13099 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13100 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13101 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13102 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13105 /* unsolicited event for HP jack sensing */
13106 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
13109 if ((res >> 26) == ALC880_HP_EVENT)
13110 alc269_speaker_automute(codec);
13112 if ((res >> 26) == ALC880_MIC_EVENT)
13113 alc269_eeepc_dmic_automute(codec);
13116 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
13118 alc269_speaker_automute(codec);
13119 alc269_eeepc_dmic_automute(codec);
13122 /* unsolicited event for HP jack sensing */
13123 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
13126 if ((res >> 26) == ALC880_HP_EVENT)
13127 alc269_speaker_automute(codec);
13129 if ((res >> 26) == ALC880_MIC_EVENT)
13130 alc269_eeepc_amic_automute(codec);
13133 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
13135 alc269_speaker_automute(codec);
13136 alc269_eeepc_amic_automute(codec);
13140 * generic initialization of ADC, input mixers and output mixers
13142 static struct hda_verb alc269_init_verbs[] = {
13144 * Unmute ADC0 and set the default input to mic-in
13146 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13148 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13149 * analog-loopback mixer widget
13150 * Note: PASD motherboards uses the Line In 2 as the input for
13151 * front panel mic (mic 2)
13153 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13161 * Set up output mixers (0x0c - 0x0e)
13163 /* set vol=0 to output mixers */
13164 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13165 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13167 /* set up input amps for analog loopback */
13168 /* Amp Indices: DAC = 0, mixer = 1 */
13169 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13171 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13173 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13174 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13177 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13178 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13179 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13180 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13181 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13182 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13184 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13185 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13186 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13187 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13189 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13192 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13193 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13195 /* FIXME: use matrix-type input source selection */
13196 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13197 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13201 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13204 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13205 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13209 /* add playback controls from the parsed DAC table */
13210 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13211 const struct auto_pin_cfg *cfg)
13216 spec->multiout.num_dacs = 1; /* only use one dac */
13217 spec->multiout.dac_nids = spec->private_dac_nids;
13218 spec->multiout.dac_nids[0] = 2;
13220 nid = cfg->line_out_pins[0];
13222 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13223 "Front Playback Volume",
13224 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13227 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13228 "Front Playback Switch",
13229 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13234 nid = cfg->speaker_pins[0];
13236 if (!cfg->line_out_pins[0]) {
13237 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13238 "Speaker Playback Volume",
13239 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13245 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13246 "Speaker Playback Switch",
13247 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13252 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13253 "Speaker Playback Switch",
13254 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13260 nid = cfg->hp_pins[0];
13262 /* spec->multiout.hp_nid = 2; */
13263 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13264 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13265 "Headphone Playback Volume",
13266 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13272 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13273 "Headphone Playback Switch",
13274 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13279 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13280 "Headphone Playback Switch",
13281 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13290 #define alc269_auto_create_analog_input_ctls \
13291 alc262_auto_create_analog_input_ctls
13293 #ifdef CONFIG_SND_HDA_POWER_SAVE
13294 #define alc269_loopbacks alc880_loopbacks
13297 /* pcm configuration: identical with ALC880 */
13298 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13299 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13300 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13301 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13303 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13307 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13308 /* NID is set in alc_build_pcms */
13310 .open = alc880_playback_pcm_open,
13311 .prepare = alc880_playback_pcm_prepare,
13312 .cleanup = alc880_playback_pcm_cleanup
13316 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13320 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13321 /* NID is set in alc_build_pcms */
13325 * BIOS auto configuration
13327 static int alc269_parse_auto_config(struct hda_codec *codec)
13329 struct alc_spec *spec = codec->spec;
13331 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13333 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13338 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13341 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13345 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13347 if (spec->autocfg.dig_outs)
13348 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13350 if (spec->kctls.list)
13351 add_mixer(spec, spec->kctls.list);
13353 add_verb(spec, alc269_init_verbs);
13354 spec->num_mux_defs = 1;
13355 spec->input_mux = &spec->private_imux[0];
13356 /* set default input source */
13357 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13358 0, AC_VERB_SET_CONNECT_SEL,
13359 spec->input_mux->items[0].index);
13361 err = alc_auto_add_mic_boost(codec);
13365 if (!spec->cap_mixer && !spec->no_analog)
13366 set_capture_mixer(spec);
13371 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13372 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13373 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13376 /* init callback for auto-configuration model -- overriding the default init */
13377 static void alc269_auto_init(struct hda_codec *codec)
13379 struct alc_spec *spec = codec->spec;
13380 alc269_auto_init_multi_out(codec);
13381 alc269_auto_init_hp_out(codec);
13382 alc269_auto_init_analog_input(codec);
13383 if (spec->unsol_event)
13384 alc_inithook(codec);
13388 * configuration and preset
13390 static const char *alc269_models[ALC269_MODEL_LAST] = {
13391 [ALC269_BASIC] = "basic",
13392 [ALC269_QUANTA_FL1] = "quanta",
13393 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13394 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13395 [ALC269_FUJITSU] = "fujitsu",
13396 [ALC269_LIFEBOOK] = "lifebook"
13399 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13400 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13401 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13402 ALC269_ASUS_EEEPC_P703),
13403 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13404 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13405 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13406 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13407 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13408 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13409 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13410 ALC269_ASUS_EEEPC_P901),
13411 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13412 ALC269_ASUS_EEEPC_P901),
13413 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13414 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13415 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13419 static struct alc_config_preset alc269_presets[] = {
13421 .mixers = { alc269_base_mixer },
13422 .init_verbs = { alc269_init_verbs },
13423 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13424 .dac_nids = alc269_dac_nids,
13426 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13427 .channel_mode = alc269_modes,
13428 .input_mux = &alc269_capture_source,
13430 [ALC269_QUANTA_FL1] = {
13431 .mixers = { alc269_quanta_fl1_mixer },
13432 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13433 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13434 .dac_nids = alc269_dac_nids,
13436 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13437 .channel_mode = alc269_modes,
13438 .input_mux = &alc269_capture_source,
13439 .unsol_event = alc269_quanta_fl1_unsol_event,
13440 .init_hook = alc269_quanta_fl1_init_hook,
13442 [ALC269_ASUS_EEEPC_P703] = {
13443 .mixers = { alc269_eeepc_mixer },
13444 .cap_mixer = alc269_epc_capture_mixer,
13445 .init_verbs = { alc269_init_verbs,
13446 alc269_eeepc_amic_init_verbs },
13447 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13448 .dac_nids = alc269_dac_nids,
13450 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13451 .channel_mode = alc269_modes,
13452 .input_mux = &alc269_eeepc_amic_capture_source,
13453 .unsol_event = alc269_eeepc_amic_unsol_event,
13454 .init_hook = alc269_eeepc_amic_inithook,
13456 [ALC269_ASUS_EEEPC_P901] = {
13457 .mixers = { alc269_eeepc_mixer },
13458 .cap_mixer = alc269_epc_capture_mixer,
13459 .init_verbs = { alc269_init_verbs,
13460 alc269_eeepc_dmic_init_verbs },
13461 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13462 .dac_nids = alc269_dac_nids,
13464 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13465 .channel_mode = alc269_modes,
13466 .input_mux = &alc269_eeepc_dmic_capture_source,
13467 .unsol_event = alc269_eeepc_dmic_unsol_event,
13468 .init_hook = alc269_eeepc_dmic_inithook,
13470 [ALC269_FUJITSU] = {
13471 .mixers = { alc269_fujitsu_mixer },
13472 .cap_mixer = alc269_epc_capture_mixer,
13473 .init_verbs = { alc269_init_verbs,
13474 alc269_eeepc_dmic_init_verbs },
13475 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13476 .dac_nids = alc269_dac_nids,
13478 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13479 .channel_mode = alc269_modes,
13480 .input_mux = &alc269_eeepc_dmic_capture_source,
13481 .unsol_event = alc269_eeepc_dmic_unsol_event,
13482 .init_hook = alc269_eeepc_dmic_inithook,
13484 [ALC269_LIFEBOOK] = {
13485 .mixers = { alc269_lifebook_mixer },
13486 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13487 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13488 .dac_nids = alc269_dac_nids,
13490 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13491 .channel_mode = alc269_modes,
13492 .input_mux = &alc269_capture_source,
13493 .unsol_event = alc269_lifebook_unsol_event,
13494 .init_hook = alc269_lifebook_init_hook,
13498 static int patch_alc269(struct hda_codec *codec)
13500 struct alc_spec *spec;
13504 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13508 codec->spec = spec;
13510 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13512 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13516 if (board_config < 0) {
13517 printk(KERN_INFO "hda_codec: Unknown model for %s, "
13518 "trying auto-probe from BIOS...\n", codec->chip_name);
13519 board_config = ALC269_AUTO;
13522 if (board_config == ALC269_AUTO) {
13523 /* automatic parse from the BIOS config */
13524 err = alc269_parse_auto_config(codec);
13530 "hda_codec: Cannot set up configuration "
13531 "from BIOS. Using base mode...\n");
13532 board_config = ALC269_BASIC;
13536 err = snd_hda_attach_beep_device(codec, 0x1);
13542 if (board_config != ALC269_AUTO)
13543 setup_preset(spec, &alc269_presets[board_config]);
13545 if (codec->subsystem_id == 0x17aa3bf8) {
13546 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13547 * fix the sample rate of analog I/O to 44.1kHz
13549 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13550 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13552 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13553 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13555 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13556 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13558 spec->adc_nids = alc269_adc_nids;
13559 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13560 spec->capsrc_nids = alc269_capsrc_nids;
13561 if (!spec->cap_mixer)
13562 set_capture_mixer(spec);
13563 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13565 codec->patch_ops = alc_patch_ops;
13566 if (board_config == ALC269_AUTO)
13567 spec->init_hook = alc269_auto_init;
13568 #ifdef CONFIG_SND_HDA_POWER_SAVE
13569 if (!spec->loopback.amplist)
13570 spec->loopback.amplist = alc269_loopbacks;
13572 codec->proc_widget_hook = print_realtek_coef;
13578 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13582 * set the path ways for 2 channel output
13583 * need to set the codec line out and mic 1 pin widgets to inputs
13585 static struct hda_verb alc861_threestack_ch2_init[] = {
13586 /* set pin widget 1Ah (line in) for input */
13587 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13588 /* set pin widget 18h (mic1/2) for input, for mic also enable
13591 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13593 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13595 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13596 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13602 * need to set the codec line out and mic 1 pin widgets to outputs
13604 static struct hda_verb alc861_threestack_ch6_init[] = {
13605 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13606 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13607 /* set pin widget 18h (mic1) for output (CLFE)*/
13608 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13610 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13611 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13613 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13615 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13616 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13621 static struct hda_channel_mode alc861_threestack_modes[2] = {
13622 { 2, alc861_threestack_ch2_init },
13623 { 6, alc861_threestack_ch6_init },
13625 /* Set mic1 as input and unmute the mixer */
13626 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13627 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13628 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13631 /* Set mic1 as output and mute mixer */
13632 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13633 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13634 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13638 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13639 { 2, alc861_uniwill_m31_ch2_init },
13640 { 4, alc861_uniwill_m31_ch4_init },
13643 /* Set mic1 and line-in as input and unmute the mixer */
13644 static struct hda_verb alc861_asus_ch2_init[] = {
13645 /* set pin widget 1Ah (line in) for input */
13646 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13647 /* set pin widget 18h (mic1/2) for input, for mic also enable
13650 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13652 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13654 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13655 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13659 /* Set mic1 nad line-in as output and mute mixer */
13660 static struct hda_verb alc861_asus_ch6_init[] = {
13661 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13662 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13663 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13664 /* set pin widget 18h (mic1) for output (CLFE)*/
13665 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13666 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13667 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13668 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13670 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13672 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13673 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13678 static struct hda_channel_mode alc861_asus_modes[2] = {
13679 { 2, alc861_asus_ch2_init },
13680 { 6, alc861_asus_ch6_init },
13685 static struct snd_kcontrol_new alc861_base_mixer[] = {
13686 /* output mixer control */
13687 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13688 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13689 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13690 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13691 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13693 /*Input mixer control */
13694 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13695 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13696 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13697 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13698 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13699 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13700 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13701 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13702 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13703 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13708 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13709 /* output mixer control */
13710 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13711 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13712 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13713 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13714 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13716 /* Input mixer control */
13717 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13718 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13719 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13720 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13721 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13722 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13724 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13725 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13726 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13729 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13730 .name = "Channel Mode",
13731 .info = alc_ch_mode_info,
13732 .get = alc_ch_mode_get,
13733 .put = alc_ch_mode_put,
13734 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13739 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13740 /* output mixer control */
13741 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13743 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13748 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13749 /* output mixer control */
13750 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13751 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13752 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13753 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13754 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13756 /* Input mixer control */
13757 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13758 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13759 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13760 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13761 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13762 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13763 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13764 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13765 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13766 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13769 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13770 .name = "Channel Mode",
13771 .info = alc_ch_mode_info,
13772 .get = alc_ch_mode_get,
13773 .put = alc_ch_mode_put,
13774 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13779 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13780 /* output mixer control */
13781 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13782 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13783 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13784 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13785 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13787 /* Input mixer control */
13788 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13789 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13790 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13791 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13792 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13793 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13795 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13796 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13800 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13801 .name = "Channel Mode",
13802 .info = alc_ch_mode_info,
13803 .get = alc_ch_mode_get,
13804 .put = alc_ch_mode_put,
13805 .private_value = ARRAY_SIZE(alc861_asus_modes),
13810 /* additional mixer */
13811 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13812 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13813 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13818 * generic initialization of ADC, input mixers and output mixers
13820 static struct hda_verb alc861_base_init_verbs[] = {
13822 * Unmute ADC0 and set the default input to mic-in
13824 /* port-A for surround (rear panel) */
13825 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13826 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13827 /* port-B for mic-in (rear panel) with vref */
13828 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13829 /* port-C for line-in (rear panel) */
13830 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13831 /* port-D for Front */
13832 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13833 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13834 /* port-E for HP out (front panel) */
13835 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13836 /* route front PCM to HP */
13837 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13838 /* port-F for mic-in (front panel) with vref */
13839 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13840 /* port-G for CLFE (rear panel) */
13841 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13842 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13843 /* port-H for side (rear panel) */
13844 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13845 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13847 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13848 /* route front mic to ADC1*/
13849 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13850 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13852 /* Unmute DAC0~3 & spdif out*/
13853 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13854 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13855 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13856 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13859 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13860 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13861 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13862 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13863 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13865 /* Unmute Stereo Mixer 15 */
13866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13872 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13873 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13874 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13879 /* hp used DAC 3 (Front) */
13880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13881 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13886 static struct hda_verb alc861_threestack_init_verbs[] = {
13888 * Unmute ADC0 and set the default input to mic-in
13890 /* port-A for surround (rear panel) */
13891 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13892 /* port-B for mic-in (rear panel) with vref */
13893 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13894 /* port-C for line-in (rear panel) */
13895 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13896 /* port-D for Front */
13897 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13898 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13899 /* port-E for HP out (front panel) */
13900 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13901 /* route front PCM to HP */
13902 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13903 /* port-F for mic-in (front panel) with vref */
13904 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13905 /* port-G for CLFE (rear panel) */
13906 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13907 /* port-H for side (rear panel) */
13908 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13910 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13911 /* route front mic to ADC1*/
13912 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13914 /* Unmute DAC0~3 & spdif out*/
13915 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13916 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13917 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13918 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13921 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13922 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13923 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13924 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13925 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13927 /* Unmute Stereo Mixer 15 */
13928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13933 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13934 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13935 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13936 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13937 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13938 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13939 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13940 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13941 /* hp used DAC 3 (Front) */
13942 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13947 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13949 * Unmute ADC0 and set the default input to mic-in
13951 /* port-A for surround (rear panel) */
13952 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13953 /* port-B for mic-in (rear panel) with vref */
13954 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13955 /* port-C for line-in (rear panel) */
13956 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13957 /* port-D for Front */
13958 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13959 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13960 /* port-E for HP out (front panel) */
13961 /* this has to be set to VREF80 */
13962 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13963 /* route front PCM to HP */
13964 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13965 /* port-F for mic-in (front panel) with vref */
13966 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13967 /* port-G for CLFE (rear panel) */
13968 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13969 /* port-H for side (rear panel) */
13970 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13972 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13973 /* route front mic to ADC1*/
13974 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13976 /* Unmute DAC0~3 & spdif out*/
13977 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13978 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13979 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13980 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13983 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13984 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13985 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13986 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13987 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13989 /* Unmute Stereo Mixer 15 */
13990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13995 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13996 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13997 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13998 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13999 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14000 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14001 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14002 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14003 /* hp used DAC 3 (Front) */
14004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14005 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14009 static struct hda_verb alc861_asus_init_verbs[] = {
14011 * Unmute ADC0 and set the default input to mic-in
14013 /* port-A for surround (rear panel)
14014 * according to codec#0 this is the HP jack
14016 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14017 /* route front PCM to HP */
14018 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14019 /* port-B for mic-in (rear panel) with vref */
14020 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14021 /* port-C for line-in (rear panel) */
14022 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14023 /* port-D for Front */
14024 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14025 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14026 /* port-E for HP out (front panel) */
14027 /* this has to be set to VREF80 */
14028 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14029 /* route front PCM to HP */
14030 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14031 /* port-F for mic-in (front panel) with vref */
14032 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14033 /* port-G for CLFE (rear panel) */
14034 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14035 /* port-H for side (rear panel) */
14036 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14038 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14039 /* route front mic to ADC1*/
14040 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14041 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14042 /* Unmute DAC0~3 & spdif out*/
14043 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14044 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14045 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14046 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14047 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14048 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14049 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14050 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14051 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14052 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14054 /* Unmute Stereo Mixer 15 */
14055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14060 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14061 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14062 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14063 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14064 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14065 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14066 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14067 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14068 /* hp used DAC 3 (Front) */
14069 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14070 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14074 /* additional init verbs for ASUS laptops */
14075 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14076 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14077 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14082 * generic initialization of ADC, input mixers and output mixers
14084 static struct hda_verb alc861_auto_init_verbs[] = {
14086 * Unmute ADC0 and set the default input to mic-in
14088 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14091 /* Unmute DAC0~3 & spdif out*/
14092 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14093 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14094 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14095 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14098 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14099 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14100 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14101 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14102 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14104 /* Unmute Stereo Mixer 15 */
14105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14107 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14110 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14111 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14112 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14113 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14114 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14115 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14116 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14117 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14119 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14120 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14121 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14122 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14123 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14124 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14125 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14126 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14128 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14133 static struct hda_verb alc861_toshiba_init_verbs[] = {
14134 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14139 /* toggle speaker-output according to the hp-jack state */
14140 static void alc861_toshiba_automute(struct hda_codec *codec)
14142 unsigned int present;
14144 present = snd_hda_codec_read(codec, 0x0f, 0,
14145 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14146 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14147 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14148 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14149 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14152 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14155 if ((res >> 26) == ALC880_HP_EVENT)
14156 alc861_toshiba_automute(codec);
14159 /* pcm configuration: identical with ALC880 */
14160 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14161 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14162 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14163 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14166 #define ALC861_DIGOUT_NID 0x07
14168 static struct hda_channel_mode alc861_8ch_modes[1] = {
14172 static hda_nid_t alc861_dac_nids[4] = {
14173 /* front, surround, clfe, side */
14174 0x03, 0x06, 0x05, 0x04
14177 static hda_nid_t alc660_dac_nids[3] = {
14178 /* front, clfe, surround */
14182 static hda_nid_t alc861_adc_nids[1] = {
14187 static struct hda_input_mux alc861_capture_source = {
14191 { "Front Mic", 0x3 },
14198 /* fill in the dac_nids table from the parsed pin configuration */
14199 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
14200 const struct auto_pin_cfg *cfg)
14205 spec->multiout.dac_nids = spec->private_dac_nids;
14206 for (i = 0; i < cfg->line_outs; i++) {
14207 nid = cfg->line_out_pins[i];
14209 if (i >= ARRAY_SIZE(alc861_dac_nids))
14211 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
14214 spec->multiout.num_dacs = cfg->line_outs;
14218 /* add playback controls from the parsed DAC table */
14219 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
14220 const struct auto_pin_cfg *cfg)
14223 static const char *chname[4] = {
14224 "Front", "Surround", NULL /*CLFE*/, "Side"
14229 for (i = 0; i < cfg->line_outs; i++) {
14230 nid = spec->multiout.dac_nids[i];
14235 err = add_control(spec, ALC_CTL_BIND_MUTE,
14236 "Center Playback Switch",
14237 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14241 err = add_control(spec, ALC_CTL_BIND_MUTE,
14242 "LFE Playback Switch",
14243 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14248 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
14250 if (nid == alc861_dac_nids[idx])
14252 sprintf(name, "%s Playback Switch", chname[idx]);
14253 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14254 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14263 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
14271 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14273 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
14274 "Headphone Playback Switch",
14275 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14278 spec->multiout.hp_nid = nid;
14283 /* create playback/capture controls for input pins */
14284 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
14285 const struct auto_pin_cfg *cfg)
14287 struct hda_input_mux *imux = &spec->private_imux[0];
14288 int i, err, idx, idx1;
14290 for (i = 0; i < AUTO_PIN_LAST; i++) {
14291 switch (cfg->input_pins[i]) {
14294 idx = 2; /* Line In */
14298 idx = 2; /* Line In */
14302 idx = 1; /* Mic In */
14306 idx = 1; /* Mic In */
14316 err = new_analog_input(spec, cfg->input_pins[i],
14317 auto_pin_cfg_labels[i], idx, 0x15);
14321 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14322 imux->items[imux->num_items].index = idx1;
14328 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14330 int pin_type, int dac_idx)
14332 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14334 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14338 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14340 struct alc_spec *spec = codec->spec;
14343 for (i = 0; i < spec->autocfg.line_outs; i++) {
14344 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14345 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14347 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14348 spec->multiout.dac_nids[i]);
14352 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14354 struct alc_spec *spec = codec->spec;
14357 pin = spec->autocfg.hp_pins[0];
14358 if (pin) /* connect to front */
14359 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14360 spec->multiout.dac_nids[0]);
14361 pin = spec->autocfg.speaker_pins[0];
14363 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14366 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14368 struct alc_spec *spec = codec->spec;
14371 for (i = 0; i < AUTO_PIN_LAST; i++) {
14372 hda_nid_t nid = spec->autocfg.input_pins[i];
14373 if (nid >= 0x0c && nid <= 0x11)
14374 alc_set_input_pin(codec, nid, i);
14378 /* parse the BIOS configuration and set up the alc_spec */
14379 /* return 1 if successful, 0 if the proper config is not found,
14380 * or a negative error code
14382 static int alc861_parse_auto_config(struct hda_codec *codec)
14384 struct alc_spec *spec = codec->spec;
14386 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14388 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14392 if (!spec->autocfg.line_outs)
14393 return 0; /* can't find valid BIOS pin config */
14395 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
14398 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
14401 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
14404 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
14408 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14410 if (spec->autocfg.dig_outs)
14411 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14413 if (spec->kctls.list)
14414 add_mixer(spec, spec->kctls.list);
14416 add_verb(spec, alc861_auto_init_verbs);
14418 spec->num_mux_defs = 1;
14419 spec->input_mux = &spec->private_imux[0];
14421 spec->adc_nids = alc861_adc_nids;
14422 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14423 set_capture_mixer(spec);
14425 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14430 /* additional initialization for auto-configuration model */
14431 static void alc861_auto_init(struct hda_codec *codec)
14433 struct alc_spec *spec = codec->spec;
14434 alc861_auto_init_multi_out(codec);
14435 alc861_auto_init_hp_out(codec);
14436 alc861_auto_init_analog_input(codec);
14437 if (spec->unsol_event)
14438 alc_inithook(codec);
14441 #ifdef CONFIG_SND_HDA_POWER_SAVE
14442 static struct hda_amp_list alc861_loopbacks[] = {
14443 { 0x15, HDA_INPUT, 0 },
14444 { 0x15, HDA_INPUT, 1 },
14445 { 0x15, HDA_INPUT, 2 },
14446 { 0x15, HDA_INPUT, 3 },
14453 * configuration and preset
14455 static const char *alc861_models[ALC861_MODEL_LAST] = {
14456 [ALC861_3ST] = "3stack",
14457 [ALC660_3ST] = "3stack-660",
14458 [ALC861_3ST_DIG] = "3stack-dig",
14459 [ALC861_6ST_DIG] = "6stack-dig",
14460 [ALC861_UNIWILL_M31] = "uniwill-m31",
14461 [ALC861_TOSHIBA] = "toshiba",
14462 [ALC861_ASUS] = "asus",
14463 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14464 [ALC861_AUTO] = "auto",
14467 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14468 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14469 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14470 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14471 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14472 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14473 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14474 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14475 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14476 * Any other models that need this preset?
14478 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14479 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14480 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14481 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14482 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14483 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14484 /* FIXME: the below seems conflict */
14485 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14486 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14487 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14491 static struct alc_config_preset alc861_presets[] = {
14493 .mixers = { alc861_3ST_mixer },
14494 .init_verbs = { alc861_threestack_init_verbs },
14495 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14496 .dac_nids = alc861_dac_nids,
14497 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14498 .channel_mode = alc861_threestack_modes,
14500 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14501 .adc_nids = alc861_adc_nids,
14502 .input_mux = &alc861_capture_source,
14504 [ALC861_3ST_DIG] = {
14505 .mixers = { alc861_base_mixer },
14506 .init_verbs = { alc861_threestack_init_verbs },
14507 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14508 .dac_nids = alc861_dac_nids,
14509 .dig_out_nid = ALC861_DIGOUT_NID,
14510 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14511 .channel_mode = alc861_threestack_modes,
14513 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14514 .adc_nids = alc861_adc_nids,
14515 .input_mux = &alc861_capture_source,
14517 [ALC861_6ST_DIG] = {
14518 .mixers = { alc861_base_mixer },
14519 .init_verbs = { alc861_base_init_verbs },
14520 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14521 .dac_nids = alc861_dac_nids,
14522 .dig_out_nid = ALC861_DIGOUT_NID,
14523 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14524 .channel_mode = alc861_8ch_modes,
14525 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14526 .adc_nids = alc861_adc_nids,
14527 .input_mux = &alc861_capture_source,
14530 .mixers = { alc861_3ST_mixer },
14531 .init_verbs = { alc861_threestack_init_verbs },
14532 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14533 .dac_nids = alc660_dac_nids,
14534 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14535 .channel_mode = alc861_threestack_modes,
14537 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14538 .adc_nids = alc861_adc_nids,
14539 .input_mux = &alc861_capture_source,
14541 [ALC861_UNIWILL_M31] = {
14542 .mixers = { alc861_uniwill_m31_mixer },
14543 .init_verbs = { alc861_uniwill_m31_init_verbs },
14544 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14545 .dac_nids = alc861_dac_nids,
14546 .dig_out_nid = ALC861_DIGOUT_NID,
14547 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14548 .channel_mode = alc861_uniwill_m31_modes,
14550 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14551 .adc_nids = alc861_adc_nids,
14552 .input_mux = &alc861_capture_source,
14554 [ALC861_TOSHIBA] = {
14555 .mixers = { alc861_toshiba_mixer },
14556 .init_verbs = { alc861_base_init_verbs,
14557 alc861_toshiba_init_verbs },
14558 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14559 .dac_nids = alc861_dac_nids,
14560 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14561 .channel_mode = alc883_3ST_2ch_modes,
14562 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14563 .adc_nids = alc861_adc_nids,
14564 .input_mux = &alc861_capture_source,
14565 .unsol_event = alc861_toshiba_unsol_event,
14566 .init_hook = alc861_toshiba_automute,
14569 .mixers = { alc861_asus_mixer },
14570 .init_verbs = { alc861_asus_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(alc861_asus_modes),
14575 .channel_mode = alc861_asus_modes,
14578 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14579 .adc_nids = alc861_adc_nids,
14580 .input_mux = &alc861_capture_source,
14582 [ALC861_ASUS_LAPTOP] = {
14583 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14584 .init_verbs = { alc861_asus_init_verbs,
14585 alc861_asus_laptop_init_verbs },
14586 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14587 .dac_nids = alc861_dac_nids,
14588 .dig_out_nid = ALC861_DIGOUT_NID,
14589 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14590 .channel_mode = alc883_3ST_2ch_modes,
14592 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14593 .adc_nids = alc861_adc_nids,
14594 .input_mux = &alc861_capture_source,
14599 static int patch_alc861(struct hda_codec *codec)
14601 struct alc_spec *spec;
14605 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14609 codec->spec = spec;
14611 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14615 if (board_config < 0) {
14616 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14617 "trying auto-probe from BIOS...\n", codec->chip_name);
14618 board_config = ALC861_AUTO;
14621 if (board_config == ALC861_AUTO) {
14622 /* automatic parse from the BIOS config */
14623 err = alc861_parse_auto_config(codec);
14629 "hda_codec: Cannot set up configuration "
14630 "from BIOS. Using base mode...\n");
14631 board_config = ALC861_3ST_DIG;
14635 err = snd_hda_attach_beep_device(codec, 0x23);
14641 if (board_config != ALC861_AUTO)
14642 setup_preset(spec, &alc861_presets[board_config]);
14644 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14645 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14647 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14648 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14650 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14652 spec->vmaster_nid = 0x03;
14654 codec->patch_ops = alc_patch_ops;
14655 if (board_config == ALC861_AUTO)
14656 spec->init_hook = alc861_auto_init;
14657 #ifdef CONFIG_SND_HDA_POWER_SAVE
14658 if (!spec->loopback.amplist)
14659 spec->loopback.amplist = alc861_loopbacks;
14661 codec->proc_widget_hook = print_realtek_coef;
14667 * ALC861-VD support
14671 * In addition, an independent DAC
14673 #define ALC861VD_DIGOUT_NID 0x06
14675 static hda_nid_t alc861vd_dac_nids[4] = {
14676 /* front, surr, clfe, side surr */
14677 0x02, 0x03, 0x04, 0x05
14680 /* dac_nids for ALC660vd are in a different order - according to
14681 * Realtek's driver.
14682 * This should probably result in a different mixer for 6stack models
14683 * of ALC660vd codecs, but for now there is only 3stack mixer
14684 * - and it is the same as in 861vd.
14685 * adc_nids in ALC660vd are (is) the same as in 861vd
14687 static hda_nid_t alc660vd_dac_nids[3] = {
14688 /* front, rear, clfe, rear_surr */
14692 static hda_nid_t alc861vd_adc_nids[1] = {
14697 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14700 /* FIXME: should be a matrix-type input source selection */
14701 static struct hda_input_mux alc861vd_capture_source = {
14705 { "Front Mic", 0x1 },
14711 static struct hda_input_mux alc861vd_dallas_capture_source = {
14714 { "Ext Mic", 0x0 },
14715 { "Int Mic", 0x1 },
14719 static struct hda_input_mux alc861vd_hp_capture_source = {
14722 { "Front Mic", 0x0 },
14723 { "ATAPI Mic", 0x1 },
14730 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14737 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14738 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14739 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14740 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14741 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14748 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14749 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14750 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14751 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14752 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14756 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14757 { 6, alc861vd_6stack_ch6_init },
14758 { 8, alc861vd_6stack_ch8_init },
14761 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14763 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14764 .name = "Channel Mode",
14765 .info = alc_ch_mode_info,
14766 .get = alc_ch_mode_get,
14767 .put = alc_ch_mode_put,
14772 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14773 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14775 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14776 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14777 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14779 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14780 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14782 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14784 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14786 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14787 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14789 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14790 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14792 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14794 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14798 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14802 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14803 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14805 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14806 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14811 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14812 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14813 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14817 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14821 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14822 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14823 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14825 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14826 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14828 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14829 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14834 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14835 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14836 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14837 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14839 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14841 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14845 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14849 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14850 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14855 /* Pin assignment: Speaker=0x14, HP = 0x15,
14856 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14858 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14859 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14860 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14861 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14862 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14863 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14864 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14865 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14866 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14867 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14868 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14872 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14873 * Front Mic=0x18, ATAPI Mic = 0x19,
14875 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14876 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14877 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14878 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14879 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14880 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14881 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14882 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14883 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14889 * generic initialization of ADC, input mixers and output mixers
14891 static struct hda_verb alc861vd_volume_init_verbs[] = {
14893 * Unmute ADC0 and set the default input to mic-in
14895 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14896 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14898 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14899 * the analog-loopback mixer widget
14901 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14904 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14908 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14912 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14915 * Set up output mixers (0x02 - 0x05)
14917 /* set vol=0 to output mixers */
14918 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14919 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14920 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14921 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14923 /* set up input amps for analog loopback */
14924 /* Amp Indices: DAC = 0, mixer = 1 */
14925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14927 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14928 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14929 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14930 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14931 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14932 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14938 * 3-stack pin configuration:
14939 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14941 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14943 * Set pin mode and muting
14945 /* set front pin widgets 0x14 for output */
14946 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14948 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14950 /* Mic (rear) pin: input vref at 80% */
14951 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14952 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14953 /* Front Mic pin: input vref at 80% */
14954 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14955 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14956 /* Line In pin: input */
14957 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14958 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14959 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14960 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14961 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14962 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14963 /* CD pin widget for input */
14964 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14970 * 6-stack pin configuration:
14972 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14974 * Set pin mode and muting
14976 /* set front pin widgets 0x14 for output */
14977 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14978 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14979 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14981 /* Rear Pin: output 1 (0x0d) */
14982 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14983 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14984 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14985 /* CLFE Pin: output 2 (0x0e) */
14986 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14987 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14988 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14989 /* Side Pin: output 3 (0x0f) */
14990 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14991 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14992 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14994 /* Mic (rear) pin: input vref at 80% */
14995 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14996 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14997 /* Front Mic pin: input vref at 80% */
14998 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14999 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15000 /* Line In pin: input */
15001 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15002 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15003 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15004 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15005 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15006 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15007 /* CD pin widget for input */
15008 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15013 static struct hda_verb alc861vd_eapd_verbs[] = {
15014 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15018 static struct hda_verb alc660vd_eapd_verbs[] = {
15019 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15020 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15024 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15026 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15028 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15029 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15033 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15035 unsigned int present;
15036 unsigned char bits;
15038 present = snd_hda_codec_read(codec, 0x18, 0,
15039 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15040 bits = present ? HDA_AMP_MUTE : 0;
15041 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15042 HDA_AMP_MUTE, bits);
15045 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15047 struct alc_spec *spec = codec->spec;
15049 spec->autocfg.hp_pins[0] = 0x1b;
15050 spec->autocfg.speaker_pins[0] = 0x14;
15051 alc_automute_amp(codec);
15052 alc861vd_lenovo_mic_automute(codec);
15055 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15058 switch (res >> 26) {
15059 case ALC880_MIC_EVENT:
15060 alc861vd_lenovo_mic_automute(codec);
15063 alc_automute_amp_unsol_event(codec, res);
15068 static struct hda_verb alc861vd_dallas_verbs[] = {
15069 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15070 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15071 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15072 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15076 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15079 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15080 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15085 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15086 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15087 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15088 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15089 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15090 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15092 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15093 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15094 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15095 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15096 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15097 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15098 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15099 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15107 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15108 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15113 /* toggle speaker-output according to the hp-jack state */
15114 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
15116 struct alc_spec *spec = codec->spec;
15118 spec->autocfg.hp_pins[0] = 0x15;
15119 spec->autocfg.speaker_pins[0] = 0x14;
15120 alc_automute_amp(codec);
15123 #ifdef CONFIG_SND_HDA_POWER_SAVE
15124 #define alc861vd_loopbacks alc880_loopbacks
15127 /* pcm configuration: identical with ALC880 */
15128 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15129 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15130 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15131 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15134 * configuration and preset
15136 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15137 [ALC660VD_3ST] = "3stack-660",
15138 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15139 [ALC660VD_ASUS_V1S] = "asus-v1s",
15140 [ALC861VD_3ST] = "3stack",
15141 [ALC861VD_3ST_DIG] = "3stack-digout",
15142 [ALC861VD_6ST_DIG] = "6stack-digout",
15143 [ALC861VD_LENOVO] = "lenovo",
15144 [ALC861VD_DALLAS] = "dallas",
15145 [ALC861VD_HP] = "hp",
15146 [ALC861VD_AUTO] = "auto",
15149 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15150 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15151 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15152 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15153 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15154 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15155 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15156 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15157 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15158 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15159 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
15160 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15161 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15162 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15163 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15164 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15168 static struct alc_config_preset alc861vd_presets[] = {
15170 .mixers = { alc861vd_3st_mixer },
15171 .init_verbs = { alc861vd_volume_init_verbs,
15172 alc861vd_3stack_init_verbs },
15173 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15174 .dac_nids = alc660vd_dac_nids,
15175 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15176 .channel_mode = alc861vd_3stack_2ch_modes,
15177 .input_mux = &alc861vd_capture_source,
15179 [ALC660VD_3ST_DIG] = {
15180 .mixers = { alc861vd_3st_mixer },
15181 .init_verbs = { alc861vd_volume_init_verbs,
15182 alc861vd_3stack_init_verbs },
15183 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15184 .dac_nids = alc660vd_dac_nids,
15185 .dig_out_nid = ALC861VD_DIGOUT_NID,
15186 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15187 .channel_mode = alc861vd_3stack_2ch_modes,
15188 .input_mux = &alc861vd_capture_source,
15191 .mixers = { alc861vd_3st_mixer },
15192 .init_verbs = { alc861vd_volume_init_verbs,
15193 alc861vd_3stack_init_verbs },
15194 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15195 .dac_nids = alc861vd_dac_nids,
15196 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15197 .channel_mode = alc861vd_3stack_2ch_modes,
15198 .input_mux = &alc861vd_capture_source,
15200 [ALC861VD_3ST_DIG] = {
15201 .mixers = { alc861vd_3st_mixer },
15202 .init_verbs = { alc861vd_volume_init_verbs,
15203 alc861vd_3stack_init_verbs },
15204 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15205 .dac_nids = alc861vd_dac_nids,
15206 .dig_out_nid = ALC861VD_DIGOUT_NID,
15207 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15208 .channel_mode = alc861vd_3stack_2ch_modes,
15209 .input_mux = &alc861vd_capture_source,
15211 [ALC861VD_6ST_DIG] = {
15212 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15213 .init_verbs = { alc861vd_volume_init_verbs,
15214 alc861vd_6stack_init_verbs },
15215 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15216 .dac_nids = alc861vd_dac_nids,
15217 .dig_out_nid = ALC861VD_DIGOUT_NID,
15218 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15219 .channel_mode = alc861vd_6stack_modes,
15220 .input_mux = &alc861vd_capture_source,
15222 [ALC861VD_LENOVO] = {
15223 .mixers = { alc861vd_lenovo_mixer },
15224 .init_verbs = { alc861vd_volume_init_verbs,
15225 alc861vd_3stack_init_verbs,
15226 alc861vd_eapd_verbs,
15227 alc861vd_lenovo_unsol_verbs },
15228 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15229 .dac_nids = alc660vd_dac_nids,
15230 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15231 .channel_mode = alc861vd_3stack_2ch_modes,
15232 .input_mux = &alc861vd_capture_source,
15233 .unsol_event = alc861vd_lenovo_unsol_event,
15234 .init_hook = alc861vd_lenovo_init_hook,
15236 [ALC861VD_DALLAS] = {
15237 .mixers = { alc861vd_dallas_mixer },
15238 .init_verbs = { alc861vd_dallas_verbs },
15239 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15240 .dac_nids = alc861vd_dac_nids,
15241 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15242 .channel_mode = alc861vd_3stack_2ch_modes,
15243 .input_mux = &alc861vd_dallas_capture_source,
15244 .unsol_event = alc_automute_amp_unsol_event,
15245 .init_hook = alc861vd_dallas_init_hook,
15248 .mixers = { alc861vd_hp_mixer },
15249 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15250 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15251 .dac_nids = alc861vd_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_hp_capture_source,
15256 .unsol_event = alc_automute_amp_unsol_event,
15257 .init_hook = alc861vd_dallas_init_hook,
15259 [ALC660VD_ASUS_V1S] = {
15260 .mixers = { alc861vd_lenovo_mixer },
15261 .init_verbs = { alc861vd_volume_init_verbs,
15262 alc861vd_3stack_init_verbs,
15263 alc861vd_eapd_verbs,
15264 alc861vd_lenovo_unsol_verbs },
15265 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15266 .dac_nids = alc660vd_dac_nids,
15267 .dig_out_nid = ALC861VD_DIGOUT_NID,
15268 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15269 .channel_mode = alc861vd_3stack_2ch_modes,
15270 .input_mux = &alc861vd_capture_source,
15271 .unsol_event = alc861vd_lenovo_unsol_event,
15272 .init_hook = alc861vd_lenovo_init_hook,
15277 * BIOS auto configuration
15279 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15280 hda_nid_t nid, int pin_type, int dac_idx)
15282 alc_set_pin_output(codec, nid, pin_type);
15285 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15287 struct alc_spec *spec = codec->spec;
15290 for (i = 0; i <= HDA_SIDE; i++) {
15291 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15292 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15294 alc861vd_auto_set_output_and_unmute(codec, nid,
15300 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15302 struct alc_spec *spec = codec->spec;
15305 pin = spec->autocfg.hp_pins[0];
15306 if (pin) /* connect to front and use dac 0 */
15307 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15308 pin = spec->autocfg.speaker_pins[0];
15310 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15313 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15314 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15316 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15318 struct alc_spec *spec = codec->spec;
15321 for (i = 0; i < AUTO_PIN_LAST; i++) {
15322 hda_nid_t nid = spec->autocfg.input_pins[i];
15323 if (alc861vd_is_input_pin(nid)) {
15324 alc_set_input_pin(codec, nid, i);
15325 if (nid != ALC861VD_PIN_CD_NID &&
15326 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15327 snd_hda_codec_write(codec, nid, 0,
15328 AC_VERB_SET_AMP_GAIN_MUTE,
15334 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15336 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15337 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15339 /* add playback controls from the parsed DAC table */
15340 /* Based on ALC880 version. But ALC861VD has separate,
15341 * different NIDs for mute/unmute switch and volume control */
15342 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15343 const struct auto_pin_cfg *cfg)
15346 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15347 hda_nid_t nid_v, nid_s;
15350 for (i = 0; i < cfg->line_outs; i++) {
15351 if (!spec->multiout.dac_nids[i])
15353 nid_v = alc861vd_idx_to_mixer_vol(
15355 spec->multiout.dac_nids[i]));
15356 nid_s = alc861vd_idx_to_mixer_switch(
15358 spec->multiout.dac_nids[i]));
15362 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15363 "Center Playback Volume",
15364 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15368 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15369 "LFE Playback Volume",
15370 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15374 err = add_control(spec, ALC_CTL_BIND_MUTE,
15375 "Center Playback Switch",
15376 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15380 err = add_control(spec, ALC_CTL_BIND_MUTE,
15381 "LFE Playback Switch",
15382 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15387 sprintf(name, "%s Playback Volume", chname[i]);
15388 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15389 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15393 sprintf(name, "%s Playback Switch", chname[i]);
15394 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15395 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15404 /* add playback controls for speaker and HP outputs */
15405 /* Based on ALC880 version. But ALC861VD has separate,
15406 * different NIDs for mute/unmute switch and volume control */
15407 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15408 hda_nid_t pin, const char *pfx)
15410 hda_nid_t nid_v, nid_s;
15417 if (alc880_is_fixed_pin(pin)) {
15418 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15419 /* specify the DAC as the extra output */
15420 if (!spec->multiout.hp_nid)
15421 spec->multiout.hp_nid = nid_v;
15423 spec->multiout.extra_out_nid[0] = nid_v;
15424 /* control HP volume/switch on the output mixer amp */
15425 nid_v = alc861vd_idx_to_mixer_vol(
15426 alc880_fixed_pin_idx(pin));
15427 nid_s = alc861vd_idx_to_mixer_switch(
15428 alc880_fixed_pin_idx(pin));
15430 sprintf(name, "%s Playback Volume", pfx);
15431 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15432 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15435 sprintf(name, "%s Playback Switch", pfx);
15436 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15437 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15440 } else if (alc880_is_multi_pin(pin)) {
15441 /* set manual connection */
15442 /* we have only a switch on HP-out PIN */
15443 sprintf(name, "%s Playback Switch", pfx);
15444 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15445 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15452 /* parse the BIOS configuration and set up the alc_spec
15453 * return 1 if successful, 0 if the proper config is not found,
15454 * or a negative error code
15455 * Based on ALC880 version - had to change it to override
15456 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15457 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15459 struct alc_spec *spec = codec->spec;
15461 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15463 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15467 if (!spec->autocfg.line_outs)
15468 return 0; /* can't find valid BIOS pin config */
15470 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15473 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15476 err = alc861vd_auto_create_extra_out(spec,
15477 spec->autocfg.speaker_pins[0],
15481 err = alc861vd_auto_create_extra_out(spec,
15482 spec->autocfg.hp_pins[0],
15486 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15490 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15492 if (spec->autocfg.dig_outs)
15493 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15495 if (spec->kctls.list)
15496 add_mixer(spec, spec->kctls.list);
15498 add_verb(spec, alc861vd_volume_init_verbs);
15500 spec->num_mux_defs = 1;
15501 spec->input_mux = &spec->private_imux[0];
15503 err = alc_auto_add_mic_boost(codec);
15507 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15512 /* additional initialization for auto-configuration model */
15513 static void alc861vd_auto_init(struct hda_codec *codec)
15515 struct alc_spec *spec = codec->spec;
15516 alc861vd_auto_init_multi_out(codec);
15517 alc861vd_auto_init_hp_out(codec);
15518 alc861vd_auto_init_analog_input(codec);
15519 alc861vd_auto_init_input_src(codec);
15520 if (spec->unsol_event)
15521 alc_inithook(codec);
15524 static int patch_alc861vd(struct hda_codec *codec)
15526 struct alc_spec *spec;
15527 int err, board_config;
15529 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15533 codec->spec = spec;
15535 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15539 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15540 printk(KERN_INFO "hda_codec: Unknown model for %s, "
15541 "trying auto-probe from BIOS...\n", codec->chip_name);
15542 board_config = ALC861VD_AUTO;
15545 if (board_config == ALC861VD_AUTO) {
15546 /* automatic parse from the BIOS config */
15547 err = alc861vd_parse_auto_config(codec);
15553 "hda_codec: Cannot set up configuration "
15554 "from BIOS. Using base mode...\n");
15555 board_config = ALC861VD_3ST;
15559 err = snd_hda_attach_beep_device(codec, 0x23);
15565 if (board_config != ALC861VD_AUTO)
15566 setup_preset(spec, &alc861vd_presets[board_config]);
15568 if (codec->vendor_id == 0x10ec0660) {
15569 /* always turn on EAPD */
15570 add_verb(spec, alc660vd_eapd_verbs);
15573 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15574 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15576 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15577 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15579 spec->adc_nids = alc861vd_adc_nids;
15580 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15581 spec->capsrc_nids = alc861vd_capsrc_nids;
15583 set_capture_mixer(spec);
15584 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15586 spec->vmaster_nid = 0x02;
15588 codec->patch_ops = alc_patch_ops;
15590 if (board_config == ALC861VD_AUTO)
15591 spec->init_hook = alc861vd_auto_init;
15592 #ifdef CONFIG_SND_HDA_POWER_SAVE
15593 if (!spec->loopback.amplist)
15594 spec->loopback.amplist = alc861vd_loopbacks;
15596 codec->proc_widget_hook = print_realtek_coef;
15604 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15605 * configuration. Each pin widget can choose any input DACs and a mixer.
15606 * Each ADC is connected from a mixer of all inputs. This makes possible
15607 * 6-channel independent captures.
15609 * In addition, an independent DAC for the multi-playback (not used in this
15612 #define ALC662_DIGOUT_NID 0x06
15613 #define ALC662_DIGIN_NID 0x0a
15615 static hda_nid_t alc662_dac_nids[4] = {
15616 /* front, rear, clfe, rear_surr */
15620 static hda_nid_t alc272_dac_nids[2] = {
15624 static hda_nid_t alc662_adc_nids[1] = {
15629 static hda_nid_t alc272_adc_nids[1] = {
15634 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15635 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15639 /* FIXME: should be a matrix-type input source selection */
15640 static struct hda_input_mux alc662_capture_source = {
15644 { "Front Mic", 0x1 },
15650 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15658 static struct hda_input_mux alc662_eeepc_capture_source = {
15666 static struct hda_input_mux alc663_capture_source = {
15670 { "Front Mic", 0x1 },
15675 static struct hda_input_mux alc663_m51va_capture_source = {
15678 { "Ext-Mic", 0x0 },
15683 #if 1 /* set to 0 for testing other input sources below */
15684 static struct hda_input_mux alc272_nc10_capture_source = {
15687 { "Autoselect Mic", 0x0 },
15688 { "Internal Mic", 0x1 },
15692 static struct hda_input_mux alc272_nc10_capture_source = {
15695 { "Autoselect Mic", 0x0 },
15696 { "Internal Mic", 0x1 },
15697 { "In-0x02", 0x2 },
15698 { "In-0x03", 0x3 },
15699 { "In-0x04", 0x4 },
15700 { "In-0x05", 0x5 },
15701 { "In-0x06", 0x6 },
15702 { "In-0x07", 0x7 },
15703 { "In-0x08", 0x8 },
15704 { "In-0x09", 0x9 },
15705 { "In-0x0a", 0x0a },
15706 { "In-0x0b", 0x0b },
15707 { "In-0x0c", 0x0c },
15708 { "In-0x0d", 0x0d },
15709 { "In-0x0e", 0x0e },
15710 { "In-0x0f", 0x0f },
15718 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15725 static struct hda_verb alc662_3ST_ch2_init[] = {
15726 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15727 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15728 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15729 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15736 static struct hda_verb alc662_3ST_ch6_init[] = {
15737 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15738 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15739 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15740 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15741 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15742 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15746 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15747 { 2, alc662_3ST_ch2_init },
15748 { 6, alc662_3ST_ch6_init },
15754 static struct hda_verb alc662_sixstack_ch6_init[] = {
15755 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15756 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15757 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15764 static struct hda_verb alc662_sixstack_ch8_init[] = {
15765 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15766 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15767 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15771 static struct hda_channel_mode alc662_5stack_modes[2] = {
15772 { 2, alc662_sixstack_ch6_init },
15773 { 6, alc662_sixstack_ch8_init },
15776 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15777 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15780 static struct snd_kcontrol_new alc662_base_mixer[] = {
15781 /* output mixer control */
15782 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15783 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15784 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15785 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15786 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15787 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15788 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15789 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15792 /*Input mixer control */
15793 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15794 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15795 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15796 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15797 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15798 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15804 static struct snd_kcontrol_new alc662_3ST_2ch_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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15810 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15811 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15814 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15815 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15819 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15820 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15821 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15822 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15823 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15824 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15825 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15826 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15827 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
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, 0x0, HDA_INPUT),
15834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15835 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15836 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15840 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15841 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15842 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15844 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15845 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15846 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15847 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15853 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15854 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15855 ALC262_HIPPO_MASTER_SWITCH,
15857 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15858 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15859 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15861 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15862 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15863 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15867 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15868 ALC262_HIPPO_MASTER_SWITCH,
15869 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15870 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15871 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15872 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15873 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15874 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15875 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15877 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15881 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15882 .ops = &snd_hda_bind_vol,
15884 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15885 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15890 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15891 .ops = &snd_hda_bind_sw,
15893 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15894 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15899 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15900 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15901 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15907 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15908 .ops = &snd_hda_bind_sw,
15910 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15911 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15912 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15917 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15918 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15919 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15922 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15923 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15928 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15929 .ops = &snd_hda_bind_sw,
15931 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15932 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15933 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15938 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15939 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15940 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15943 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15944 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15948 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15949 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15950 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15953 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15954 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15955 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15959 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15960 .ops = &snd_hda_bind_vol,
15962 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15963 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15968 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15969 .ops = &snd_hda_bind_sw,
15971 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15972 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15977 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15978 HDA_BIND_VOL("Master Playback Volume",
15979 &alc663_asus_two_bind_master_vol),
15980 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15981 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15988 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15989 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15990 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15991 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15992 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15998 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15999 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16000 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16001 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16002 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16003 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16007 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16008 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16012 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16013 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16014 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16015 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16019 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16020 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16026 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16029 .name = "Channel Mode",
16030 .info = alc_ch_mode_info,
16031 .get = alc_ch_mode_get,
16032 .put = alc_ch_mode_put,
16037 static struct hda_verb alc662_init_verbs[] = {
16038 /* ADC: mute amp left and right */
16039 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16040 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16041 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16047 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16053 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16056 /* Front Pin: output 0 (0x0c) */
16057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16058 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16060 /* Rear Pin: output 1 (0x0d) */
16061 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16064 /* CLFE Pin: output 2 (0x0e) */
16065 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16066 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16068 /* Mic (rear) pin: input vref at 80% */
16069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16070 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16071 /* Front Mic pin: input vref at 80% */
16072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16073 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16074 /* Line In pin: input */
16075 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16076 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16077 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16078 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16079 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16080 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16081 /* CD pin widget for input */
16082 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16084 /* FIXME: use matrix-type input source selection */
16085 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16088 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16090 /* always trun on EAPD */
16091 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16092 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16097 static struct hda_verb alc662_sue_init_verbs[] = {
16098 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16099 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16103 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16104 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16105 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16109 /* Set Unsolicited Event*/
16110 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16111 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16112 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16117 * generic initialization of ADC, input mixers and output mixers
16119 static struct hda_verb alc662_auto_init_verbs[] = {
16121 * Unmute ADC and set the default input to mic-in
16123 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16126 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16128 * Note: PASD motherboards uses the Line In 2 as the input for front
16129 * panel mic (mic 2)
16131 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16139 * Set up output mixers (0x0c - 0x0f)
16141 /* set vol=0 to output mixers */
16142 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16143 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16144 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16146 /* set up input amps for analog loopback */
16147 /* Amp Indices: DAC = 0, mixer = 1 */
16148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16150 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16152 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16153 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16156 /* FIXME: use matrix-type input source selection */
16157 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16159 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16160 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16164 /* additional verbs for ALC663 */
16165 static struct hda_verb alc663_auto_init_verbs[] = {
16166 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16167 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16171 static struct hda_verb alc663_m51va_init_verbs[] = {
16172 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16173 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16174 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16175 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16176 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16180 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16184 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16185 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16186 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16187 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16190 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16191 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16195 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16197 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16198 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16199 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16202 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16203 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16207 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
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, 0x01}, /* 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 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16218 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16219 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16220 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16221 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16222 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16223 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16225 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16226 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16227 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16228 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16229 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16230 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16234 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16235 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16238 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16241 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16242 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16243 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16244 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16245 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16246 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16250 static struct hda_verb alc663_g71v_init_verbs[] = {
16251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16252 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16253 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16255 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16256 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16257 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16259 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16260 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16261 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16265 static struct hda_verb alc663_g50v_init_verbs[] = {
16266 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16267 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16268 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16270 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16271 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16275 static struct hda_verb alc662_ecs_init_verbs[] = {
16276 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16278 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16279 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16283 static struct hda_verb alc272_dell_zm1_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 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16292 {0x22, 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 hda_verb alc272_dell_init_verbs[] = {
16299 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16300 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16302 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16303 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16304 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16305 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16308 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16309 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16313 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16314 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16315 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16319 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16320 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16321 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16325 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16327 unsigned int present;
16328 unsigned char bits;
16330 present = snd_hda_codec_read(codec, 0x14, 0,
16331 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16332 bits = present ? HDA_AMP_MUTE : 0;
16333 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16334 HDA_AMP_MUTE, bits);
16337 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16339 unsigned int present;
16340 unsigned char bits;
16342 present = snd_hda_codec_read(codec, 0x1b, 0,
16343 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16344 bits = present ? HDA_AMP_MUTE : 0;
16345 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16346 HDA_AMP_MUTE, bits);
16347 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16348 HDA_AMP_MUTE, bits);
16351 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16354 if ((res >> 26) == ALC880_HP_EVENT)
16355 alc662_lenovo_101e_all_automute(codec);
16356 if ((res >> 26) == ALC880_FRONT_EVENT)
16357 alc662_lenovo_101e_ispeaker_automute(codec);
16360 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16362 unsigned int present;
16364 present = snd_hda_codec_read(codec, 0x18, 0,
16365 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16366 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16367 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16368 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16369 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16370 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16371 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16372 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16373 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16376 /* unsolicited event for HP jack sensing */
16377 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16380 if ((res >> 26) == ALC880_MIC_EVENT)
16381 alc662_eeepc_mic_automute(codec);
16383 alc262_hippo_unsol_event(codec, res);
16386 static void alc662_eeepc_inithook(struct hda_codec *codec)
16388 alc262_hippo1_init_hook(codec);
16389 alc662_eeepc_mic_automute(codec);
16392 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16394 struct alc_spec *spec = codec->spec;
16396 spec->autocfg.hp_pins[0] = 0x14;
16397 spec->autocfg.speaker_pins[0] = 0x1b;
16398 alc262_hippo_master_update(codec);
16401 static void alc663_m51va_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);
16416 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16418 unsigned int present;
16419 unsigned char bits;
16421 present = snd_hda_codec_read(codec, 0x21, 0,
16422 AC_VERB_GET_PIN_SENSE, 0)
16423 & AC_PINSENSE_PRESENCE;
16424 bits = present ? HDA_AMP_MUTE : 0;
16425 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16426 AMP_IN_MUTE(0), bits);
16427 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16428 AMP_IN_MUTE(0), bits);
16429 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16430 AMP_IN_MUTE(0), bits);
16431 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16432 AMP_IN_MUTE(0), bits);
16435 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16437 unsigned int present;
16438 unsigned char bits;
16440 present = snd_hda_codec_read(codec, 0x15, 0,
16441 AC_VERB_GET_PIN_SENSE, 0)
16442 & AC_PINSENSE_PRESENCE;
16443 bits = present ? HDA_AMP_MUTE : 0;
16444 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16445 AMP_IN_MUTE(0), bits);
16446 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16447 AMP_IN_MUTE(0), bits);
16448 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16449 AMP_IN_MUTE(0), bits);
16450 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16451 AMP_IN_MUTE(0), bits);
16454 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16456 unsigned int present;
16457 unsigned char bits;
16459 present = snd_hda_codec_read(codec, 0x1b, 0,
16460 AC_VERB_GET_PIN_SENSE, 0)
16461 & AC_PINSENSE_PRESENCE;
16462 bits = present ? 0 : PIN_OUT;
16463 snd_hda_codec_write(codec, 0x14, 0,
16464 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16467 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16469 unsigned int present1, present2;
16471 present1 = snd_hda_codec_read(codec, 0x21, 0,
16472 AC_VERB_GET_PIN_SENSE, 0)
16473 & AC_PINSENSE_PRESENCE;
16474 present2 = snd_hda_codec_read(codec, 0x15, 0,
16475 AC_VERB_GET_PIN_SENSE, 0)
16476 & AC_PINSENSE_PRESENCE;
16478 if (present1 || present2) {
16479 snd_hda_codec_write_cache(codec, 0x14, 0,
16480 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16482 snd_hda_codec_write_cache(codec, 0x14, 0,
16483 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16487 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16489 unsigned int present1, present2;
16491 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16492 AC_VERB_GET_PIN_SENSE, 0)
16493 & AC_PINSENSE_PRESENCE;
16494 present2 = snd_hda_codec_read(codec, 0x15, 0,
16495 AC_VERB_GET_PIN_SENSE, 0)
16496 & AC_PINSENSE_PRESENCE;
16498 if (present1 || present2) {
16499 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16500 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16501 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16502 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16504 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16505 AMP_IN_MUTE(0), 0);
16506 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16507 AMP_IN_MUTE(0), 0);
16511 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16513 unsigned int present;
16515 present = snd_hda_codec_read(codec, 0x18, 0,
16516 AC_VERB_GET_PIN_SENSE, 0)
16517 & AC_PINSENSE_PRESENCE;
16518 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16519 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16520 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16521 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16522 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16523 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16524 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16525 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16528 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16531 switch (res >> 26) {
16532 case ALC880_HP_EVENT:
16533 alc663_m51va_speaker_automute(codec);
16535 case ALC880_MIC_EVENT:
16536 alc663_m51va_mic_automute(codec);
16541 static void alc663_m51va_inithook(struct hda_codec *codec)
16543 alc663_m51va_speaker_automute(codec);
16544 alc663_m51va_mic_automute(codec);
16547 /* ***************** Mode1 ******************************/
16548 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16551 switch (res >> 26) {
16552 case ALC880_HP_EVENT:
16553 alc663_m51va_speaker_automute(codec);
16555 case ALC880_MIC_EVENT:
16556 alc662_eeepc_mic_automute(codec);
16561 static void alc663_mode1_inithook(struct hda_codec *codec)
16563 alc663_m51va_speaker_automute(codec);
16564 alc662_eeepc_mic_automute(codec);
16566 /* ***************** Mode2 ******************************/
16567 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16570 switch (res >> 26) {
16571 case ALC880_HP_EVENT:
16572 alc662_f5z_speaker_automute(codec);
16574 case ALC880_MIC_EVENT:
16575 alc662_eeepc_mic_automute(codec);
16580 static void alc662_mode2_inithook(struct hda_codec *codec)
16582 alc662_f5z_speaker_automute(codec);
16583 alc662_eeepc_mic_automute(codec);
16585 /* ***************** Mode3 ******************************/
16586 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16589 switch (res >> 26) {
16590 case ALC880_HP_EVENT:
16591 alc663_two_hp_m1_speaker_automute(codec);
16593 case ALC880_MIC_EVENT:
16594 alc662_eeepc_mic_automute(codec);
16599 static void alc663_mode3_inithook(struct hda_codec *codec)
16601 alc663_two_hp_m1_speaker_automute(codec);
16602 alc662_eeepc_mic_automute(codec);
16604 /* ***************** Mode4 ******************************/
16605 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16608 switch (res >> 26) {
16609 case ALC880_HP_EVENT:
16610 alc663_21jd_two_speaker_automute(codec);
16612 case ALC880_MIC_EVENT:
16613 alc662_eeepc_mic_automute(codec);
16618 static void alc663_mode4_inithook(struct hda_codec *codec)
16620 alc663_21jd_two_speaker_automute(codec);
16621 alc662_eeepc_mic_automute(codec);
16623 /* ***************** Mode5 ******************************/
16624 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16627 switch (res >> 26) {
16628 case ALC880_HP_EVENT:
16629 alc663_15jd_two_speaker_automute(codec);
16631 case ALC880_MIC_EVENT:
16632 alc662_eeepc_mic_automute(codec);
16637 static void alc663_mode5_inithook(struct hda_codec *codec)
16639 alc663_15jd_two_speaker_automute(codec);
16640 alc662_eeepc_mic_automute(codec);
16642 /* ***************** Mode6 ******************************/
16643 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16646 switch (res >> 26) {
16647 case ALC880_HP_EVENT:
16648 alc663_two_hp_m2_speaker_automute(codec);
16650 case ALC880_MIC_EVENT:
16651 alc662_eeepc_mic_automute(codec);
16656 static void alc663_mode6_inithook(struct hda_codec *codec)
16658 alc663_two_hp_m2_speaker_automute(codec);
16659 alc662_eeepc_mic_automute(codec);
16662 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16664 unsigned int present;
16665 unsigned char bits;
16667 present = snd_hda_codec_read(codec, 0x21, 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, 0x15, HDA_OUTPUT, 0,
16672 HDA_AMP_MUTE, bits);
16673 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16674 HDA_AMP_MUTE, bits);
16677 static void alc663_g71v_front_automute(struct hda_codec *codec)
16679 unsigned int present;
16680 unsigned char bits;
16682 present = snd_hda_codec_read(codec, 0x15, 0,
16683 AC_VERB_GET_PIN_SENSE, 0)
16684 & AC_PINSENSE_PRESENCE;
16685 bits = present ? HDA_AMP_MUTE : 0;
16686 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16687 HDA_AMP_MUTE, bits);
16690 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16693 switch (res >> 26) {
16694 case ALC880_HP_EVENT:
16695 alc663_g71v_hp_automute(codec);
16697 case ALC880_FRONT_EVENT:
16698 alc663_g71v_front_automute(codec);
16700 case ALC880_MIC_EVENT:
16701 alc662_eeepc_mic_automute(codec);
16706 static void alc663_g71v_inithook(struct hda_codec *codec)
16708 alc663_g71v_front_automute(codec);
16709 alc663_g71v_hp_automute(codec);
16710 alc662_eeepc_mic_automute(codec);
16713 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16716 switch (res >> 26) {
16717 case ALC880_HP_EVENT:
16718 alc663_m51va_speaker_automute(codec);
16720 case ALC880_MIC_EVENT:
16721 alc662_eeepc_mic_automute(codec);
16726 static void alc663_g50v_inithook(struct hda_codec *codec)
16728 alc663_m51va_speaker_automute(codec);
16729 alc662_eeepc_mic_automute(codec);
16732 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16733 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16734 ALC262_HIPPO_MASTER_SWITCH,
16736 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16737 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16738 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16740 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16741 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16742 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16746 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16747 /* Master Playback automatically created from Speaker and Headphone */
16748 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16749 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16750 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16753 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16754 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16755 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16757 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16758 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16759 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16763 #ifdef CONFIG_SND_HDA_POWER_SAVE
16764 #define alc662_loopbacks alc880_loopbacks
16768 /* pcm configuration: identical with ALC880 */
16769 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16770 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16771 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16772 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16775 * configuration and preset
16777 static const char *alc662_models[ALC662_MODEL_LAST] = {
16778 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16779 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16780 [ALC662_3ST_6ch] = "3stack-6ch",
16781 [ALC662_5ST_DIG] = "6stack-dig",
16782 [ALC662_LENOVO_101E] = "lenovo-101e",
16783 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16784 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16785 [ALC662_ECS] = "ecs",
16786 [ALC663_ASUS_M51VA] = "m51va",
16787 [ALC663_ASUS_G71V] = "g71v",
16788 [ALC663_ASUS_H13] = "h13",
16789 [ALC663_ASUS_G50V] = "g50v",
16790 [ALC663_ASUS_MODE1] = "asus-mode1",
16791 [ALC662_ASUS_MODE2] = "asus-mode2",
16792 [ALC663_ASUS_MODE3] = "asus-mode3",
16793 [ALC663_ASUS_MODE4] = "asus-mode4",
16794 [ALC663_ASUS_MODE5] = "asus-mode5",
16795 [ALC663_ASUS_MODE6] = "asus-mode6",
16796 [ALC272_DELL] = "dell",
16797 [ALC272_DELL_ZM1] = "dell-zm1",
16798 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16799 [ALC662_AUTO] = "auto",
16802 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16803 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16804 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16805 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16806 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16807 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16808 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16809 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16810 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16811 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16812 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16813 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16814 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16815 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16816 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16817 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16818 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16819 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16820 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16821 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16822 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16823 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16824 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16825 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16826 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16827 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16828 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16829 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16830 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16831 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16832 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16833 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16834 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16835 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16836 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16837 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16838 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16839 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16840 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16841 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16842 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16843 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16844 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16845 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16846 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16847 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16848 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16849 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16850 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16851 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16852 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16853 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16854 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16855 ALC662_3ST_6ch_DIG),
16856 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16857 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16858 ALC662_3ST_6ch_DIG),
16859 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16860 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16861 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16862 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16863 ALC662_3ST_6ch_DIG),
16864 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16869 static struct alc_config_preset alc662_presets[] = {
16870 [ALC662_3ST_2ch_DIG] = {
16871 .mixers = { alc662_3ST_2ch_mixer },
16872 .init_verbs = { alc662_init_verbs },
16873 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16874 .dac_nids = alc662_dac_nids,
16875 .dig_out_nid = ALC662_DIGOUT_NID,
16876 .dig_in_nid = ALC662_DIGIN_NID,
16877 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16878 .channel_mode = alc662_3ST_2ch_modes,
16879 .input_mux = &alc662_capture_source,
16881 [ALC662_3ST_6ch_DIG] = {
16882 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16883 .init_verbs = { alc662_init_verbs },
16884 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16885 .dac_nids = alc662_dac_nids,
16886 .dig_out_nid = ALC662_DIGOUT_NID,
16887 .dig_in_nid = ALC662_DIGIN_NID,
16888 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16889 .channel_mode = alc662_3ST_6ch_modes,
16891 .input_mux = &alc662_capture_source,
16893 [ALC662_3ST_6ch] = {
16894 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16895 .init_verbs = { alc662_init_verbs },
16896 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16897 .dac_nids = alc662_dac_nids,
16898 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16899 .channel_mode = alc662_3ST_6ch_modes,
16901 .input_mux = &alc662_capture_source,
16903 [ALC662_5ST_DIG] = {
16904 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16905 .init_verbs = { alc662_init_verbs },
16906 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16907 .dac_nids = alc662_dac_nids,
16908 .dig_out_nid = ALC662_DIGOUT_NID,
16909 .dig_in_nid = ALC662_DIGIN_NID,
16910 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16911 .channel_mode = alc662_5stack_modes,
16912 .input_mux = &alc662_capture_source,
16914 [ALC662_LENOVO_101E] = {
16915 .mixers = { alc662_lenovo_101e_mixer },
16916 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16917 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16918 .dac_nids = alc662_dac_nids,
16919 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16920 .channel_mode = alc662_3ST_2ch_modes,
16921 .input_mux = &alc662_lenovo_101e_capture_source,
16922 .unsol_event = alc662_lenovo_101e_unsol_event,
16923 .init_hook = alc662_lenovo_101e_all_automute,
16925 [ALC662_ASUS_EEEPC_P701] = {
16926 .mixers = { alc662_eeepc_p701_mixer },
16927 .init_verbs = { alc662_init_verbs,
16928 alc662_eeepc_sue_init_verbs },
16929 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16930 .dac_nids = alc662_dac_nids,
16931 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16932 .channel_mode = alc662_3ST_2ch_modes,
16933 .input_mux = &alc662_eeepc_capture_source,
16934 .unsol_event = alc662_eeepc_unsol_event,
16935 .init_hook = alc662_eeepc_inithook,
16937 [ALC662_ASUS_EEEPC_EP20] = {
16938 .mixers = { alc662_eeepc_ep20_mixer,
16939 alc662_chmode_mixer },
16940 .init_verbs = { alc662_init_verbs,
16941 alc662_eeepc_ep20_sue_init_verbs },
16942 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16943 .dac_nids = alc662_dac_nids,
16944 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16945 .channel_mode = alc662_3ST_6ch_modes,
16946 .input_mux = &alc662_lenovo_101e_capture_source,
16947 .unsol_event = alc662_eeepc_unsol_event,
16948 .init_hook = alc662_eeepc_ep20_inithook,
16951 .mixers = { alc662_ecs_mixer },
16952 .init_verbs = { alc662_init_verbs,
16953 alc662_ecs_init_verbs },
16954 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16955 .dac_nids = alc662_dac_nids,
16956 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16957 .channel_mode = alc662_3ST_2ch_modes,
16958 .input_mux = &alc662_eeepc_capture_source,
16959 .unsol_event = alc662_eeepc_unsol_event,
16960 .init_hook = alc662_eeepc_inithook,
16962 [ALC663_ASUS_M51VA] = {
16963 .mixers = { alc663_m51va_mixer },
16964 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16965 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16966 .dac_nids = alc662_dac_nids,
16967 .dig_out_nid = ALC662_DIGOUT_NID,
16968 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16969 .channel_mode = alc662_3ST_2ch_modes,
16970 .input_mux = &alc663_m51va_capture_source,
16971 .unsol_event = alc663_m51va_unsol_event,
16972 .init_hook = alc663_m51va_inithook,
16974 [ALC663_ASUS_G71V] = {
16975 .mixers = { alc663_g71v_mixer },
16976 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16977 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16978 .dac_nids = alc662_dac_nids,
16979 .dig_out_nid = ALC662_DIGOUT_NID,
16980 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16981 .channel_mode = alc662_3ST_2ch_modes,
16982 .input_mux = &alc662_eeepc_capture_source,
16983 .unsol_event = alc663_g71v_unsol_event,
16984 .init_hook = alc663_g71v_inithook,
16986 [ALC663_ASUS_H13] = {
16987 .mixers = { alc663_m51va_mixer },
16988 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16989 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16990 .dac_nids = alc662_dac_nids,
16991 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16992 .channel_mode = alc662_3ST_2ch_modes,
16993 .input_mux = &alc663_m51va_capture_source,
16994 .unsol_event = alc663_m51va_unsol_event,
16995 .init_hook = alc663_m51va_inithook,
16997 [ALC663_ASUS_G50V] = {
16998 .mixers = { alc663_g50v_mixer },
16999 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17000 .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_6ch_modes),
17004 .channel_mode = alc662_3ST_6ch_modes,
17005 .input_mux = &alc663_capture_source,
17006 .unsol_event = alc663_g50v_unsol_event,
17007 .init_hook = alc663_g50v_inithook,
17009 [ALC663_ASUS_MODE1] = {
17010 .mixers = { alc663_m51va_mixer },
17011 .cap_mixer = alc662_auto_capture_mixer,
17012 .init_verbs = { alc662_init_verbs,
17013 alc663_21jd_amic_init_verbs },
17014 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17016 .dac_nids = alc662_dac_nids,
17017 .dig_out_nid = ALC662_DIGOUT_NID,
17018 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17019 .channel_mode = alc662_3ST_2ch_modes,
17020 .input_mux = &alc662_eeepc_capture_source,
17021 .unsol_event = alc663_mode1_unsol_event,
17022 .init_hook = alc663_mode1_inithook,
17024 [ALC662_ASUS_MODE2] = {
17025 .mixers = { alc662_1bjd_mixer },
17026 .cap_mixer = alc662_auto_capture_mixer,
17027 .init_verbs = { alc662_init_verbs,
17028 alc662_1bjd_amic_init_verbs },
17029 .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 = alc662_mode2_unsol_event,
17036 .init_hook = alc662_mode2_inithook,
17038 [ALC663_ASUS_MODE3] = {
17039 .mixers = { alc663_two_hp_m1_mixer },
17040 .cap_mixer = alc662_auto_capture_mixer,
17041 .init_verbs = { alc662_init_verbs,
17042 alc663_two_hp_amic_m1_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_mode3_unsol_event,
17051 .init_hook = alc663_mode3_inithook,
17053 [ALC663_ASUS_MODE4] = {
17054 .mixers = { alc663_asus_21jd_clfe_mixer },
17055 .cap_mixer = alc662_auto_capture_mixer,
17056 .init_verbs = { alc662_init_verbs,
17057 alc663_21jd_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_mode4_unsol_event,
17066 .init_hook = alc663_mode4_inithook,
17068 [ALC663_ASUS_MODE5] = {
17069 .mixers = { alc663_asus_15jd_clfe_mixer },
17070 .cap_mixer = alc662_auto_capture_mixer,
17071 .init_verbs = { alc662_init_verbs,
17072 alc663_15jd_amic_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_mode5_unsol_event,
17081 .init_hook = alc663_mode5_inithook,
17083 [ALC663_ASUS_MODE6] = {
17084 .mixers = { alc663_two_hp_m2_mixer },
17085 .cap_mixer = alc662_auto_capture_mixer,
17086 .init_verbs = { alc662_init_verbs,
17087 alc663_two_hp_amic_m2_init_verbs },
17088 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17090 .dac_nids = alc662_dac_nids,
17091 .dig_out_nid = ALC662_DIGOUT_NID,
17092 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17093 .channel_mode = alc662_3ST_2ch_modes,
17094 .input_mux = &alc662_eeepc_capture_source,
17095 .unsol_event = alc663_mode6_unsol_event,
17096 .init_hook = alc663_mode6_inithook,
17099 .mixers = { alc663_m51va_mixer },
17100 .cap_mixer = alc272_auto_capture_mixer,
17101 .init_verbs = { alc662_init_verbs, alc272_dell_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 = alc272_adc_nids,
17106 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17107 .capsrc_nids = alc272_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_DELL_ZM1] = {
17114 .mixers = { alc663_m51va_mixer },
17115 .cap_mixer = alc662_auto_capture_mixer,
17116 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17117 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17118 .dac_nids = alc662_dac_nids,
17119 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17120 .adc_nids = alc662_adc_nids,
17121 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
17122 .capsrc_nids = alc662_capsrc_nids,
17123 .channel_mode = alc662_3ST_2ch_modes,
17124 .input_mux = &alc663_m51va_capture_source,
17125 .unsol_event = alc663_m51va_unsol_event,
17126 .init_hook = alc663_m51va_inithook,
17128 [ALC272_SAMSUNG_NC10] = {
17129 .mixers = { alc272_nc10_mixer },
17130 .init_verbs = { alc662_init_verbs,
17131 alc663_21jd_amic_init_verbs },
17132 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17133 .dac_nids = alc272_dac_nids,
17134 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17135 .channel_mode = alc662_3ST_2ch_modes,
17136 .input_mux = &alc272_nc10_capture_source,
17137 .unsol_event = alc663_mode4_unsol_event,
17138 .init_hook = alc663_mode4_inithook,
17144 * BIOS auto configuration
17147 /* add playback controls from the parsed DAC table */
17148 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17149 const struct auto_pin_cfg *cfg)
17152 static const char *chname[4] = {
17153 "Front", "Surround", NULL /*CLFE*/, "Side"
17158 for (i = 0; i < cfg->line_outs; i++) {
17159 if (!spec->multiout.dac_nids[i])
17161 nid = alc880_idx_to_dac(i);
17164 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17165 "Center Playback Volume",
17166 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17170 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17171 "LFE Playback Volume",
17172 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17176 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17177 "Center Playback Switch",
17178 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17182 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17183 "LFE Playback Switch",
17184 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17189 sprintf(name, "%s Playback Volume", chname[i]);
17190 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17191 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17195 sprintf(name, "%s Playback Switch", chname[i]);
17196 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17197 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17206 /* add playback controls for speaker and HP outputs */
17207 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17218 /* ALC663 has a mono output pin on 0x17 */
17219 sprintf(name, "%s Playback Switch", pfx);
17220 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17221 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17225 if (alc880_is_fixed_pin(pin)) {
17226 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17227 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17228 /* specify the DAC as the extra output */
17229 if (!spec->multiout.hp_nid)
17230 spec->multiout.hp_nid = nid;
17232 spec->multiout.extra_out_nid[0] = nid;
17233 /* control HP volume/switch on the output mixer amp */
17234 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17235 sprintf(name, "%s Playback Volume", pfx);
17236 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17237 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17240 sprintf(name, "%s Playback Switch", pfx);
17241 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17242 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17245 } else if (alc880_is_multi_pin(pin)) {
17246 /* set manual connection */
17247 /* we have only a switch on HP-out PIN */
17248 sprintf(name, "%s Playback Switch", pfx);
17249 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17250 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17257 /* return the index of the src widget from the connection list of the nid.
17258 * return -1 if not found
17260 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
17263 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
17266 conns = snd_hda_get_connections(codec, nid, conn_list,
17267 ARRAY_SIZE(conn_list));
17270 for (i = 0; i < conns; i++)
17271 if (conn_list[i] == src)
17276 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17278 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17279 return (pincap & AC_PINCAP_IN) != 0;
17282 /* create playback/capture controls for input pins */
17283 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17284 const struct auto_pin_cfg *cfg)
17286 struct alc_spec *spec = codec->spec;
17287 struct hda_input_mux *imux = &spec->private_imux[0];
17290 for (i = 0; i < AUTO_PIN_LAST; i++) {
17291 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17292 idx = alc662_input_pin_idx(codec, 0x0b,
17293 cfg->input_pins[i]);
17295 err = new_analog_input(spec, cfg->input_pins[i],
17296 auto_pin_cfg_labels[i],
17301 idx = alc662_input_pin_idx(codec, 0x22,
17302 cfg->input_pins[i]);
17304 imux->items[imux->num_items].label =
17305 auto_pin_cfg_labels[i];
17306 imux->items[imux->num_items].index = idx;
17314 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17315 hda_nid_t nid, int pin_type,
17318 alc_set_pin_output(codec, nid, pin_type);
17319 /* need the manual connection? */
17320 if (alc880_is_multi_pin(nid)) {
17321 struct alc_spec *spec = codec->spec;
17322 int idx = alc880_multi_pin_idx(nid);
17323 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17324 AC_VERB_SET_CONNECT_SEL,
17325 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17329 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17331 struct alc_spec *spec = codec->spec;
17334 for (i = 0; i <= HDA_SIDE; i++) {
17335 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17336 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17338 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17343 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17345 struct alc_spec *spec = codec->spec;
17348 pin = spec->autocfg.hp_pins[0];
17349 if (pin) /* connect to front */
17351 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17352 pin = spec->autocfg.speaker_pins[0];
17354 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17357 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17359 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17361 struct alc_spec *spec = codec->spec;
17364 for (i = 0; i < AUTO_PIN_LAST; i++) {
17365 hda_nid_t nid = spec->autocfg.input_pins[i];
17366 if (alc662_is_input_pin(codec, nid)) {
17367 alc_set_input_pin(codec, nid, i);
17368 if (nid != ALC662_PIN_CD_NID &&
17369 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17370 snd_hda_codec_write(codec, nid, 0,
17371 AC_VERB_SET_AMP_GAIN_MUTE,
17377 #define alc662_auto_init_input_src alc882_auto_init_input_src
17379 static int alc662_parse_auto_config(struct hda_codec *codec)
17381 struct alc_spec *spec = codec->spec;
17383 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17385 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17389 if (!spec->autocfg.line_outs)
17390 return 0; /* can't find valid BIOS pin config */
17392 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17395 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17398 err = alc662_auto_create_extra_out(spec,
17399 spec->autocfg.speaker_pins[0],
17403 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17407 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17411 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17413 if (spec->autocfg.dig_outs)
17414 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17416 if (spec->kctls.list)
17417 add_mixer(spec, spec->kctls.list);
17419 spec->num_mux_defs = 1;
17420 spec->input_mux = &spec->private_imux[0];
17422 add_verb(spec, alc662_auto_init_verbs);
17423 if (codec->vendor_id == 0x10ec0663)
17424 add_verb(spec, alc663_auto_init_verbs);
17426 err = alc_auto_add_mic_boost(codec);
17430 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17435 /* additional initialization for auto-configuration model */
17436 static void alc662_auto_init(struct hda_codec *codec)
17438 struct alc_spec *spec = codec->spec;
17439 alc662_auto_init_multi_out(codec);
17440 alc662_auto_init_hp_out(codec);
17441 alc662_auto_init_analog_input(codec);
17442 alc662_auto_init_input_src(codec);
17443 if (spec->unsol_event)
17444 alc_inithook(codec);
17447 static int patch_alc662(struct hda_codec *codec)
17449 struct alc_spec *spec;
17450 int err, board_config;
17452 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17456 codec->spec = spec;
17458 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17460 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17463 if (board_config < 0) {
17464 printk(KERN_INFO "hda_codec: Unknown model for %s, "
17465 "trying auto-probe from BIOS...\n", codec->chip_name);
17466 board_config = ALC662_AUTO;
17469 if (board_config == ALC662_AUTO) {
17470 /* automatic parse from the BIOS config */
17471 err = alc662_parse_auto_config(codec);
17477 "hda_codec: Cannot set up configuration "
17478 "from BIOS. Using base mode...\n");
17479 board_config = ALC662_3ST_2ch_DIG;
17483 err = snd_hda_attach_beep_device(codec, 0x1);
17489 if (board_config != ALC662_AUTO)
17490 setup_preset(spec, &alc662_presets[board_config]);
17492 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17493 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17495 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17496 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17498 spec->adc_nids = alc662_adc_nids;
17499 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17500 spec->capsrc_nids = alc662_capsrc_nids;
17502 if (!spec->cap_mixer)
17503 set_capture_mixer(spec);
17504 if (codec->vendor_id == 0x10ec0662)
17505 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17507 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17509 spec->vmaster_nid = 0x02;
17511 codec->patch_ops = alc_patch_ops;
17512 if (board_config == ALC662_AUTO)
17513 spec->init_hook = alc662_auto_init;
17514 #ifdef CONFIG_SND_HDA_POWER_SAVE
17515 if (!spec->loopback.amplist)
17516 spec->loopback.amplist = alc662_loopbacks;
17518 codec->proc_widget_hook = print_realtek_coef;
17526 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17527 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17528 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17529 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17530 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17531 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17532 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17533 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17534 .patch = patch_alc861 },
17535 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17536 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17537 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17538 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17539 .patch = patch_alc883 },
17540 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17541 .patch = patch_alc662 },
17542 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17543 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17544 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17545 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17546 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17547 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17548 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17549 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17550 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17551 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17552 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17553 .patch = patch_alc883 },
17554 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17555 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17556 {} /* terminator */
17559 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17561 MODULE_LICENSE("GPL");
17562 MODULE_DESCRIPTION("Realtek HD-audio codec");
17564 static struct hda_codec_preset_list realtek_list = {
17565 .preset = snd_hda_preset_realtek,
17566 .owner = THIS_MODULE,
17569 static int __init patch_realtek_init(void)
17571 return snd_hda_add_codec_preset(&realtek_list);
17574 static void __exit patch_realtek_exit(void)
17576 snd_hda_delete_codec_preset(&realtek_list);
17579 module_init(patch_realtek_init)
17580 module_exit(patch_realtek_exit)