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,
218 ALC883_TARGA_2ch_DIG,
221 ALC888_ACER_ASPIRE_4930G,
225 ALC883_LENOVO_101E_2ch,
226 ALC883_LENOVO_NB0763,
227 ALC888_LENOVO_MS7195_DIG,
234 ALC883_FUJITSU_PI2515,
235 ALC888_FUJITSU_XA3530,
236 ALC883_3ST_6ch_INTEL,
244 /* styles of capture selection */
246 CAPT_MUX = 0, /* only mux based */
247 CAPT_MIX, /* only mixer based */
248 CAPT_1MUX_MIX, /* first mux and other mixers */
252 #define GPIO_MASK 0x03
255 /* codec parameterization */
256 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
257 unsigned int num_mixers;
258 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
259 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
261 const struct hda_verb *init_verbs[5]; /* initialization verbs
265 unsigned int num_init_verbs;
267 char *stream_name_analog; /* analog PCM stream */
268 struct hda_pcm_stream *stream_analog_playback;
269 struct hda_pcm_stream *stream_analog_capture;
270 struct hda_pcm_stream *stream_analog_alt_playback;
271 struct hda_pcm_stream *stream_analog_alt_capture;
273 char *stream_name_digital; /* digital PCM stream */
274 struct hda_pcm_stream *stream_digital_playback;
275 struct hda_pcm_stream *stream_digital_capture;
278 struct hda_multi_out multiout; /* playback set-up
279 * max_channels, dacs must be set
280 * dig_out_nid and hp_nid are optional
282 hda_nid_t alt_dac_nid;
283 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
287 unsigned int num_adc_nids;
289 hda_nid_t *capsrc_nids;
290 hda_nid_t dig_in_nid; /* digital-in NID; optional */
291 int capture_style; /* capture style (CAPT_*) */
294 unsigned int num_mux_defs;
295 const struct hda_input_mux *input_mux;
296 unsigned int cur_mux[3];
299 const struct hda_channel_mode *channel_mode;
300 int num_channel_mode;
303 /* PCM information */
304 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
306 /* dynamic controls, init_verbs and input_mux */
307 struct auto_pin_cfg autocfg;
308 struct snd_array kctls;
309 struct hda_input_mux private_imux[3];
310 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
313 void (*init_hook)(struct hda_codec *codec);
314 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
316 /* for pin sensing */
317 unsigned int sense_updated: 1;
318 unsigned int jack_present: 1;
319 unsigned int master_sw: 1;
322 unsigned int no_analog :1; /* digital I/O only */
324 /* for virtual master */
325 hda_nid_t vmaster_nid;
326 #ifdef CONFIG_SND_HDA_POWER_SAVE
327 struct hda_loopback_check loopback;
332 unsigned int pll_coef_idx, pll_coef_bit;
334 #ifdef SND_HDA_NEEDS_RESUME
335 #define ALC_MAX_PINS 16
336 unsigned int num_pins;
337 hda_nid_t pin_nids[ALC_MAX_PINS];
338 unsigned int pin_cfgs[ALC_MAX_PINS];
343 * configuration template - to be copied to the spec instance
345 struct alc_config_preset {
346 struct snd_kcontrol_new *mixers[5]; /* should be identical size
349 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
350 const struct hda_verb *init_verbs[5];
351 unsigned int num_dacs;
353 hda_nid_t dig_out_nid; /* optional */
354 hda_nid_t hp_nid; /* optional */
355 hda_nid_t *slave_dig_outs;
356 unsigned int num_adc_nids;
358 hda_nid_t *capsrc_nids;
359 hda_nid_t dig_in_nid;
360 unsigned int num_channel_mode;
361 const struct hda_channel_mode *channel_mode;
363 unsigned int num_mux_defs;
364 const struct hda_input_mux *input_mux;
365 void (*unsol_event)(struct hda_codec *, unsigned int);
366 void (*init_hook)(struct hda_codec *);
367 #ifdef CONFIG_SND_HDA_POWER_SAVE
368 struct hda_amp_list *loopbacks;
376 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
377 struct snd_ctl_elem_info *uinfo)
379 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
380 struct alc_spec *spec = codec->spec;
381 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
382 if (mux_idx >= spec->num_mux_defs)
384 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
387 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
388 struct snd_ctl_elem_value *ucontrol)
390 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
391 struct alc_spec *spec = codec->spec;
392 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
394 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
398 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
399 struct snd_ctl_elem_value *ucontrol)
401 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
402 struct alc_spec *spec = codec->spec;
403 const struct hda_input_mux *imux;
404 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
405 unsigned int mux_idx;
406 hda_nid_t nid = spec->capsrc_nids ?
407 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
409 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
410 imux = &spec->input_mux[mux_idx];
412 if (spec->capture_style &&
413 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
414 /* Matrix-mixer style (e.g. ALC882) */
415 unsigned int *cur_val = &spec->cur_mux[adc_idx];
418 idx = ucontrol->value.enumerated.item[0];
419 if (idx >= imux->num_items)
420 idx = imux->num_items - 1;
423 for (i = 0; i < imux->num_items; i++) {
424 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
425 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
426 imux->items[i].index,
432 /* MUX style (e.g. ALC880) */
433 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
434 &spec->cur_mux[adc_idx]);
439 * channel mode setting
441 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
442 struct snd_ctl_elem_info *uinfo)
444 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
445 struct alc_spec *spec = codec->spec;
446 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
447 spec->num_channel_mode);
450 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
451 struct snd_ctl_elem_value *ucontrol)
453 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
454 struct alc_spec *spec = codec->spec;
455 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
456 spec->num_channel_mode,
457 spec->multiout.max_channels);
460 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
461 struct snd_ctl_elem_value *ucontrol)
463 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
464 struct alc_spec *spec = codec->spec;
465 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
466 spec->num_channel_mode,
467 &spec->multiout.max_channels);
468 if (err >= 0 && spec->need_dac_fix)
469 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
474 * Control the mode of pin widget settings via the mixer. "pc" is used
475 * instead of "%" to avoid consequences of accidently treating the % as
476 * being part of a format specifier. Maximum allowed length of a value is
477 * 63 characters plus NULL terminator.
479 * Note: some retasking pin complexes seem to ignore requests for input
480 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
481 * are requested. Therefore order this list so that this behaviour will not
482 * cause problems when mixer clients move through the enum sequentially.
483 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
486 static char *alc_pin_mode_names[] = {
487 "Mic 50pc bias", "Mic 80pc bias",
488 "Line in", "Line out", "Headphone out",
490 static unsigned char alc_pin_mode_values[] = {
491 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
493 /* The control can present all 5 options, or it can limit the options based
494 * in the pin being assumed to be exclusively an input or an output pin. In
495 * addition, "input" pins may or may not process the mic bias option
496 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
497 * accept requests for bias as of chip versions up to March 2006) and/or
498 * wiring in the computer.
500 #define ALC_PIN_DIR_IN 0x00
501 #define ALC_PIN_DIR_OUT 0x01
502 #define ALC_PIN_DIR_INOUT 0x02
503 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
504 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
506 /* Info about the pin modes supported by the different pin direction modes.
507 * For each direction the minimum and maximum values are given.
509 static signed char alc_pin_mode_dir_info[5][2] = {
510 { 0, 2 }, /* ALC_PIN_DIR_IN */
511 { 3, 4 }, /* ALC_PIN_DIR_OUT */
512 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
513 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
514 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
516 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
517 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
518 #define alc_pin_mode_n_items(_dir) \
519 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
521 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
522 struct snd_ctl_elem_info *uinfo)
524 unsigned int item_num = uinfo->value.enumerated.item;
525 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
527 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
529 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
531 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
532 item_num = alc_pin_mode_min(dir);
533 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
537 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
538 struct snd_ctl_elem_value *ucontrol)
541 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
542 hda_nid_t nid = kcontrol->private_value & 0xffff;
543 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
544 long *valp = ucontrol->value.integer.value;
545 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
546 AC_VERB_GET_PIN_WIDGET_CONTROL,
549 /* Find enumerated value for current pinctl setting */
550 i = alc_pin_mode_min(dir);
551 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
553 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
557 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
558 struct snd_ctl_elem_value *ucontrol)
561 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
562 hda_nid_t nid = kcontrol->private_value & 0xffff;
563 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
564 long val = *ucontrol->value.integer.value;
565 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
566 AC_VERB_GET_PIN_WIDGET_CONTROL,
569 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
570 val = alc_pin_mode_min(dir);
572 change = pinctl != alc_pin_mode_values[val];
574 /* Set pin mode to that requested */
575 snd_hda_codec_write_cache(codec, nid, 0,
576 AC_VERB_SET_PIN_WIDGET_CONTROL,
577 alc_pin_mode_values[val]);
579 /* Also enable the retasking pin's input/output as required
580 * for the requested pin mode. Enum values of 2 or less are
583 * Dynamically switching the input/output buffers probably
584 * reduces noise slightly (particularly on input) so we'll
585 * do it. However, having both input and output buffers
586 * enabled simultaneously doesn't seem to be problematic if
587 * this turns out to be necessary in the future.
590 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
591 HDA_AMP_MUTE, HDA_AMP_MUTE);
592 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
595 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
596 HDA_AMP_MUTE, HDA_AMP_MUTE);
597 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
604 #define ALC_PIN_MODE(xname, nid, dir) \
605 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
606 .info = alc_pin_mode_info, \
607 .get = alc_pin_mode_get, \
608 .put = alc_pin_mode_put, \
609 .private_value = nid | (dir<<16) }
611 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
612 * together using a mask with more than one bit set. This control is
613 * currently used only by the ALC260 test model. At this stage they are not
614 * needed for any "production" models.
616 #ifdef CONFIG_SND_DEBUG
617 #define alc_gpio_data_info snd_ctl_boolean_mono_info
619 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
620 struct snd_ctl_elem_value *ucontrol)
622 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
623 hda_nid_t nid = kcontrol->private_value & 0xffff;
624 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
625 long *valp = ucontrol->value.integer.value;
626 unsigned int val = snd_hda_codec_read(codec, nid, 0,
627 AC_VERB_GET_GPIO_DATA, 0x00);
629 *valp = (val & mask) != 0;
632 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
633 struct snd_ctl_elem_value *ucontrol)
636 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
637 hda_nid_t nid = kcontrol->private_value & 0xffff;
638 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
639 long val = *ucontrol->value.integer.value;
640 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
641 AC_VERB_GET_GPIO_DATA,
644 /* Set/unset the masked GPIO bit(s) as needed */
645 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
650 snd_hda_codec_write_cache(codec, nid, 0,
651 AC_VERB_SET_GPIO_DATA, gpio_data);
655 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
656 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
657 .info = alc_gpio_data_info, \
658 .get = alc_gpio_data_get, \
659 .put = alc_gpio_data_put, \
660 .private_value = nid | (mask<<16) }
661 #endif /* CONFIG_SND_DEBUG */
663 /* A switch control to allow the enabling of the digital IO pins on the
664 * ALC260. This is incredibly simplistic; the intention of this control is
665 * to provide something in the test model allowing digital outputs to be
666 * identified if present. If models are found which can utilise these
667 * outputs a more complete mixer control can be devised for those models if
670 #ifdef CONFIG_SND_DEBUG
671 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
673 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
674 struct snd_ctl_elem_value *ucontrol)
676 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
677 hda_nid_t nid = kcontrol->private_value & 0xffff;
678 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
679 long *valp = ucontrol->value.integer.value;
680 unsigned int val = snd_hda_codec_read(codec, nid, 0,
681 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
683 *valp = (val & mask) != 0;
686 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
687 struct snd_ctl_elem_value *ucontrol)
690 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
691 hda_nid_t nid = kcontrol->private_value & 0xffff;
692 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
693 long val = *ucontrol->value.integer.value;
694 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
695 AC_VERB_GET_DIGI_CONVERT_1,
698 /* Set/unset the masked control bit(s) as needed */
699 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
704 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
709 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
710 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
711 .info = alc_spdif_ctrl_info, \
712 .get = alc_spdif_ctrl_get, \
713 .put = alc_spdif_ctrl_put, \
714 .private_value = nid | (mask<<16) }
715 #endif /* CONFIG_SND_DEBUG */
717 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
718 * Again, this is only used in the ALC26x test models to help identify when
719 * the EAPD line must be asserted for features to work.
721 #ifdef CONFIG_SND_DEBUG
722 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
724 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
725 struct snd_ctl_elem_value *ucontrol)
727 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
728 hda_nid_t nid = kcontrol->private_value & 0xffff;
729 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
730 long *valp = ucontrol->value.integer.value;
731 unsigned int val = snd_hda_codec_read(codec, nid, 0,
732 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
734 *valp = (val & mask) != 0;
738 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
739 struct snd_ctl_elem_value *ucontrol)
742 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
743 hda_nid_t nid = kcontrol->private_value & 0xffff;
744 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
745 long val = *ucontrol->value.integer.value;
746 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
747 AC_VERB_GET_EAPD_BTLENABLE,
750 /* Set/unset the masked control bit(s) as needed */
751 change = (!val ? 0 : mask) != (ctrl_data & mask);
756 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
762 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
763 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
764 .info = alc_eapd_ctrl_info, \
765 .get = alc_eapd_ctrl_get, \
766 .put = alc_eapd_ctrl_put, \
767 .private_value = nid | (mask<<16) }
768 #endif /* CONFIG_SND_DEBUG */
772 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
774 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
776 spec->mixers[spec->num_mixers++] = mix;
779 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
781 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
783 spec->init_verbs[spec->num_init_verbs++] = verb;
786 #ifdef CONFIG_PROC_FS
790 static void print_realtek_coef(struct snd_info_buffer *buffer,
791 struct hda_codec *codec, hda_nid_t nid)
797 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
798 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
799 coeff = snd_hda_codec_read(codec, nid, 0,
800 AC_VERB_GET_COEF_INDEX, 0);
801 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
804 #define print_realtek_coef NULL
808 * set up from the preset table
810 static void setup_preset(struct alc_spec *spec,
811 const struct alc_config_preset *preset)
815 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
816 add_mixer(spec, preset->mixers[i]);
817 spec->cap_mixer = preset->cap_mixer;
818 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
820 add_verb(spec, preset->init_verbs[i]);
822 spec->channel_mode = preset->channel_mode;
823 spec->num_channel_mode = preset->num_channel_mode;
824 spec->need_dac_fix = preset->need_dac_fix;
826 spec->multiout.max_channels = spec->channel_mode[0].channels;
828 spec->multiout.num_dacs = preset->num_dacs;
829 spec->multiout.dac_nids = preset->dac_nids;
830 spec->multiout.dig_out_nid = preset->dig_out_nid;
831 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
832 spec->multiout.hp_nid = preset->hp_nid;
834 spec->num_mux_defs = preset->num_mux_defs;
835 if (!spec->num_mux_defs)
836 spec->num_mux_defs = 1;
837 spec->input_mux = preset->input_mux;
839 spec->num_adc_nids = preset->num_adc_nids;
840 spec->adc_nids = preset->adc_nids;
841 spec->capsrc_nids = preset->capsrc_nids;
842 spec->dig_in_nid = preset->dig_in_nid;
844 spec->unsol_event = preset->unsol_event;
845 spec->init_hook = preset->init_hook;
846 #ifdef CONFIG_SND_HDA_POWER_SAVE
847 spec->loopback.amplist = preset->loopbacks;
851 /* Enable GPIO mask and set output */
852 static struct hda_verb alc_gpio1_init_verbs[] = {
853 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
854 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
855 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
859 static struct hda_verb alc_gpio2_init_verbs[] = {
860 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
861 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
862 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
866 static struct hda_verb alc_gpio3_init_verbs[] = {
867 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
868 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
869 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
874 * Fix hardware PLL issue
875 * On some codecs, the analog PLL gating control must be off while
876 * the default value is 1.
878 static void alc_fix_pll(struct hda_codec *codec)
880 struct alc_spec *spec = codec->spec;
885 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
887 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
888 AC_VERB_GET_PROC_COEF, 0);
889 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
891 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
892 val & ~(1 << spec->pll_coef_bit));
895 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
896 unsigned int coef_idx, unsigned int coef_bit)
898 struct alc_spec *spec = codec->spec;
900 spec->pll_coef_idx = coef_idx;
901 spec->pll_coef_bit = coef_bit;
905 static void alc_sku_automute(struct hda_codec *codec)
907 struct alc_spec *spec = codec->spec;
908 unsigned int present;
909 unsigned int hp_nid = spec->autocfg.hp_pins[0];
910 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
912 /* need to execute and sync at first */
913 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
914 present = snd_hda_codec_read(codec, hp_nid, 0,
915 AC_VERB_GET_PIN_SENSE, 0);
916 spec->jack_present = (present & 0x80000000) != 0;
917 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
918 spec->jack_present ? 0 : PIN_OUT);
921 #if 0 /* it's broken in some acses -- temporarily disabled */
922 static void alc_mic_automute(struct hda_codec *codec)
924 struct alc_spec *spec = codec->spec;
925 unsigned int present;
926 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
927 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
928 unsigned int mix_nid = spec->capsrc_nids[0];
929 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
931 capsrc_idx_mic = mic_nid - 0x18;
932 capsrc_idx_fmic = fmic_nid - 0x18;
933 present = snd_hda_codec_read(codec, mic_nid, 0,
934 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
935 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
936 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
937 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
938 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
939 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
940 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
943 #define alc_mic_automute(codec) do {} while(0) /* NOP */
944 #endif /* disabled */
946 /* unsolicited event for HP jack sensing */
947 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
949 if (codec->vendor_id == 0x10ec0880)
953 if (res == ALC880_HP_EVENT)
954 alc_sku_automute(codec);
956 if (res == ALC880_MIC_EVENT)
957 alc_mic_automute(codec);
960 static void alc_inithook(struct hda_codec *codec)
962 alc_sku_automute(codec);
963 alc_mic_automute(codec);
966 /* additional initialization for ALC888 variants */
967 static void alc888_coef_init(struct hda_codec *codec)
971 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
972 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
973 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
974 if ((tmp & 0xf0) == 2)
976 snd_hda_codec_read(codec, 0x20, 0,
977 AC_VERB_SET_PROC_COEF, 0x830);
980 snd_hda_codec_read(codec, 0x20, 0,
981 AC_VERB_SET_PROC_COEF, 0x3030);
984 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
985 * 31 ~ 16 : Manufacture ID
987 * 7 ~ 0 : Assembly ID
988 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
990 static void alc_subsystem_id(struct hda_codec *codec,
991 unsigned int porta, unsigned int porte,
994 unsigned int ass, tmp, i;
996 struct alc_spec *spec = codec->spec;
998 ass = codec->subsystem_id & 0xffff;
999 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1003 * 31~30 : port conetcivity
1006 * 19~16 : Check sum (15:1)
1011 if (codec->vendor_id == 0x10ec0260)
1013 ass = snd_hda_codec_read(codec, nid, 0,
1014 AC_VERB_GET_CONFIG_DEFAULT, 0);
1015 if (!(ass & 1) && !(ass & 0x100000))
1017 if ((ass >> 30) != 1) /* no physical connection */
1022 for (i = 1; i < 16; i++) {
1026 if (((ass >> 16) & 0xf) != tmp)
1032 * 2 : 0 --> Desktop, 1 --> Laptop
1033 * 3~5 : External Amplifier control
1036 tmp = (ass & 0x38) >> 3; /* external Amp control */
1039 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1042 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1045 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1047 case 5: /* set EAPD output high */
1048 switch (codec->vendor_id) {
1050 snd_hda_codec_write(codec, 0x0f, 0,
1051 AC_VERB_SET_EAPD_BTLENABLE, 2);
1052 snd_hda_codec_write(codec, 0x10, 0,
1053 AC_VERB_SET_EAPD_BTLENABLE, 2);
1065 snd_hda_codec_write(codec, 0x14, 0,
1066 AC_VERB_SET_EAPD_BTLENABLE, 2);
1067 snd_hda_codec_write(codec, 0x15, 0,
1068 AC_VERB_SET_EAPD_BTLENABLE, 2);
1071 switch (codec->vendor_id) {
1073 snd_hda_codec_write(codec, 0x1a, 0,
1074 AC_VERB_SET_COEF_INDEX, 7);
1075 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1076 AC_VERB_GET_PROC_COEF, 0);
1077 snd_hda_codec_write(codec, 0x1a, 0,
1078 AC_VERB_SET_COEF_INDEX, 7);
1079 snd_hda_codec_write(codec, 0x1a, 0,
1080 AC_VERB_SET_PROC_COEF,
1090 snd_hda_codec_write(codec, 0x20, 0,
1091 AC_VERB_SET_COEF_INDEX, 7);
1092 tmp = snd_hda_codec_read(codec, 0x20, 0,
1093 AC_VERB_GET_PROC_COEF, 0);
1094 snd_hda_codec_write(codec, 0x20, 0,
1095 AC_VERB_SET_COEF_INDEX, 7);
1096 snd_hda_codec_write(codec, 0x20, 0,
1097 AC_VERB_SET_PROC_COEF,
1101 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1105 snd_hda_codec_write(codec, 0x20, 0,
1106 AC_VERB_SET_COEF_INDEX, 7);
1107 tmp = snd_hda_codec_read(codec, 0x20, 0,
1108 AC_VERB_GET_PROC_COEF, 0);
1109 snd_hda_codec_write(codec, 0x20, 0,
1110 AC_VERB_SET_COEF_INDEX, 7);
1111 snd_hda_codec_write(codec, 0x20, 0,
1112 AC_VERB_SET_PROC_COEF,
1120 /* is laptop or Desktop and enable the function "Mute internal speaker
1121 * when the external headphone out jack is plugged"
1123 if (!(ass & 0x8000))
1126 * 10~8 : Jack location
1127 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1129 * 15 : 1 --> enable the function "Mute internal speaker
1130 * when the external headphone out jack is plugged"
1132 if (!spec->autocfg.speaker_pins[0]) {
1133 if (spec->autocfg.line_out_pins[0])
1134 spec->autocfg.speaker_pins[0] =
1135 spec->autocfg.line_out_pins[0];
1140 if (!spec->autocfg.hp_pins[0]) {
1141 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1143 spec->autocfg.hp_pins[0] = porta;
1145 spec->autocfg.hp_pins[0] = porte;
1147 spec->autocfg.hp_pins[0] = portd;
1151 if (spec->autocfg.hp_pins[0])
1152 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1153 AC_VERB_SET_UNSOLICITED_ENABLE,
1154 AC_USRSP_EN | ALC880_HP_EVENT);
1156 #if 0 /* it's broken in some acses -- temporarily disabled */
1157 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1158 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1159 snd_hda_codec_write(codec,
1160 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1161 AC_VERB_SET_UNSOLICITED_ENABLE,
1162 AC_USRSP_EN | ALC880_MIC_EVENT);
1163 #endif /* disabled */
1165 spec->unsol_event = alc_sku_unsol_event;
1169 * Fix-up pin default configurations
1177 static void alc_fix_pincfg(struct hda_codec *codec,
1178 const struct snd_pci_quirk *quirk,
1179 const struct alc_pincfg **pinfix)
1181 const struct alc_pincfg *cfg;
1183 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1187 cfg = pinfix[quirk->value];
1188 for (; cfg->nid; cfg++) {
1191 for (i = 0; i < 4; i++) {
1192 snd_hda_codec_write(codec, cfg->nid, 0,
1193 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1207 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1208 /* Mic-in jack as mic in */
1209 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1210 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1211 /* Line-in jack as Line in */
1212 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1213 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1214 /* Line-Out as Front */
1215 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1222 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1223 /* Mic-in jack as mic in */
1224 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1225 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1226 /* Line-in jack as Surround */
1227 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1228 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1229 /* Line-Out as Front */
1230 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1237 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1238 /* Mic-in jack as CLFE */
1239 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1240 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1241 /* Line-in jack as Surround */
1242 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1243 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1244 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1245 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1252 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1253 /* Mic-in jack as CLFE */
1254 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1255 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1256 /* Line-in jack as Surround */
1257 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1258 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1259 /* Line-Out as Side */
1260 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1264 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1265 { 2, alc888_4ST_ch2_intel_init },
1266 { 4, alc888_4ST_ch4_intel_init },
1267 { 6, alc888_4ST_ch6_intel_init },
1268 { 8, alc888_4ST_ch8_intel_init },
1272 * ALC888 Fujitsu Siemens Amillo xa3530
1275 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1276 /* Front Mic: set to PIN_IN (empty by default) */
1277 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1278 /* Connect Internal HP to Front */
1279 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1280 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1281 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1282 /* Connect Bass HP to Front */
1283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1285 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1286 /* Connect Line-Out side jack (SPDIF) to Side */
1287 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1288 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1289 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1290 /* Connect Mic jack to CLFE */
1291 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1293 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1294 /* Connect Line-in jack to Surround */
1295 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1296 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1297 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1298 /* Connect HP out jack to Front */
1299 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1300 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1301 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1302 /* Enable unsolicited event for HP jack and Line-out jack */
1303 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1304 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1308 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1310 unsigned int present;
1312 /* Line out presence */
1313 present = snd_hda_codec_read(codec, 0x17, 0,
1314 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1315 /* HP out presence */
1316 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1317 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1318 bits = present ? HDA_AMP_MUTE : 0;
1319 /* Toggle internal speakers muting */
1320 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1321 HDA_AMP_MUTE, bits);
1322 /* Toggle internal bass muting */
1323 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1324 HDA_AMP_MUTE, bits);
1327 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1330 if (res >> 26 == ALC880_HP_EVENT)
1331 alc888_fujitsu_xa3530_automute(codec);
1336 * ALC888 Acer Aspire 4930G model
1339 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1340 /* Front Mic: set to PIN_IN (empty by default) */
1341 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1342 /* Unselect Front Mic by default in input mixer 3 */
1343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1344 /* Enable unsolicited event for HP jack */
1345 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1346 /* Connect Internal HP to front */
1347 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1348 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1349 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1350 /* Connect HP out to front */
1351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1352 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1353 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1357 static struct hda_input_mux alc888_2_capture_sources[2] = {
1358 /* Front mic only available on one ADC */
1365 { "Front Mic", 0xb },
1378 static struct snd_kcontrol_new alc888_base_mixer[] = {
1379 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1380 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1381 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1382 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1383 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1385 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1386 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1387 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1388 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1389 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1391 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1392 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1393 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1395 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1396 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1400 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1402 unsigned int present;
1404 present = snd_hda_codec_read(codec, 0x15, 0,
1405 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1406 bits = present ? HDA_AMP_MUTE : 0;
1407 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1408 HDA_AMP_MUTE, bits);
1411 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1414 if (res >> 26 == ALC880_HP_EVENT)
1415 alc888_acer_aspire_4930g_automute(codec);
1419 * ALC880 3-stack model
1421 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1422 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1423 * F-Mic = 0x1b, HP = 0x19
1426 static hda_nid_t alc880_dac_nids[4] = {
1427 /* front, rear, clfe, rear_surr */
1428 0x02, 0x05, 0x04, 0x03
1431 static hda_nid_t alc880_adc_nids[3] = {
1436 /* The datasheet says the node 0x07 is connected from inputs,
1437 * but it shows zero connection in the real implementation on some devices.
1438 * Note: this is a 915GAV bug, fixed on 915GLV
1440 static hda_nid_t alc880_adc_nids_alt[2] = {
1445 #define ALC880_DIGOUT_NID 0x06
1446 #define ALC880_DIGIN_NID 0x0a
1448 static struct hda_input_mux alc880_capture_source = {
1452 { "Front Mic", 0x3 },
1458 /* channel source setting (2/6 channel selection for 3-stack) */
1460 static struct hda_verb alc880_threestack_ch2_init[] = {
1461 /* set line-in to input, mute it */
1462 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1463 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1464 /* set mic-in to input vref 80%, mute it */
1465 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1466 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1471 static struct hda_verb alc880_threestack_ch6_init[] = {
1472 /* set line-in to output, unmute it */
1473 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1474 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1475 /* set mic-in to output, unmute it */
1476 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1477 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1481 static struct hda_channel_mode alc880_threestack_modes[2] = {
1482 { 2, alc880_threestack_ch2_init },
1483 { 6, alc880_threestack_ch6_init },
1486 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1487 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1488 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1489 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1490 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1491 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1492 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1493 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1494 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1495 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1496 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1497 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1498 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1500 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1501 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1502 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1503 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1505 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1506 .name = "Channel Mode",
1507 .info = alc_ch_mode_info,
1508 .get = alc_ch_mode_get,
1509 .put = alc_ch_mode_put,
1514 /* capture mixer elements */
1515 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1516 struct snd_ctl_elem_info *uinfo)
1518 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1519 struct alc_spec *spec = codec->spec;
1522 mutex_lock(&codec->control_mutex);
1523 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1525 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1526 mutex_unlock(&codec->control_mutex);
1530 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1531 unsigned int size, unsigned int __user *tlv)
1533 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1534 struct alc_spec *spec = codec->spec;
1537 mutex_lock(&codec->control_mutex);
1538 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1540 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1541 mutex_unlock(&codec->control_mutex);
1545 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1546 struct snd_ctl_elem_value *ucontrol);
1548 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1549 struct snd_ctl_elem_value *ucontrol,
1552 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1553 struct alc_spec *spec = codec->spec;
1554 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1557 mutex_lock(&codec->control_mutex);
1558 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1560 err = func(kcontrol, ucontrol);
1561 mutex_unlock(&codec->control_mutex);
1565 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1566 struct snd_ctl_elem_value *ucontrol)
1568 return alc_cap_getput_caller(kcontrol, ucontrol,
1569 snd_hda_mixer_amp_volume_get);
1572 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1573 struct snd_ctl_elem_value *ucontrol)
1575 return alc_cap_getput_caller(kcontrol, ucontrol,
1576 snd_hda_mixer_amp_volume_put);
1579 /* capture mixer elements */
1580 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1582 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1583 struct snd_ctl_elem_value *ucontrol)
1585 return alc_cap_getput_caller(kcontrol, ucontrol,
1586 snd_hda_mixer_amp_switch_get);
1589 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1590 struct snd_ctl_elem_value *ucontrol)
1592 return alc_cap_getput_caller(kcontrol, ucontrol,
1593 snd_hda_mixer_amp_switch_put);
1596 #define DEFINE_CAPMIX(num) \
1597 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1599 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1600 .name = "Capture Switch", \
1601 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1603 .info = alc_cap_sw_info, \
1604 .get = alc_cap_sw_get, \
1605 .put = alc_cap_sw_put, \
1608 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1609 .name = "Capture Volume", \
1610 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1611 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1612 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1614 .info = alc_cap_vol_info, \
1615 .get = alc_cap_vol_get, \
1616 .put = alc_cap_vol_put, \
1617 .tlv = { .c = alc_cap_vol_tlv }, \
1620 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1621 /* .name = "Capture Source", */ \
1622 .name = "Input Source", \
1624 .info = alc_mux_enum_info, \
1625 .get = alc_mux_enum_get, \
1626 .put = alc_mux_enum_put, \
1631 /* up to three ADCs */
1638 * ALC880 5-stack model
1640 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1642 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1643 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1646 /* additional mixers to alc880_three_stack_mixer */
1647 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1648 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1649 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1653 /* channel source setting (6/8 channel selection for 5-stack) */
1655 static struct hda_verb alc880_fivestack_ch6_init[] = {
1656 /* set line-in to input, mute it */
1657 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1658 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1663 static struct hda_verb alc880_fivestack_ch8_init[] = {
1664 /* set line-in to output, unmute it */
1665 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1666 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1670 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1671 { 6, alc880_fivestack_ch6_init },
1672 { 8, alc880_fivestack_ch8_init },
1677 * ALC880 6-stack model
1679 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1680 * Side = 0x05 (0x0f)
1681 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1682 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1685 static hda_nid_t alc880_6st_dac_nids[4] = {
1686 /* front, rear, clfe, rear_surr */
1687 0x02, 0x03, 0x04, 0x05
1690 static struct hda_input_mux alc880_6stack_capture_source = {
1694 { "Front Mic", 0x1 },
1700 /* fixed 8-channels */
1701 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1705 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1706 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1707 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1708 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1709 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1710 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1711 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1712 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1713 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1714 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1715 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1716 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1717 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1718 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1719 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1721 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1722 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1723 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1725 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1726 .name = "Channel Mode",
1727 .info = alc_ch_mode_info,
1728 .get = alc_ch_mode_get,
1729 .put = alc_ch_mode_put,
1738 * W810 has rear IO for:
1741 * Center/LFE (DAC 04)
1744 * The system also has a pair of internal speakers, and a headphone jack.
1745 * These are both connected to Line2 on the codec, hence to DAC 02.
1747 * There is a variable resistor to control the speaker or headphone
1748 * volume. This is a hardware-only device without a software API.
1750 * Plugging headphones in will disable the internal speakers. This is
1751 * implemented in hardware, not via the driver using jack sense. In
1752 * a similar fashion, plugging into the rear socket marked "front" will
1753 * disable both the speakers and headphones.
1755 * For input, there's a microphone jack, and an "audio in" jack.
1756 * These may not do anything useful with this driver yet, because I
1757 * haven't setup any initialization verbs for these yet...
1760 static hda_nid_t alc880_w810_dac_nids[3] = {
1761 /* front, rear/surround, clfe */
1765 /* fixed 6 channels */
1766 static struct hda_channel_mode alc880_w810_modes[1] = {
1770 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1771 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1772 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1773 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1774 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1775 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1776 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1777 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1778 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1779 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1780 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1788 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1789 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1793 static hda_nid_t alc880_z71v_dac_nids[1] = {
1796 #define ALC880_Z71V_HP_DAC 0x03
1798 /* fixed 2 channels */
1799 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1803 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1804 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1805 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1806 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1807 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1811 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1817 * ALC880 F1734 model
1819 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1820 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1823 static hda_nid_t alc880_f1734_dac_nids[1] = {
1826 #define ALC880_F1734_HP_DAC 0x02
1828 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1829 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1830 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1831 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1832 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1833 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1834 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1840 static struct hda_input_mux alc880_f1734_capture_source = {
1852 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1853 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1854 * Mic = 0x18, Line = 0x1a
1857 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1858 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1860 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1861 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1862 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1863 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1864 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1865 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1866 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1867 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1868 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1876 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1877 .name = "Channel Mode",
1878 .info = alc_ch_mode_info,
1879 .get = alc_ch_mode_get,
1880 .put = alc_ch_mode_put,
1886 * ALC880 ASUS W1V model
1888 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1889 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1890 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1893 /* additional mixers to alc880_asus_mixer */
1894 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1895 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1896 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1901 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1902 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1903 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1904 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1905 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1906 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1909 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1910 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1915 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1916 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1917 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1918 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1919 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1920 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1921 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1922 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1923 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1924 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1925 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1926 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1927 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1930 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1933 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1934 .name = "Channel Mode",
1935 .info = alc_ch_mode_info,
1936 .get = alc_ch_mode_get,
1937 .put = alc_ch_mode_put,
1942 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1943 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1944 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1945 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1946 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1949 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1950 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1951 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1952 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1956 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1957 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1958 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1959 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1960 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1961 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1962 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1967 * virtual master controls
1971 * slave controls for virtual master
1973 static const char *alc_slave_vols[] = {
1974 "Front Playback Volume",
1975 "Surround Playback Volume",
1976 "Center Playback Volume",
1977 "LFE Playback Volume",
1978 "Side Playback Volume",
1979 "Headphone Playback Volume",
1980 "Speaker Playback Volume",
1981 "Mono Playback Volume",
1982 "Line-Out Playback Volume",
1983 "PCM Playback Volume",
1987 static const char *alc_slave_sws[] = {
1988 "Front Playback Switch",
1989 "Surround Playback Switch",
1990 "Center Playback Switch",
1991 "LFE Playback Switch",
1992 "Side Playback Switch",
1993 "Headphone Playback Switch",
1994 "Speaker Playback Switch",
1995 "Mono Playback Switch",
1996 "IEC958 Playback Switch",
2001 * build control elements
2004 static void alc_free_kctls(struct hda_codec *codec);
2006 /* additional beep mixers; the actual parameters are overwritten at build */
2007 static struct snd_kcontrol_new alc_beep_mixer[] = {
2008 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2009 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2013 static int alc_build_controls(struct hda_codec *codec)
2015 struct alc_spec *spec = codec->spec;
2019 for (i = 0; i < spec->num_mixers; i++) {
2020 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2024 if (spec->cap_mixer) {
2025 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2029 if (spec->multiout.dig_out_nid) {
2030 err = snd_hda_create_spdif_out_ctls(codec,
2031 spec->multiout.dig_out_nid);
2034 if (!spec->no_analog) {
2035 err = snd_hda_create_spdif_share_sw(codec,
2039 spec->multiout.share_spdif = 1;
2042 if (spec->dig_in_nid) {
2043 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2048 /* create beep controls if needed */
2049 if (spec->beep_amp) {
2050 struct snd_kcontrol_new *knew;
2051 for (knew = alc_beep_mixer; knew->name; knew++) {
2052 struct snd_kcontrol *kctl;
2053 kctl = snd_ctl_new1(knew, codec);
2056 kctl->private_value = spec->beep_amp;
2057 err = snd_hda_ctl_add(codec, kctl);
2063 /* if we have no master control, let's create it */
2064 if (!spec->no_analog &&
2065 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2066 unsigned int vmaster_tlv[4];
2067 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2068 HDA_OUTPUT, vmaster_tlv);
2069 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2070 vmaster_tlv, alc_slave_vols);
2074 if (!spec->no_analog &&
2075 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2076 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2077 NULL, alc_slave_sws);
2082 alc_free_kctls(codec); /* no longer needed */
2088 * initialize the codec volumes, etc
2092 * generic initialization of ADC, input mixers and output mixers
2094 static struct hda_verb alc880_volume_init_verbs[] = {
2096 * Unmute ADC0-2 and set the default input to mic-in
2098 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2100 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2101 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2102 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2103 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2105 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2107 * Note: PASD motherboards uses the Line In 2 as the input for front
2110 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2120 * Set up output mixers (0x0c - 0x0f)
2122 /* set vol=0 to output mixers */
2123 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2124 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2125 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2126 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2127 /* set up input amps for analog loopback */
2128 /* Amp Indices: DAC = 0, mixer = 1 */
2129 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2131 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2132 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2133 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2134 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2135 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2136 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2142 * 3-stack pin configuration:
2143 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2145 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2147 * preset connection lists of input pins
2148 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2150 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2151 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2152 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2155 * Set pin mode and muting
2157 /* set front pin widgets 0x14 for output */
2158 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2159 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2160 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2161 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2162 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2163 /* Mic2 (as headphone out) for HP output */
2164 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2165 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2166 /* Line In pin widget for input */
2167 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2168 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2169 /* Line2 (as front mic) pin widget for input and vref at 80% */
2170 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2171 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2172 /* CD pin widget for input */
2173 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2179 * 5-stack pin configuration:
2180 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2181 * line-in/side = 0x1a, f-mic = 0x1b
2183 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2185 * preset connection lists of input pins
2186 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2188 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2189 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2192 * Set pin mode and muting
2194 /* set pin widgets 0x14-0x17 for output */
2195 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2196 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2197 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2198 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2199 /* unmute pins for output (no gain on this amp) */
2200 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2202 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2203 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2205 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2206 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2207 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2208 /* Mic2 (as headphone out) for HP output */
2209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2210 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2211 /* Line In pin widget for input */
2212 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2213 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2214 /* Line2 (as front mic) pin widget for input and vref at 80% */
2215 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2216 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2217 /* CD pin widget for input */
2218 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2224 * W810 pin configuration:
2225 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2227 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2228 /* hphone/speaker input selector: front DAC */
2229 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2231 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2232 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2234 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2235 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2236 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2238 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2239 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2245 * Z71V pin configuration:
2246 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2248 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2250 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2254 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2255 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2256 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2257 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2263 * 6-stack pin configuration:
2264 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2265 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2267 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2268 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2274 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2275 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2276 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2277 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2279 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2280 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2281 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2282 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2283 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2284 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2285 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2286 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2287 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2293 * Uniwill pin configuration:
2294 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2297 static struct hda_verb alc880_uniwill_init_verbs[] = {
2298 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2301 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2302 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2303 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2304 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2305 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2306 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2307 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2316 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2317 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2319 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2321 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2322 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2323 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2325 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2326 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2333 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2335 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2336 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2339 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2341 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2342 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2343 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2349 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2351 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2353 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2354 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2355 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2356 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2358 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2359 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2364 static struct hda_verb alc880_beep_init_verbs[] = {
2365 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2369 /* toggle speaker-output according to the hp-jack state */
2370 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2372 unsigned int present;
2375 present = snd_hda_codec_read(codec, 0x14, 0,
2376 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2377 bits = present ? HDA_AMP_MUTE : 0;
2378 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2379 HDA_AMP_MUTE, bits);
2380 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2381 HDA_AMP_MUTE, bits);
2384 /* auto-toggle front mic */
2385 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2387 unsigned int present;
2390 present = snd_hda_codec_read(codec, 0x18, 0,
2391 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2392 bits = present ? HDA_AMP_MUTE : 0;
2393 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2396 static void alc880_uniwill_automute(struct hda_codec *codec)
2398 alc880_uniwill_hp_automute(codec);
2399 alc880_uniwill_mic_automute(codec);
2402 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2405 /* Looks like the unsol event is incompatible with the standard
2406 * definition. 4bit tag is placed at 28 bit!
2408 switch (res >> 28) {
2409 case ALC880_HP_EVENT:
2410 alc880_uniwill_hp_automute(codec);
2412 case ALC880_MIC_EVENT:
2413 alc880_uniwill_mic_automute(codec);
2418 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2420 unsigned int present;
2423 present = snd_hda_codec_read(codec, 0x14, 0,
2424 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2425 bits = present ? HDA_AMP_MUTE : 0;
2426 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2429 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2431 unsigned int present;
2433 present = snd_hda_codec_read(codec, 0x21, 0,
2434 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2435 present &= HDA_AMP_VOLMASK;
2436 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2437 HDA_AMP_VOLMASK, present);
2438 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2439 HDA_AMP_VOLMASK, present);
2442 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2445 /* Looks like the unsol event is incompatible with the standard
2446 * definition. 4bit tag is placed at 28 bit!
2448 if ((res >> 28) == ALC880_HP_EVENT)
2449 alc880_uniwill_p53_hp_automute(codec);
2450 if ((res >> 28) == ALC880_DCVOL_EVENT)
2451 alc880_uniwill_p53_dcvol_automute(codec);
2455 * F1734 pin configuration:
2456 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2458 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2459 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2460 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2461 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2462 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2463 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2470 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2471 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2472 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2473 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2474 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2475 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2476 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2477 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2478 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2480 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2481 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2487 * ASUS pin configuration:
2488 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2490 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2491 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2492 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2493 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2494 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2498 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2500 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2503 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2505 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2507 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2509 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2510 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2513 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2518 /* Enable GPIO mask and set output */
2519 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2520 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2522 /* Clevo m520g init */
2523 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2524 /* headphone output */
2525 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2527 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2528 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2533 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2534 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2535 /* Mic1 (rear panel) */
2536 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2537 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2538 /* Mic2 (front panel) */
2539 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2540 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2542 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2543 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2544 /* change to EAPD mode */
2545 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2546 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2551 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2552 /* change to EAPD mode */
2553 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2554 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2556 /* Headphone output */
2557 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2560 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2562 /* Line In pin widget for input */
2563 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2564 /* CD pin widget for input */
2565 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2566 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2567 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2569 /* change to EAPD mode */
2570 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2571 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2577 * LG m1 express dual
2580 * Rear Line-In/Out (blue): 0x14
2581 * Build-in Mic-In: 0x15
2583 * HP-Out (green): 0x1b
2584 * Mic-In/Out (red): 0x19
2588 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2589 static hda_nid_t alc880_lg_dac_nids[3] = {
2593 /* seems analog CD is not working */
2594 static struct hda_input_mux alc880_lg_capture_source = {
2599 { "Internal Mic", 0x6 },
2603 /* 2,4,6 channel modes */
2604 static struct hda_verb alc880_lg_ch2_init[] = {
2605 /* set line-in and mic-in to input */
2606 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2607 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2611 static struct hda_verb alc880_lg_ch4_init[] = {
2612 /* set line-in to out and mic-in to input */
2613 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2614 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2618 static struct hda_verb alc880_lg_ch6_init[] = {
2619 /* set line-in and mic-in to output */
2620 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2621 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2625 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2626 { 2, alc880_lg_ch2_init },
2627 { 4, alc880_lg_ch4_init },
2628 { 6, alc880_lg_ch6_init },
2631 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2632 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2633 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2634 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2635 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2636 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2637 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2638 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2639 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2642 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2643 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2644 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2645 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2648 .name = "Channel Mode",
2649 .info = alc_ch_mode_info,
2650 .get = alc_ch_mode_get,
2651 .put = alc_ch_mode_put,
2656 static struct hda_verb alc880_lg_init_verbs[] = {
2657 /* set capture source to mic-in */
2658 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2659 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2661 /* mute all amp mixer inputs */
2662 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2663 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2664 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2665 /* line-in to input */
2666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2667 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2672 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2673 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2674 /* mic-in to input */
2675 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2676 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2677 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2679 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2680 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2681 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2683 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2687 /* toggle speaker-output according to the hp-jack state */
2688 static void alc880_lg_automute(struct hda_codec *codec)
2690 unsigned int present;
2693 present = snd_hda_codec_read(codec, 0x1b, 0,
2694 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2695 bits = present ? HDA_AMP_MUTE : 0;
2696 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2697 HDA_AMP_MUTE, bits);
2700 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2702 /* Looks like the unsol event is incompatible with the standard
2703 * definition. 4bit tag is placed at 28 bit!
2705 if ((res >> 28) == 0x01)
2706 alc880_lg_automute(codec);
2715 * Built-in Mic-In: 0x19
2721 static struct hda_input_mux alc880_lg_lw_capture_source = {
2725 { "Internal Mic", 0x1 },
2730 #define alc880_lg_lw_modes alc880_threestack_modes
2732 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2733 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2734 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2735 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2736 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2737 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2738 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2739 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2740 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2741 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2742 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2745 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2746 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2749 .name = "Channel Mode",
2750 .info = alc_ch_mode_info,
2751 .get = alc_ch_mode_get,
2752 .put = alc_ch_mode_put,
2757 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2758 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2759 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2760 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2762 /* set capture source to mic-in */
2763 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2764 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2765 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2768 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2771 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2772 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2773 /* mic-in to input */
2774 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2777 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2778 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2780 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2784 /* toggle speaker-output according to the hp-jack state */
2785 static void alc880_lg_lw_automute(struct hda_codec *codec)
2787 unsigned int present;
2790 present = snd_hda_codec_read(codec, 0x1b, 0,
2791 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2792 bits = present ? HDA_AMP_MUTE : 0;
2793 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2794 HDA_AMP_MUTE, bits);
2797 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2799 /* Looks like the unsol event is incompatible with the standard
2800 * definition. 4bit tag is placed at 28 bit!
2802 if ((res >> 28) == 0x01)
2803 alc880_lg_lw_automute(codec);
2806 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2807 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2808 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2811 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2812 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2816 static struct hda_input_mux alc880_medion_rim_capture_source = {
2820 { "Internal Mic", 0x1 },
2824 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2825 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2827 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2828 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2830 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2831 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2832 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2833 /* Mic2 (as headphone out) for HP output */
2834 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2835 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2836 /* Internal Speaker */
2837 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2838 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2840 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2841 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2843 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2847 /* toggle speaker-output according to the hp-jack state */
2848 static void alc880_medion_rim_automute(struct hda_codec *codec)
2850 unsigned int present;
2853 present = snd_hda_codec_read(codec, 0x14, 0,
2854 AC_VERB_GET_PIN_SENSE, 0)
2855 & AC_PINSENSE_PRESENCE;
2856 bits = present ? HDA_AMP_MUTE : 0;
2857 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2858 HDA_AMP_MUTE, bits);
2860 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2862 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2865 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2868 /* Looks like the unsol event is incompatible with the standard
2869 * definition. 4bit tag is placed at 28 bit!
2871 if ((res >> 28) == ALC880_HP_EVENT)
2872 alc880_medion_rim_automute(codec);
2875 #ifdef CONFIG_SND_HDA_POWER_SAVE
2876 static struct hda_amp_list alc880_loopbacks[] = {
2877 { 0x0b, HDA_INPUT, 0 },
2878 { 0x0b, HDA_INPUT, 1 },
2879 { 0x0b, HDA_INPUT, 2 },
2880 { 0x0b, HDA_INPUT, 3 },
2881 { 0x0b, HDA_INPUT, 4 },
2885 static struct hda_amp_list alc880_lg_loopbacks[] = {
2886 { 0x0b, HDA_INPUT, 1 },
2887 { 0x0b, HDA_INPUT, 6 },
2888 { 0x0b, HDA_INPUT, 7 },
2897 static int alc_init(struct hda_codec *codec)
2899 struct alc_spec *spec = codec->spec;
2903 if (codec->vendor_id == 0x10ec0888)
2904 alc888_coef_init(codec);
2906 for (i = 0; i < spec->num_init_verbs; i++)
2907 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2909 if (spec->init_hook)
2910 spec->init_hook(codec);
2915 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2917 struct alc_spec *spec = codec->spec;
2919 if (spec->unsol_event)
2920 spec->unsol_event(codec, res);
2923 #ifdef CONFIG_SND_HDA_POWER_SAVE
2924 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2926 struct alc_spec *spec = codec->spec;
2927 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2932 * Analog playback callbacks
2934 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2935 struct hda_codec *codec,
2936 struct snd_pcm_substream *substream)
2938 struct alc_spec *spec = codec->spec;
2939 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2943 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2944 struct hda_codec *codec,
2945 unsigned int stream_tag,
2946 unsigned int format,
2947 struct snd_pcm_substream *substream)
2949 struct alc_spec *spec = codec->spec;
2950 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2951 stream_tag, format, substream);
2954 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2955 struct hda_codec *codec,
2956 struct snd_pcm_substream *substream)
2958 struct alc_spec *spec = codec->spec;
2959 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2965 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2966 struct hda_codec *codec,
2967 struct snd_pcm_substream *substream)
2969 struct alc_spec *spec = codec->spec;
2970 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2973 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2974 struct hda_codec *codec,
2975 unsigned int stream_tag,
2976 unsigned int format,
2977 struct snd_pcm_substream *substream)
2979 struct alc_spec *spec = codec->spec;
2980 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2981 stream_tag, format, substream);
2984 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2985 struct hda_codec *codec,
2986 struct snd_pcm_substream *substream)
2988 struct alc_spec *spec = codec->spec;
2989 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
2992 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2993 struct hda_codec *codec,
2994 struct snd_pcm_substream *substream)
2996 struct alc_spec *spec = codec->spec;
2997 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3003 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3004 struct hda_codec *codec,
3005 unsigned int stream_tag,
3006 unsigned int format,
3007 struct snd_pcm_substream *substream)
3009 struct alc_spec *spec = codec->spec;
3011 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3012 stream_tag, 0, format);
3016 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3017 struct hda_codec *codec,
3018 struct snd_pcm_substream *substream)
3020 struct alc_spec *spec = codec->spec;
3022 snd_hda_codec_cleanup_stream(codec,
3023 spec->adc_nids[substream->number + 1]);
3030 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3034 /* NID is set in alc_build_pcms */
3036 .open = alc880_playback_pcm_open,
3037 .prepare = alc880_playback_pcm_prepare,
3038 .cleanup = alc880_playback_pcm_cleanup
3042 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3046 /* NID is set in alc_build_pcms */
3049 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3053 /* NID is set in alc_build_pcms */
3056 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3057 .substreams = 2, /* can be overridden */
3060 /* NID is set in alc_build_pcms */
3062 .prepare = alc880_alt_capture_pcm_prepare,
3063 .cleanup = alc880_alt_capture_pcm_cleanup
3067 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3071 /* NID is set in alc_build_pcms */
3073 .open = alc880_dig_playback_pcm_open,
3074 .close = alc880_dig_playback_pcm_close,
3075 .prepare = alc880_dig_playback_pcm_prepare,
3076 .cleanup = alc880_dig_playback_pcm_cleanup
3080 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3084 /* NID is set in alc_build_pcms */
3087 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3088 static struct hda_pcm_stream alc_pcm_null_stream = {
3094 static int alc_build_pcms(struct hda_codec *codec)
3096 struct alc_spec *spec = codec->spec;
3097 struct hda_pcm *info = spec->pcm_rec;
3100 codec->num_pcms = 1;
3101 codec->pcm_info = info;
3103 if (spec->no_analog)
3106 info->name = spec->stream_name_analog;
3107 if (spec->stream_analog_playback) {
3108 if (snd_BUG_ON(!spec->multiout.dac_nids))
3110 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3111 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3113 if (spec->stream_analog_capture) {
3114 if (snd_BUG_ON(!spec->adc_nids))
3116 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3117 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3120 if (spec->channel_mode) {
3121 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3122 for (i = 0; i < spec->num_channel_mode; i++) {
3123 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3124 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3130 /* SPDIF for stream index #1 */
3131 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3132 codec->num_pcms = 2;
3133 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3134 info = spec->pcm_rec + 1;
3135 info->name = spec->stream_name_digital;
3136 if (spec->dig_out_type)
3137 info->pcm_type = spec->dig_out_type;
3139 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3140 if (spec->multiout.dig_out_nid &&
3141 spec->stream_digital_playback) {
3142 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3143 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3145 if (spec->dig_in_nid &&
3146 spec->stream_digital_capture) {
3147 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3148 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3150 /* FIXME: do we need this for all Realtek codec models? */
3151 codec->spdif_status_reset = 1;
3154 if (spec->no_analog)
3157 /* If the use of more than one ADC is requested for the current
3158 * model, configure a second analog capture-only PCM.
3160 /* Additional Analaog capture for index #2 */
3161 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3162 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3163 codec->num_pcms = 3;
3164 info = spec->pcm_rec + 2;
3165 info->name = spec->stream_name_analog;
3166 if (spec->alt_dac_nid) {
3167 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3168 *spec->stream_analog_alt_playback;
3169 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3172 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3173 alc_pcm_null_stream;
3174 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3176 if (spec->num_adc_nids > 1) {
3177 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3178 *spec->stream_analog_alt_capture;
3179 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3181 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3182 spec->num_adc_nids - 1;
3184 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3185 alc_pcm_null_stream;
3186 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3193 static void alc_free_kctls(struct hda_codec *codec)
3195 struct alc_spec *spec = codec->spec;
3197 if (spec->kctls.list) {
3198 struct snd_kcontrol_new *kctl = spec->kctls.list;
3200 for (i = 0; i < spec->kctls.used; i++)
3201 kfree(kctl[i].name);
3203 snd_array_free(&spec->kctls);
3206 static void alc_free(struct hda_codec *codec)
3208 struct alc_spec *spec = codec->spec;
3213 alc_free_kctls(codec);
3215 snd_hda_detach_beep_device(codec);
3218 #ifdef SND_HDA_NEEDS_RESUME
3219 static void store_pin_configs(struct hda_codec *codec)
3221 struct alc_spec *spec = codec->spec;
3222 hda_nid_t nid, end_nid;
3224 end_nid = codec->start_nid + codec->num_nodes;
3225 for (nid = codec->start_nid; nid < end_nid; nid++) {
3226 unsigned int wid_caps = get_wcaps(codec, nid);
3227 unsigned int wid_type =
3228 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3229 if (wid_type != AC_WID_PIN)
3231 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3233 spec->pin_nids[spec->num_pins] = nid;
3234 spec->pin_cfgs[spec->num_pins] =
3235 snd_hda_codec_read(codec, nid, 0,
3236 AC_VERB_GET_CONFIG_DEFAULT, 0);
3241 static void resume_pin_configs(struct hda_codec *codec)
3243 struct alc_spec *spec = codec->spec;
3246 for (i = 0; i < spec->num_pins; i++) {
3247 hda_nid_t pin_nid = spec->pin_nids[i];
3248 unsigned int pin_config = spec->pin_cfgs[i];
3249 snd_hda_codec_write(codec, pin_nid, 0,
3250 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3251 pin_config & 0x000000ff);
3252 snd_hda_codec_write(codec, pin_nid, 0,
3253 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3254 (pin_config & 0x0000ff00) >> 8);
3255 snd_hda_codec_write(codec, pin_nid, 0,
3256 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3257 (pin_config & 0x00ff0000) >> 16);
3258 snd_hda_codec_write(codec, pin_nid, 0,
3259 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3264 static int alc_resume(struct hda_codec *codec)
3266 resume_pin_configs(codec);
3267 codec->patch_ops.init(codec);
3268 snd_hda_codec_resume_amp(codec);
3269 snd_hda_codec_resume_cache(codec);
3273 #define store_pin_configs(codec)
3278 static struct hda_codec_ops alc_patch_ops = {
3279 .build_controls = alc_build_controls,
3280 .build_pcms = alc_build_pcms,
3283 .unsol_event = alc_unsol_event,
3284 #ifdef SND_HDA_NEEDS_RESUME
3285 .resume = alc_resume,
3287 #ifdef CONFIG_SND_HDA_POWER_SAVE
3288 .check_power_status = alc_check_power_status,
3294 * Test configuration for debugging
3296 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3299 #ifdef CONFIG_SND_DEBUG
3300 static hda_nid_t alc880_test_dac_nids[4] = {
3301 0x02, 0x03, 0x04, 0x05
3304 static struct hda_input_mux alc880_test_capture_source = {
3313 { "Surround", 0x6 },
3317 static struct hda_channel_mode alc880_test_modes[4] = {
3324 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3325 struct snd_ctl_elem_info *uinfo)
3327 static char *texts[] = {
3328 "N/A", "Line Out", "HP Out",
3329 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3331 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3333 uinfo->value.enumerated.items = 8;
3334 if (uinfo->value.enumerated.item >= 8)
3335 uinfo->value.enumerated.item = 7;
3336 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3340 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3341 struct snd_ctl_elem_value *ucontrol)
3343 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3344 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3345 unsigned int pin_ctl, item = 0;
3347 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3348 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3349 if (pin_ctl & AC_PINCTL_OUT_EN) {
3350 if (pin_ctl & AC_PINCTL_HP_EN)
3354 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3355 switch (pin_ctl & AC_PINCTL_VREFEN) {
3356 case AC_PINCTL_VREF_HIZ: item = 3; break;
3357 case AC_PINCTL_VREF_50: item = 4; break;
3358 case AC_PINCTL_VREF_GRD: item = 5; break;
3359 case AC_PINCTL_VREF_80: item = 6; break;
3360 case AC_PINCTL_VREF_100: item = 7; break;
3363 ucontrol->value.enumerated.item[0] = item;
3367 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3368 struct snd_ctl_elem_value *ucontrol)
3370 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3371 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3372 static unsigned int ctls[] = {
3373 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3374 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3375 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3376 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3377 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3378 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3380 unsigned int old_ctl, new_ctl;
3382 old_ctl = snd_hda_codec_read(codec, nid, 0,
3383 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3384 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3385 if (old_ctl != new_ctl) {
3387 snd_hda_codec_write_cache(codec, nid, 0,
3388 AC_VERB_SET_PIN_WIDGET_CONTROL,
3390 val = ucontrol->value.enumerated.item[0] >= 3 ?
3392 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3399 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3400 struct snd_ctl_elem_info *uinfo)
3402 static char *texts[] = {
3403 "Front", "Surround", "CLFE", "Side"
3405 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3407 uinfo->value.enumerated.items = 4;
3408 if (uinfo->value.enumerated.item >= 4)
3409 uinfo->value.enumerated.item = 3;
3410 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3414 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3415 struct snd_ctl_elem_value *ucontrol)
3417 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3418 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3421 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3422 ucontrol->value.enumerated.item[0] = sel & 3;
3426 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3427 struct snd_ctl_elem_value *ucontrol)
3429 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3430 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3433 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3434 if (ucontrol->value.enumerated.item[0] != sel) {
3435 sel = ucontrol->value.enumerated.item[0] & 3;
3436 snd_hda_codec_write_cache(codec, nid, 0,
3437 AC_VERB_SET_CONNECT_SEL, sel);
3443 #define PIN_CTL_TEST(xname,nid) { \
3444 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3446 .info = alc_test_pin_ctl_info, \
3447 .get = alc_test_pin_ctl_get, \
3448 .put = alc_test_pin_ctl_put, \
3449 .private_value = nid \
3452 #define PIN_SRC_TEST(xname,nid) { \
3453 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3455 .info = alc_test_pin_src_info, \
3456 .get = alc_test_pin_src_get, \
3457 .put = alc_test_pin_src_put, \
3458 .private_value = nid \
3461 static struct snd_kcontrol_new alc880_test_mixer[] = {
3462 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3463 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3464 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3465 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3466 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3467 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3468 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3469 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3470 PIN_CTL_TEST("Front Pin Mode", 0x14),
3471 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3472 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3473 PIN_CTL_TEST("Side Pin Mode", 0x17),
3474 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3475 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3476 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3477 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3478 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3479 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3480 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3481 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3482 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3483 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3484 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3485 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3486 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3487 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3488 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3489 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3490 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3491 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3493 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3494 .name = "Channel Mode",
3495 .info = alc_ch_mode_info,
3496 .get = alc_ch_mode_get,
3497 .put = alc_ch_mode_put,
3502 static struct hda_verb alc880_test_init_verbs[] = {
3503 /* Unmute inputs of 0x0c - 0x0f */
3504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3506 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3507 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3508 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3509 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3510 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3511 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3512 /* Vol output for 0x0c-0x0f */
3513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3516 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3517 /* Set output pins 0x14-0x17 */
3518 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3520 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3521 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3522 /* Unmute output pins 0x14-0x17 */
3523 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3524 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3525 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3526 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3527 /* Set input pins 0x18-0x1c */
3528 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3529 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3531 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3532 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3533 /* Mute input pins 0x18-0x1b */
3534 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3535 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3536 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3537 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3539 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3540 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3541 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3542 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3543 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3544 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3545 /* Analog input/passthru */
3546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3558 static const char *alc880_models[ALC880_MODEL_LAST] = {
3559 [ALC880_3ST] = "3stack",
3560 [ALC880_TCL_S700] = "tcl",
3561 [ALC880_3ST_DIG] = "3stack-digout",
3562 [ALC880_CLEVO] = "clevo",
3563 [ALC880_5ST] = "5stack",
3564 [ALC880_5ST_DIG] = "5stack-digout",
3565 [ALC880_W810] = "w810",
3566 [ALC880_Z71V] = "z71v",
3567 [ALC880_6ST] = "6stack",
3568 [ALC880_6ST_DIG] = "6stack-digout",
3569 [ALC880_ASUS] = "asus",
3570 [ALC880_ASUS_W1V] = "asus-w1v",
3571 [ALC880_ASUS_DIG] = "asus-dig",
3572 [ALC880_ASUS_DIG2] = "asus-dig2",
3573 [ALC880_UNIWILL_DIG] = "uniwill",
3574 [ALC880_UNIWILL_P53] = "uniwill-p53",
3575 [ALC880_FUJITSU] = "fujitsu",
3576 [ALC880_F1734] = "F1734",
3578 [ALC880_LG_LW] = "lg-lw",
3579 [ALC880_MEDION_RIM] = "medion",
3580 #ifdef CONFIG_SND_DEBUG
3581 [ALC880_TEST] = "test",
3583 [ALC880_AUTO] = "auto",
3586 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3587 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3588 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3589 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3590 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3591 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3592 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3593 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3594 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3595 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3596 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3597 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3598 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3599 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3600 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3601 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3602 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3603 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3604 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3605 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3606 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3607 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3608 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3609 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3610 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3611 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3612 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3613 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3614 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3615 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3616 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3617 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3618 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3619 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3620 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3621 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3622 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3623 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3624 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3625 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3626 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3627 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3628 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3629 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3630 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3631 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3632 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3633 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3634 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3635 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3636 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3637 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3638 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3639 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3640 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3641 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3642 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3643 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3644 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3645 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3646 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3647 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3648 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3649 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3650 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3651 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3652 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3653 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3654 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3656 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3657 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3658 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3663 * ALC880 codec presets
3665 static struct alc_config_preset alc880_presets[] = {
3667 .mixers = { alc880_three_stack_mixer },
3668 .init_verbs = { alc880_volume_init_verbs,
3669 alc880_pin_3stack_init_verbs },
3670 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3671 .dac_nids = alc880_dac_nids,
3672 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3673 .channel_mode = alc880_threestack_modes,
3675 .input_mux = &alc880_capture_source,
3677 [ALC880_3ST_DIG] = {
3678 .mixers = { alc880_three_stack_mixer },
3679 .init_verbs = { alc880_volume_init_verbs,
3680 alc880_pin_3stack_init_verbs },
3681 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3682 .dac_nids = alc880_dac_nids,
3683 .dig_out_nid = ALC880_DIGOUT_NID,
3684 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3685 .channel_mode = alc880_threestack_modes,
3687 .input_mux = &alc880_capture_source,
3689 [ALC880_TCL_S700] = {
3690 .mixers = { alc880_tcl_s700_mixer },
3691 .init_verbs = { alc880_volume_init_verbs,
3692 alc880_pin_tcl_S700_init_verbs,
3693 alc880_gpio2_init_verbs },
3694 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3695 .dac_nids = alc880_dac_nids,
3696 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3697 .num_adc_nids = 1, /* single ADC */
3699 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3700 .channel_mode = alc880_2_jack_modes,
3701 .input_mux = &alc880_capture_source,
3704 .mixers = { alc880_three_stack_mixer,
3705 alc880_five_stack_mixer},
3706 .init_verbs = { alc880_volume_init_verbs,
3707 alc880_pin_5stack_init_verbs },
3708 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3709 .dac_nids = alc880_dac_nids,
3710 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3711 .channel_mode = alc880_fivestack_modes,
3712 .input_mux = &alc880_capture_source,
3714 [ALC880_5ST_DIG] = {
3715 .mixers = { alc880_three_stack_mixer,
3716 alc880_five_stack_mixer },
3717 .init_verbs = { alc880_volume_init_verbs,
3718 alc880_pin_5stack_init_verbs },
3719 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3720 .dac_nids = alc880_dac_nids,
3721 .dig_out_nid = ALC880_DIGOUT_NID,
3722 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3723 .channel_mode = alc880_fivestack_modes,
3724 .input_mux = &alc880_capture_source,
3727 .mixers = { alc880_six_stack_mixer },
3728 .init_verbs = { alc880_volume_init_verbs,
3729 alc880_pin_6stack_init_verbs },
3730 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3731 .dac_nids = alc880_6st_dac_nids,
3732 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3733 .channel_mode = alc880_sixstack_modes,
3734 .input_mux = &alc880_6stack_capture_source,
3736 [ALC880_6ST_DIG] = {
3737 .mixers = { alc880_six_stack_mixer },
3738 .init_verbs = { alc880_volume_init_verbs,
3739 alc880_pin_6stack_init_verbs },
3740 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3741 .dac_nids = alc880_6st_dac_nids,
3742 .dig_out_nid = ALC880_DIGOUT_NID,
3743 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3744 .channel_mode = alc880_sixstack_modes,
3745 .input_mux = &alc880_6stack_capture_source,
3748 .mixers = { alc880_w810_base_mixer },
3749 .init_verbs = { alc880_volume_init_verbs,
3750 alc880_pin_w810_init_verbs,
3751 alc880_gpio2_init_verbs },
3752 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3753 .dac_nids = alc880_w810_dac_nids,
3754 .dig_out_nid = ALC880_DIGOUT_NID,
3755 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3756 .channel_mode = alc880_w810_modes,
3757 .input_mux = &alc880_capture_source,
3760 .mixers = { alc880_z71v_mixer },
3761 .init_verbs = { alc880_volume_init_verbs,
3762 alc880_pin_z71v_init_verbs },
3763 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3764 .dac_nids = alc880_z71v_dac_nids,
3765 .dig_out_nid = ALC880_DIGOUT_NID,
3767 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3768 .channel_mode = alc880_2_jack_modes,
3769 .input_mux = &alc880_capture_source,
3772 .mixers = { alc880_f1734_mixer },
3773 .init_verbs = { alc880_volume_init_verbs,
3774 alc880_pin_f1734_init_verbs },
3775 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3776 .dac_nids = alc880_f1734_dac_nids,
3778 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3779 .channel_mode = alc880_2_jack_modes,
3780 .input_mux = &alc880_f1734_capture_source,
3781 .unsol_event = alc880_uniwill_p53_unsol_event,
3782 .init_hook = alc880_uniwill_p53_hp_automute,
3785 .mixers = { alc880_asus_mixer },
3786 .init_verbs = { alc880_volume_init_verbs,
3787 alc880_pin_asus_init_verbs,
3788 alc880_gpio1_init_verbs },
3789 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3790 .dac_nids = alc880_asus_dac_nids,
3791 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3792 .channel_mode = alc880_asus_modes,
3794 .input_mux = &alc880_capture_source,
3796 [ALC880_ASUS_DIG] = {
3797 .mixers = { alc880_asus_mixer },
3798 .init_verbs = { alc880_volume_init_verbs,
3799 alc880_pin_asus_init_verbs,
3800 alc880_gpio1_init_verbs },
3801 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3802 .dac_nids = alc880_asus_dac_nids,
3803 .dig_out_nid = ALC880_DIGOUT_NID,
3804 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3805 .channel_mode = alc880_asus_modes,
3807 .input_mux = &alc880_capture_source,
3809 [ALC880_ASUS_DIG2] = {
3810 .mixers = { alc880_asus_mixer },
3811 .init_verbs = { alc880_volume_init_verbs,
3812 alc880_pin_asus_init_verbs,
3813 alc880_gpio2_init_verbs }, /* use GPIO2 */
3814 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3815 .dac_nids = alc880_asus_dac_nids,
3816 .dig_out_nid = ALC880_DIGOUT_NID,
3817 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3818 .channel_mode = alc880_asus_modes,
3820 .input_mux = &alc880_capture_source,
3822 [ALC880_ASUS_W1V] = {
3823 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3824 .init_verbs = { alc880_volume_init_verbs,
3825 alc880_pin_asus_init_verbs,
3826 alc880_gpio1_init_verbs },
3827 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3828 .dac_nids = alc880_asus_dac_nids,
3829 .dig_out_nid = ALC880_DIGOUT_NID,
3830 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3831 .channel_mode = alc880_asus_modes,
3833 .input_mux = &alc880_capture_source,
3835 [ALC880_UNIWILL_DIG] = {
3836 .mixers = { alc880_asus_mixer },
3837 .init_verbs = { alc880_volume_init_verbs,
3838 alc880_pin_asus_init_verbs },
3839 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3840 .dac_nids = alc880_asus_dac_nids,
3841 .dig_out_nid = ALC880_DIGOUT_NID,
3842 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3843 .channel_mode = alc880_asus_modes,
3845 .input_mux = &alc880_capture_source,
3847 [ALC880_UNIWILL] = {
3848 .mixers = { alc880_uniwill_mixer },
3849 .init_verbs = { alc880_volume_init_verbs,
3850 alc880_uniwill_init_verbs },
3851 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3852 .dac_nids = alc880_asus_dac_nids,
3853 .dig_out_nid = ALC880_DIGOUT_NID,
3854 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3855 .channel_mode = alc880_threestack_modes,
3857 .input_mux = &alc880_capture_source,
3858 .unsol_event = alc880_uniwill_unsol_event,
3859 .init_hook = alc880_uniwill_automute,
3861 [ALC880_UNIWILL_P53] = {
3862 .mixers = { alc880_uniwill_p53_mixer },
3863 .init_verbs = { alc880_volume_init_verbs,
3864 alc880_uniwill_p53_init_verbs },
3865 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3866 .dac_nids = alc880_asus_dac_nids,
3867 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3868 .channel_mode = alc880_threestack_modes,
3869 .input_mux = &alc880_capture_source,
3870 .unsol_event = alc880_uniwill_p53_unsol_event,
3871 .init_hook = alc880_uniwill_p53_hp_automute,
3873 [ALC880_FUJITSU] = {
3874 .mixers = { alc880_fujitsu_mixer },
3875 .init_verbs = { alc880_volume_init_verbs,
3876 alc880_uniwill_p53_init_verbs,
3877 alc880_beep_init_verbs },
3878 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3879 .dac_nids = alc880_dac_nids,
3880 .dig_out_nid = ALC880_DIGOUT_NID,
3881 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3882 .channel_mode = alc880_2_jack_modes,
3883 .input_mux = &alc880_capture_source,
3884 .unsol_event = alc880_uniwill_p53_unsol_event,
3885 .init_hook = alc880_uniwill_p53_hp_automute,
3888 .mixers = { alc880_three_stack_mixer },
3889 .init_verbs = { alc880_volume_init_verbs,
3890 alc880_pin_clevo_init_verbs },
3891 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3892 .dac_nids = alc880_dac_nids,
3894 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3895 .channel_mode = alc880_threestack_modes,
3897 .input_mux = &alc880_capture_source,
3900 .mixers = { alc880_lg_mixer },
3901 .init_verbs = { alc880_volume_init_verbs,
3902 alc880_lg_init_verbs },
3903 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3904 .dac_nids = alc880_lg_dac_nids,
3905 .dig_out_nid = ALC880_DIGOUT_NID,
3906 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3907 .channel_mode = alc880_lg_ch_modes,
3909 .input_mux = &alc880_lg_capture_source,
3910 .unsol_event = alc880_lg_unsol_event,
3911 .init_hook = alc880_lg_automute,
3912 #ifdef CONFIG_SND_HDA_POWER_SAVE
3913 .loopbacks = alc880_lg_loopbacks,
3917 .mixers = { alc880_lg_lw_mixer },
3918 .init_verbs = { alc880_volume_init_verbs,
3919 alc880_lg_lw_init_verbs },
3920 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3921 .dac_nids = alc880_dac_nids,
3922 .dig_out_nid = ALC880_DIGOUT_NID,
3923 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3924 .channel_mode = alc880_lg_lw_modes,
3925 .input_mux = &alc880_lg_lw_capture_source,
3926 .unsol_event = alc880_lg_lw_unsol_event,
3927 .init_hook = alc880_lg_lw_automute,
3929 [ALC880_MEDION_RIM] = {
3930 .mixers = { alc880_medion_rim_mixer },
3931 .init_verbs = { alc880_volume_init_verbs,
3932 alc880_medion_rim_init_verbs,
3933 alc_gpio2_init_verbs },
3934 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3935 .dac_nids = alc880_dac_nids,
3936 .dig_out_nid = ALC880_DIGOUT_NID,
3937 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3938 .channel_mode = alc880_2_jack_modes,
3939 .input_mux = &alc880_medion_rim_capture_source,
3940 .unsol_event = alc880_medion_rim_unsol_event,
3941 .init_hook = alc880_medion_rim_automute,
3943 #ifdef CONFIG_SND_DEBUG
3945 .mixers = { alc880_test_mixer },
3946 .init_verbs = { alc880_test_init_verbs },
3947 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3948 .dac_nids = alc880_test_dac_nids,
3949 .dig_out_nid = ALC880_DIGOUT_NID,
3950 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3951 .channel_mode = alc880_test_modes,
3952 .input_mux = &alc880_test_capture_source,
3958 * Automatic parse of I/O pins from the BIOS configuration
3963 ALC_CTL_WIDGET_MUTE,
3966 static struct snd_kcontrol_new alc880_control_templates[] = {
3967 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3968 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3969 HDA_BIND_MUTE(NULL, 0, 0, 0),
3972 /* add dynamic controls */
3973 static int add_control(struct alc_spec *spec, int type, const char *name,
3976 struct snd_kcontrol_new *knew;
3978 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3979 knew = snd_array_new(&spec->kctls);
3982 *knew = alc880_control_templates[type];
3983 knew->name = kstrdup(name, GFP_KERNEL);
3986 knew->private_value = val;
3990 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3991 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3992 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3993 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3994 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3995 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3996 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3997 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3998 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3999 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4000 #define ALC880_PIN_CD_NID 0x1c
4002 /* fill in the dac_nids table from the parsed pin configuration */
4003 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4004 const struct auto_pin_cfg *cfg)
4010 memset(assigned, 0, sizeof(assigned));
4011 spec->multiout.dac_nids = spec->private_dac_nids;
4013 /* check the pins hardwired to audio widget */
4014 for (i = 0; i < cfg->line_outs; i++) {
4015 nid = cfg->line_out_pins[i];
4016 if (alc880_is_fixed_pin(nid)) {
4017 int idx = alc880_fixed_pin_idx(nid);
4018 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4022 /* left pins can be connect to any audio widget */
4023 for (i = 0; i < cfg->line_outs; i++) {
4024 nid = cfg->line_out_pins[i];
4025 if (alc880_is_fixed_pin(nid))
4027 /* search for an empty channel */
4028 for (j = 0; j < cfg->line_outs; j++) {
4030 spec->multiout.dac_nids[i] =
4031 alc880_idx_to_dac(j);
4037 spec->multiout.num_dacs = cfg->line_outs;
4041 /* add playback controls from the parsed DAC table */
4042 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4043 const struct auto_pin_cfg *cfg)
4046 static const char *chname[4] = {
4047 "Front", "Surround", NULL /*CLFE*/, "Side"
4052 for (i = 0; i < cfg->line_outs; i++) {
4053 if (!spec->multiout.dac_nids[i])
4055 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4058 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4059 "Center Playback Volume",
4060 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4064 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4065 "LFE Playback Volume",
4066 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4070 err = add_control(spec, ALC_CTL_BIND_MUTE,
4071 "Center Playback Switch",
4072 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4076 err = add_control(spec, ALC_CTL_BIND_MUTE,
4077 "LFE Playback Switch",
4078 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4083 sprintf(name, "%s Playback Volume", chname[i]);
4084 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4085 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4089 sprintf(name, "%s Playback Switch", chname[i]);
4090 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4091 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4100 /* add playback controls for speaker and HP outputs */
4101 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4111 if (alc880_is_fixed_pin(pin)) {
4112 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4113 /* specify the DAC as the extra output */
4114 if (!spec->multiout.hp_nid)
4115 spec->multiout.hp_nid = nid;
4117 spec->multiout.extra_out_nid[0] = nid;
4118 /* control HP volume/switch on the output mixer amp */
4119 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4120 sprintf(name, "%s Playback Volume", pfx);
4121 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4122 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4125 sprintf(name, "%s Playback Switch", pfx);
4126 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4127 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4130 } else if (alc880_is_multi_pin(pin)) {
4131 /* set manual connection */
4132 /* we have only a switch on HP-out PIN */
4133 sprintf(name, "%s Playback Switch", pfx);
4134 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4135 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4142 /* create input playback/capture controls for the given pin */
4143 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4144 const char *ctlname,
4145 int idx, hda_nid_t mix_nid)
4150 sprintf(name, "%s Playback Volume", ctlname);
4151 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4152 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4155 sprintf(name, "%s Playback Switch", ctlname);
4156 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4157 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4163 /* create playback/capture controls for input pins */
4164 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4165 const struct auto_pin_cfg *cfg)
4167 struct hda_input_mux *imux = &spec->private_imux[0];
4170 for (i = 0; i < AUTO_PIN_LAST; i++) {
4171 if (alc880_is_input_pin(cfg->input_pins[i])) {
4172 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4173 err = new_analog_input(spec, cfg->input_pins[i],
4174 auto_pin_cfg_labels[i],
4178 imux->items[imux->num_items].label =
4179 auto_pin_cfg_labels[i];
4180 imux->items[imux->num_items].index =
4181 alc880_input_pin_idx(cfg->input_pins[i]);
4188 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4189 unsigned int pin_type)
4191 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4194 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4198 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4199 hda_nid_t nid, int pin_type,
4202 alc_set_pin_output(codec, nid, pin_type);
4203 /* need the manual connection? */
4204 if (alc880_is_multi_pin(nid)) {
4205 struct alc_spec *spec = codec->spec;
4206 int idx = alc880_multi_pin_idx(nid);
4207 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4208 AC_VERB_SET_CONNECT_SEL,
4209 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4213 static int get_pin_type(int line_out_type)
4215 if (line_out_type == AUTO_PIN_HP_OUT)
4221 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4223 struct alc_spec *spec = codec->spec;
4226 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4227 for (i = 0; i < spec->autocfg.line_outs; i++) {
4228 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4229 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4230 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4234 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4236 struct alc_spec *spec = codec->spec;
4239 pin = spec->autocfg.speaker_pins[0];
4240 if (pin) /* connect to front */
4241 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4242 pin = spec->autocfg.hp_pins[0];
4243 if (pin) /* connect to front */
4244 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4247 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4249 struct alc_spec *spec = codec->spec;
4252 for (i = 0; i < AUTO_PIN_LAST; i++) {
4253 hda_nid_t nid = spec->autocfg.input_pins[i];
4254 if (alc880_is_input_pin(nid)) {
4255 snd_hda_codec_write(codec, nid, 0,
4256 AC_VERB_SET_PIN_WIDGET_CONTROL,
4257 i <= AUTO_PIN_FRONT_MIC ?
4258 PIN_VREF80 : PIN_IN);
4259 if (nid != ALC880_PIN_CD_NID)
4260 snd_hda_codec_write(codec, nid, 0,
4261 AC_VERB_SET_AMP_GAIN_MUTE,
4267 /* parse the BIOS configuration and set up the alc_spec */
4268 /* return 1 if successful, 0 if the proper config is not found,
4269 * or a negative error code
4271 static int alc880_parse_auto_config(struct hda_codec *codec)
4273 struct alc_spec *spec = codec->spec;
4275 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4277 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4281 if (!spec->autocfg.line_outs)
4282 return 0; /* can't find valid BIOS pin config */
4284 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4287 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4290 err = alc880_auto_create_extra_out(spec,
4291 spec->autocfg.speaker_pins[0],
4295 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4299 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4303 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4305 /* check multiple SPDIF-out (for recent codecs) */
4306 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4308 err = snd_hda_get_connections(codec,
4309 spec->autocfg.dig_out_pins[i],
4314 spec->multiout.dig_out_nid = dig_nid;
4316 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4317 spec->slave_dig_outs[i - 1] = dig_nid;
4318 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4322 if (spec->autocfg.dig_in_pin)
4323 spec->dig_in_nid = ALC880_DIGIN_NID;
4325 if (spec->kctls.list)
4326 add_mixer(spec, spec->kctls.list);
4328 add_verb(spec, alc880_volume_init_verbs);
4330 spec->num_mux_defs = 1;
4331 spec->input_mux = &spec->private_imux[0];
4333 store_pin_configs(codec);
4337 /* additional initialization for auto-configuration model */
4338 static void alc880_auto_init(struct hda_codec *codec)
4340 struct alc_spec *spec = codec->spec;
4341 alc880_auto_init_multi_out(codec);
4342 alc880_auto_init_extra_out(codec);
4343 alc880_auto_init_analog_input(codec);
4344 if (spec->unsol_event)
4345 alc_inithook(codec);
4348 static void set_capture_mixer(struct alc_spec *spec)
4350 static struct snd_kcontrol_new *caps[3] = {
4355 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4356 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4359 #define set_beep_amp(spec, nid, idx, dir) \
4360 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4363 * OK, here we have finally the patch for ALC880
4366 static int patch_alc880(struct hda_codec *codec)
4368 struct alc_spec *spec;
4372 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4378 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4381 if (board_config < 0) {
4382 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4383 "trying auto-probe from BIOS...\n");
4384 board_config = ALC880_AUTO;
4387 if (board_config == ALC880_AUTO) {
4388 /* automatic parse from the BIOS config */
4389 err = alc880_parse_auto_config(codec);
4395 "hda_codec: Cannot set up configuration "
4396 "from BIOS. Using 3-stack mode...\n");
4397 board_config = ALC880_3ST;
4401 err = snd_hda_attach_beep_device(codec, 0x1);
4407 if (board_config != ALC880_AUTO)
4408 setup_preset(spec, &alc880_presets[board_config]);
4410 spec->stream_name_analog = "ALC880 Analog";
4411 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4412 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4413 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4415 spec->stream_name_digital = "ALC880 Digital";
4416 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4417 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4419 if (!spec->adc_nids && spec->input_mux) {
4420 /* check whether NID 0x07 is valid */
4421 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4423 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4424 if (wcap != AC_WID_AUD_IN) {
4425 spec->adc_nids = alc880_adc_nids_alt;
4426 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4428 spec->adc_nids = alc880_adc_nids;
4429 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4432 set_capture_mixer(spec);
4433 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4435 spec->vmaster_nid = 0x0c;
4437 codec->patch_ops = alc_patch_ops;
4438 if (board_config == ALC880_AUTO)
4439 spec->init_hook = alc880_auto_init;
4440 #ifdef CONFIG_SND_HDA_POWER_SAVE
4441 if (!spec->loopback.amplist)
4442 spec->loopback.amplist = alc880_loopbacks;
4444 codec->proc_widget_hook = print_realtek_coef;
4454 static hda_nid_t alc260_dac_nids[1] = {
4459 static hda_nid_t alc260_adc_nids[1] = {
4464 static hda_nid_t alc260_adc_nids_alt[1] = {
4469 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4470 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4472 static hda_nid_t alc260_dual_adc_nids[2] = {
4477 #define ALC260_DIGOUT_NID 0x03
4478 #define ALC260_DIGIN_NID 0x06
4480 static struct hda_input_mux alc260_capture_source = {
4484 { "Front Mic", 0x1 },
4490 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4491 * headphone jack and the internal CD lines since these are the only pins at
4492 * which audio can appear. For flexibility, also allow the option of
4493 * recording the mixer output on the second ADC (ADC0 doesn't have a
4494 * connection to the mixer output).
4496 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4500 { "Mic/Line", 0x0 },
4502 { "Headphone", 0x2 },
4508 { "Mic/Line", 0x0 },
4510 { "Headphone", 0x2 },
4517 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4518 * the Fujitsu S702x, but jacks are marked differently.
4520 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4527 { "Headphone", 0x5 },
4536 { "Headphone", 0x6 },
4542 /* Maxdata Favorit 100XS */
4543 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4547 { "Line/Mic", 0x0 },
4554 { "Line/Mic", 0x0 },
4562 * This is just place-holder, so there's something for alc_build_pcms to look
4563 * at when it calculates the maximum number of channels. ALC260 has no mixer
4564 * element which allows changing the channel mode, so the verb list is
4567 static struct hda_channel_mode alc260_modes[1] = {
4572 /* Mixer combinations
4574 * basic: base_output + input + pc_beep + capture
4575 * HP: base_output + input + capture_alt
4576 * HP_3013: hp_3013 + input + capture
4577 * fujitsu: fujitsu + capture
4578 * acer: acer + capture
4581 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4582 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4583 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4584 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4585 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4586 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4587 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4591 static struct snd_kcontrol_new alc260_input_mixer[] = {
4592 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4593 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4594 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4595 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4596 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4597 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4598 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4599 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4603 /* update HP, line and mono out pins according to the master switch */
4604 static void alc260_hp_master_update(struct hda_codec *codec,
4605 hda_nid_t hp, hda_nid_t line,
4608 struct alc_spec *spec = codec->spec;
4609 unsigned int val = spec->master_sw ? PIN_HP : 0;
4610 /* change HP and line-out pins */
4611 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4613 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4615 /* mono (speaker) depending on the HP jack sense */
4616 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4617 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4621 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4622 struct snd_ctl_elem_value *ucontrol)
4624 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4625 struct alc_spec *spec = codec->spec;
4626 *ucontrol->value.integer.value = spec->master_sw;
4630 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4631 struct snd_ctl_elem_value *ucontrol)
4633 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4634 struct alc_spec *spec = codec->spec;
4635 int val = !!*ucontrol->value.integer.value;
4636 hda_nid_t hp, line, mono;
4638 if (val == spec->master_sw)
4640 spec->master_sw = val;
4641 hp = (kcontrol->private_value >> 16) & 0xff;
4642 line = (kcontrol->private_value >> 8) & 0xff;
4643 mono = kcontrol->private_value & 0xff;
4644 alc260_hp_master_update(codec, hp, line, mono);
4648 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4650 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4651 .name = "Master Playback Switch",
4652 .info = snd_ctl_boolean_mono_info,
4653 .get = alc260_hp_master_sw_get,
4654 .put = alc260_hp_master_sw_put,
4655 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4657 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4658 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4659 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4660 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4661 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4663 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4667 static struct hda_verb alc260_hp_unsol_verbs[] = {
4668 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4672 static void alc260_hp_automute(struct hda_codec *codec)
4674 struct alc_spec *spec = codec->spec;
4675 unsigned int present;
4677 present = snd_hda_codec_read(codec, 0x10, 0,
4678 AC_VERB_GET_PIN_SENSE, 0);
4679 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4680 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4683 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4685 if ((res >> 26) == ALC880_HP_EVENT)
4686 alc260_hp_automute(codec);
4689 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4691 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4692 .name = "Master Playback Switch",
4693 .info = snd_ctl_boolean_mono_info,
4694 .get = alc260_hp_master_sw_get,
4695 .put = alc260_hp_master_sw_put,
4696 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4698 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4699 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4700 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4701 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4702 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4703 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4704 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4705 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4709 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4710 .ops = &snd_hda_bind_vol,
4712 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4713 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4714 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4719 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4720 .ops = &snd_hda_bind_sw,
4722 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4723 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4728 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4729 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4730 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4731 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4736 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4737 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4741 static void alc260_hp_3013_automute(struct hda_codec *codec)
4743 struct alc_spec *spec = codec->spec;
4744 unsigned int present;
4746 present = snd_hda_codec_read(codec, 0x15, 0,
4747 AC_VERB_GET_PIN_SENSE, 0);
4748 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4749 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4752 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4755 if ((res >> 26) == ALC880_HP_EVENT)
4756 alc260_hp_3013_automute(codec);
4759 static void alc260_hp_3012_automute(struct hda_codec *codec)
4761 unsigned int present, bits;
4763 present = snd_hda_codec_read(codec, 0x10, 0,
4764 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4766 bits = present ? 0 : PIN_OUT;
4767 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4769 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4771 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4775 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4778 if ((res >> 26) == ALC880_HP_EVENT)
4779 alc260_hp_3012_automute(codec);
4782 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4783 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4785 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4786 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4787 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4788 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4789 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4790 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4791 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4792 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4793 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4794 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4795 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4799 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4800 * versions of the ALC260 don't act on requests to enable mic bias from NID
4801 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4802 * datasheet doesn't mention this restriction. At this stage it's not clear
4803 * whether this behaviour is intentional or is a hardware bug in chip
4804 * revisions available in early 2006. Therefore for now allow the
4805 * "Headphone Jack Mode" control to span all choices, but if it turns out
4806 * that the lack of mic bias for this NID is intentional we could change the
4807 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4809 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4810 * don't appear to make the mic bias available from the "line" jack, even
4811 * though the NID used for this jack (0x14) can supply it. The theory is
4812 * that perhaps Acer have included blocking capacitors between the ALC260
4813 * and the output jack. If this turns out to be the case for all such
4814 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4815 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4817 * The C20x Tablet series have a mono internal speaker which is controlled
4818 * via the chip's Mono sum widget and pin complex, so include the necessary
4819 * controls for such models. On models without a "mono speaker" the control
4820 * won't do anything.
4822 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4823 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4824 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4825 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4826 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4828 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4830 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4831 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4833 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4834 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4835 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4836 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4837 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4841 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4843 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4844 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4845 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4846 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4847 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4848 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4849 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4853 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4854 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4856 static struct snd_kcontrol_new alc260_will_mixer[] = {
4857 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4858 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4860 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4861 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4862 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4863 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4864 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4865 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4866 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4870 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4871 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4873 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4874 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4875 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4877 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4878 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4879 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4880 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4881 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4882 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4883 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4888 * initialization verbs
4890 static struct hda_verb alc260_init_verbs[] = {
4891 /* Line In pin widget for input */
4892 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4893 /* CD pin widget for input */
4894 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4895 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4896 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4897 /* Mic2 (front panel) pin widget for input and vref at 80% */
4898 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4899 /* LINE-2 is used for line-out in rear */
4900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4901 /* select line-out */
4902 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4904 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4906 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4908 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4909 /* mute capture amp left and right */
4910 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4911 /* set connection select to line in (default select for this ADC) */
4912 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4913 /* mute capture amp left and right */
4914 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4915 /* set connection select to line in (default select for this ADC) */
4916 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4917 /* set vol=0 Line-Out mixer amp left and right */
4918 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4919 /* unmute pin widget amp left and right (no gain on this amp) */
4920 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4921 /* set vol=0 HP mixer amp left and right */
4922 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4923 /* unmute pin widget amp left and right (no gain on this amp) */
4924 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4925 /* set vol=0 Mono mixer amp left and right */
4926 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4927 /* unmute pin widget amp left and right (no gain on this amp) */
4928 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4929 /* unmute LINE-2 out pin */
4930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4931 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4934 /* mute analog inputs */
4935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4940 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4941 /* mute Front out path */
4942 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4943 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4944 /* mute Headphone out path */
4945 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4946 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4947 /* mute Mono out path */
4948 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4949 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4953 #if 0 /* should be identical with alc260_init_verbs? */
4954 static struct hda_verb alc260_hp_init_verbs[] = {
4955 /* Headphone and output */
4956 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4958 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4959 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4960 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4961 /* Mic2 (front panel) pin widget for input and vref at 80% */
4962 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4963 /* Line In pin widget for input */
4964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4965 /* Line-2 pin widget for output */
4966 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4967 /* CD pin widget for input */
4968 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4969 /* unmute amp left and right */
4970 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4971 /* set connection select to line in (default select for this ADC) */
4972 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4973 /* unmute Line-Out mixer amp left and right (volume = 0) */
4974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4975 /* mute pin widget amp left and right (no gain on this amp) */
4976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4977 /* unmute HP mixer amp left and right (volume = 0) */
4978 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4979 /* mute pin widget amp left and right (no gain on this amp) */
4980 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4981 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4984 /* mute analog inputs */
4985 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4990 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4991 /* Unmute Front out path */
4992 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4993 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4994 /* Unmute Headphone out path */
4995 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4997 /* Unmute Mono out path */
4998 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4999 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5004 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5005 /* Line out and output */
5006 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5008 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5009 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5010 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5011 /* Mic2 (front panel) pin widget for input and vref at 80% */
5012 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5013 /* Line In pin widget for input */
5014 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5015 /* Headphone pin widget for output */
5016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5017 /* CD pin widget for input */
5018 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5019 /* unmute amp left and right */
5020 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5021 /* set connection select to line in (default select for this ADC) */
5022 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5023 /* unmute Line-Out mixer amp left and right (volume = 0) */
5024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5025 /* mute pin widget amp left and right (no gain on this amp) */
5026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5027 /* unmute HP mixer amp left and right (volume = 0) */
5028 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5029 /* mute pin widget amp left and right (no gain on this amp) */
5030 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5031 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5034 /* mute analog inputs */
5035 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5036 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5037 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5038 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5039 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5040 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5041 /* Unmute Front out path */
5042 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5043 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5044 /* Unmute Headphone out path */
5045 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5046 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5047 /* Unmute Mono out path */
5048 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5049 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5053 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5054 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5055 * audio = 0x16, internal speaker = 0x10.
5057 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5058 /* Disable all GPIOs */
5059 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5060 /* Internal speaker is connected to headphone pin */
5061 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5062 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5063 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5064 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5065 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5066 /* Ensure all other unused pins are disabled and muted. */
5067 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5068 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5069 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5070 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5071 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5072 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5073 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5076 /* Disable digital (SPDIF) pins */
5077 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5078 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5080 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5081 * when acting as an output.
5083 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5085 /* Start with output sum widgets muted and their output gains at min */
5086 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5087 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5088 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5089 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5090 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5092 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5093 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5094 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5096 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5097 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5098 /* Unmute Line1 pin widget output buffer since it starts as an output.
5099 * If the pin mode is changed by the user the pin mode control will
5100 * take care of enabling the pin's input/output buffers as needed.
5101 * Therefore there's no need to enable the input buffer at this
5104 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5105 /* Unmute input buffer of pin widget used for Line-in (no equiv
5108 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5110 /* Mute capture amp left and right */
5111 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5112 /* Set ADC connection select to match default mixer setting - line
5115 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5117 /* Do the same for the second ADC: mute capture input amp and
5118 * set ADC connection to line in (on mic1 pin)
5120 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5121 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5123 /* Mute all inputs to mixer widget (even unconnected ones) */
5124 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5125 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5126 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5136 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5137 * similar laptops (adapted from Fujitsu init verbs).
5139 static struct hda_verb alc260_acer_init_verbs[] = {
5140 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5141 * the headphone jack. Turn this on and rely on the standard mute
5142 * methods whenever the user wants to turn these outputs off.
5144 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5145 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5146 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5147 /* Internal speaker/Headphone jack is connected to Line-out pin */
5148 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5149 /* Internal microphone/Mic jack is connected to Mic1 pin */
5150 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5151 /* Line In jack is connected to Line1 pin */
5152 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5153 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5154 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5155 /* Ensure all other unused pins are disabled and muted. */
5156 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5157 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5158 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5159 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5160 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5161 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5162 /* Disable digital (SPDIF) pins */
5163 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5164 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5166 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5167 * bus when acting as outputs.
5169 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5170 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5172 /* Start with output sum widgets muted and their output gains at min */
5173 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5174 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5175 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5176 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5177 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5178 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5179 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5180 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5181 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5183 /* Unmute Line-out pin widget amp left and right
5184 * (no equiv mixer ctrl)
5186 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5187 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5188 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5189 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5190 * inputs. If the pin mode is changed by the user the pin mode control
5191 * will take care of enabling the pin's input/output buffers as needed.
5192 * Therefore there's no need to enable the input buffer at this
5195 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5196 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5198 /* Mute capture amp left and right */
5199 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5200 /* Set ADC connection select to match default mixer setting - mic
5203 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5205 /* Do similar with the second ADC: mute capture input amp and
5206 * set ADC connection to mic to match ALSA's default state.
5208 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5209 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5211 /* Mute all inputs to mixer widget (even unconnected ones) */
5212 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5213 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5214 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5215 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5216 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5217 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5219 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5224 /* Initialisation sequence for Maxdata Favorit 100XS
5225 * (adapted from Acer init verbs).
5227 static struct hda_verb alc260_favorit100_init_verbs[] = {
5228 /* GPIO 0 enables the output jack.
5229 * Turn this on and rely on the standard mute
5230 * methods whenever the user wants to turn these outputs off.
5232 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5233 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5234 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5235 /* Line/Mic input jack is connected to Mic1 pin */
5236 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5237 /* Ensure all other unused pins are disabled and muted. */
5238 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5239 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5240 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5241 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5242 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5243 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5244 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5245 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5248 /* Disable digital (SPDIF) pins */
5249 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5250 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5252 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5253 * bus when acting as outputs.
5255 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5256 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5258 /* Start with output sum widgets muted and their output gains at min */
5259 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5260 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5261 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5262 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5263 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5264 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5265 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5266 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5267 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5269 /* Unmute Line-out pin widget amp left and right
5270 * (no equiv mixer ctrl)
5272 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5273 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5274 * inputs. If the pin mode is changed by the user the pin mode control
5275 * will take care of enabling the pin's input/output buffers as needed.
5276 * Therefore there's no need to enable the input buffer at this
5279 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5281 /* Mute capture amp left and right */
5282 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5283 /* Set ADC connection select to match default mixer setting - mic
5286 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5288 /* Do similar with the second ADC: mute capture input amp and
5289 * set ADC connection to mic to match ALSA's default state.
5291 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5292 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5294 /* Mute all inputs to mixer widget (even unconnected ones) */
5295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5296 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5298 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5299 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5300 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5301 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5302 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5307 static struct hda_verb alc260_will_verbs[] = {
5308 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5309 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5310 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5311 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5312 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5313 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5317 static struct hda_verb alc260_replacer_672v_verbs[] = {
5318 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5319 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5320 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5322 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5323 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5324 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5326 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5330 /* toggle speaker-output according to the hp-jack state */
5331 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5333 unsigned int present;
5335 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5336 present = snd_hda_codec_read(codec, 0x0f, 0,
5337 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5339 snd_hda_codec_write_cache(codec, 0x01, 0,
5340 AC_VERB_SET_GPIO_DATA, 1);
5341 snd_hda_codec_write_cache(codec, 0x0f, 0,
5342 AC_VERB_SET_PIN_WIDGET_CONTROL,
5345 snd_hda_codec_write_cache(codec, 0x01, 0,
5346 AC_VERB_SET_GPIO_DATA, 0);
5347 snd_hda_codec_write_cache(codec, 0x0f, 0,
5348 AC_VERB_SET_PIN_WIDGET_CONTROL,
5353 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5356 if ((res >> 26) == ALC880_HP_EVENT)
5357 alc260_replacer_672v_automute(codec);
5360 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5361 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5362 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5363 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5364 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5365 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5367 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5368 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5369 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5370 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5374 /* Test configuration for debugging, modelled after the ALC880 test
5377 #ifdef CONFIG_SND_DEBUG
5378 static hda_nid_t alc260_test_dac_nids[1] = {
5381 static hda_nid_t alc260_test_adc_nids[2] = {
5384 /* For testing the ALC260, each input MUX needs its own definition since
5385 * the signal assignments are different. This assumes that the first ADC
5388 static struct hda_input_mux alc260_test_capture_sources[2] = {
5392 { "MIC1 pin", 0x0 },
5393 { "MIC2 pin", 0x1 },
5394 { "LINE1 pin", 0x2 },
5395 { "LINE2 pin", 0x3 },
5397 { "LINE-OUT pin", 0x5 },
5398 { "HP-OUT pin", 0x6 },
5404 { "MIC1 pin", 0x0 },
5405 { "MIC2 pin", 0x1 },
5406 { "LINE1 pin", 0x2 },
5407 { "LINE2 pin", 0x3 },
5410 { "LINE-OUT pin", 0x6 },
5411 { "HP-OUT pin", 0x7 },
5415 static struct snd_kcontrol_new alc260_test_mixer[] = {
5416 /* Output driver widgets */
5417 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5418 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5419 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5420 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5421 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5422 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5424 /* Modes for retasking pin widgets
5425 * Note: the ALC260 doesn't seem to act on requests to enable mic
5426 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5427 * mention this restriction. At this stage it's not clear whether
5428 * this behaviour is intentional or is a hardware bug in chip
5429 * revisions available at least up until early 2006. Therefore for
5430 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5431 * choices, but if it turns out that the lack of mic bias for these
5432 * NIDs is intentional we could change their modes from
5433 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5435 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5436 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5437 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5438 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5439 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5440 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5442 /* Loopback mixer controls */
5443 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5444 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5445 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5446 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5447 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5448 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5449 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5450 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5451 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5452 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5453 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5454 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5455 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5456 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5458 /* Controls for GPIO pins, assuming they are configured as outputs */
5459 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5460 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5461 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5462 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5464 /* Switches to allow the digital IO pins to be enabled. The datasheet
5465 * is ambigious as to which NID is which; testing on laptops which
5466 * make this output available should provide clarification.
5468 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5469 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5471 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5472 * this output to turn on an external amplifier.
5474 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5475 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5479 static struct hda_verb alc260_test_init_verbs[] = {
5480 /* Enable all GPIOs as outputs with an initial value of 0 */
5481 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5482 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5483 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5485 /* Enable retasking pins as output, initially without power amp */
5486 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5487 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5489 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5490 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5491 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5493 /* Disable digital (SPDIF) pins initially, but users can enable
5494 * them via a mixer switch. In the case of SPDIF-out, this initverb
5495 * payload also sets the generation to 0, output to be in "consumer"
5496 * PCM format, copyright asserted, no pre-emphasis and no validity
5499 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5500 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5502 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5503 * OUT1 sum bus when acting as an output.
5505 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5506 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5507 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5508 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5510 /* Start with output sum widgets muted and their output gains at min */
5511 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5512 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5513 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5514 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5515 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5516 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5517 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5518 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5519 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5521 /* Unmute retasking pin widget output buffers since the default
5522 * state appears to be output. As the pin mode is changed by the
5523 * user the pin mode control will take care of enabling the pin's
5524 * input/output buffers as needed.
5526 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5527 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5529 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5530 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5531 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5532 /* Also unmute the mono-out pin widget */
5533 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5535 /* Mute capture amp left and right */
5536 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5537 /* Set ADC connection select to match default mixer setting (mic1
5540 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5542 /* Do the same for the second ADC: mute capture input amp and
5543 * set ADC connection to mic1 pin
5545 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5546 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5548 /* Mute all inputs to mixer widget (even unconnected ones) */
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5562 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5563 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5565 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5566 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5569 * for BIOS auto-configuration
5572 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5573 const char *pfx, int *vol_bits)
5576 unsigned long vol_val, sw_val;
5580 if (nid >= 0x0f && nid < 0x11) {
5581 nid_vol = nid - 0x7;
5582 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5583 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5584 } else if (nid == 0x11) {
5585 nid_vol = nid - 0x7;
5586 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5587 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5588 } else if (nid >= 0x12 && nid <= 0x15) {
5590 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5591 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5595 if (!(*vol_bits & (1 << nid_vol))) {
5596 /* first control for the volume widget */
5597 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5598 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5601 *vol_bits |= (1 << nid_vol);
5603 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5604 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5610 /* add playback controls from the parsed DAC table */
5611 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5612 const struct auto_pin_cfg *cfg)
5618 spec->multiout.num_dacs = 1;
5619 spec->multiout.dac_nids = spec->private_dac_nids;
5620 spec->multiout.dac_nids[0] = 0x02;
5622 nid = cfg->line_out_pins[0];
5624 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5629 nid = cfg->speaker_pins[0];
5631 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5636 nid = cfg->hp_pins[0];
5638 err = alc260_add_playback_controls(spec, nid, "Headphone",
5646 /* create playback/capture controls for input pins */
5647 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5648 const struct auto_pin_cfg *cfg)
5650 struct hda_input_mux *imux = &spec->private_imux[0];
5653 for (i = 0; i < AUTO_PIN_LAST; i++) {
5654 if (cfg->input_pins[i] >= 0x12) {
5655 idx = cfg->input_pins[i] - 0x12;
5656 err = new_analog_input(spec, cfg->input_pins[i],
5657 auto_pin_cfg_labels[i], idx,
5661 imux->items[imux->num_items].label =
5662 auto_pin_cfg_labels[i];
5663 imux->items[imux->num_items].index = idx;
5666 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5667 idx = cfg->input_pins[i] - 0x09;
5668 err = new_analog_input(spec, cfg->input_pins[i],
5669 auto_pin_cfg_labels[i], idx,
5673 imux->items[imux->num_items].label =
5674 auto_pin_cfg_labels[i];
5675 imux->items[imux->num_items].index = idx;
5682 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5683 hda_nid_t nid, int pin_type,
5686 alc_set_pin_output(codec, nid, pin_type);
5687 /* need the manual connection? */
5689 int idx = nid - 0x12;
5690 snd_hda_codec_write(codec, idx + 0x0b, 0,
5691 AC_VERB_SET_CONNECT_SEL, sel_idx);
5695 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5697 struct alc_spec *spec = codec->spec;
5700 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5701 nid = spec->autocfg.line_out_pins[0];
5703 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5704 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5707 nid = spec->autocfg.speaker_pins[0];
5709 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5711 nid = spec->autocfg.hp_pins[0];
5713 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5716 #define ALC260_PIN_CD_NID 0x16
5717 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5719 struct alc_spec *spec = codec->spec;
5722 for (i = 0; i < AUTO_PIN_LAST; i++) {
5723 hda_nid_t nid = spec->autocfg.input_pins[i];
5725 snd_hda_codec_write(codec, nid, 0,
5726 AC_VERB_SET_PIN_WIDGET_CONTROL,
5727 i <= AUTO_PIN_FRONT_MIC ?
5728 PIN_VREF80 : PIN_IN);
5729 if (nid != ALC260_PIN_CD_NID)
5730 snd_hda_codec_write(codec, nid, 0,
5731 AC_VERB_SET_AMP_GAIN_MUTE,
5738 * generic initialization of ADC, input mixers and output mixers
5740 static struct hda_verb alc260_volume_init_verbs[] = {
5742 * Unmute ADC0-1 and set the default input to mic-in
5744 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5745 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5746 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5747 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5749 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5751 * Note: PASD motherboards uses the Line In 2 as the input for
5752 * front panel mic (mic 2)
5754 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5755 /* mute analog inputs */
5756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5757 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5760 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5763 * Set up output mixers (0x08 - 0x0a)
5765 /* set vol=0 to output mixers */
5766 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5767 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5768 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5769 /* set up input amps for analog loopback */
5770 /* Amp Indices: DAC = 0, mixer = 1 */
5771 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5772 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5773 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5774 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5775 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5776 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5781 static int alc260_parse_auto_config(struct hda_codec *codec)
5783 struct alc_spec *spec = codec->spec;
5785 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5787 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5791 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5794 if (!spec->kctls.list)
5795 return 0; /* can't find valid BIOS pin config */
5796 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5800 spec->multiout.max_channels = 2;
5802 if (spec->autocfg.dig_outs)
5803 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5804 if (spec->kctls.list)
5805 add_mixer(spec, spec->kctls.list);
5807 add_verb(spec, alc260_volume_init_verbs);
5809 spec->num_mux_defs = 1;
5810 spec->input_mux = &spec->private_imux[0];
5812 store_pin_configs(codec);
5816 /* additional initialization for auto-configuration model */
5817 static void alc260_auto_init(struct hda_codec *codec)
5819 struct alc_spec *spec = codec->spec;
5820 alc260_auto_init_multi_out(codec);
5821 alc260_auto_init_analog_input(codec);
5822 if (spec->unsol_event)
5823 alc_inithook(codec);
5826 #ifdef CONFIG_SND_HDA_POWER_SAVE
5827 static struct hda_amp_list alc260_loopbacks[] = {
5828 { 0x07, HDA_INPUT, 0 },
5829 { 0x07, HDA_INPUT, 1 },
5830 { 0x07, HDA_INPUT, 2 },
5831 { 0x07, HDA_INPUT, 3 },
5832 { 0x07, HDA_INPUT, 4 },
5838 * ALC260 configurations
5840 static const char *alc260_models[ALC260_MODEL_LAST] = {
5841 [ALC260_BASIC] = "basic",
5843 [ALC260_HP_3013] = "hp-3013",
5844 [ALC260_HP_DC7600] = "hp-dc7600",
5845 [ALC260_FUJITSU_S702X] = "fujitsu",
5846 [ALC260_ACER] = "acer",
5847 [ALC260_WILL] = "will",
5848 [ALC260_REPLACER_672V] = "replacer",
5849 [ALC260_FAVORIT100] = "favorit100",
5850 #ifdef CONFIG_SND_DEBUG
5851 [ALC260_TEST] = "test",
5853 [ALC260_AUTO] = "auto",
5856 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5857 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5858 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5859 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5860 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5861 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5862 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5863 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5864 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5865 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5866 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5867 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5868 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5869 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5870 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5871 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5872 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5873 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5874 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5875 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5879 static struct alc_config_preset alc260_presets[] = {
5881 .mixers = { alc260_base_output_mixer,
5882 alc260_input_mixer },
5883 .init_verbs = { alc260_init_verbs },
5884 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5885 .dac_nids = alc260_dac_nids,
5886 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5887 .adc_nids = alc260_adc_nids,
5888 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5889 .channel_mode = alc260_modes,
5890 .input_mux = &alc260_capture_source,
5893 .mixers = { alc260_hp_output_mixer,
5894 alc260_input_mixer },
5895 .init_verbs = { alc260_init_verbs,
5896 alc260_hp_unsol_verbs },
5897 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5898 .dac_nids = alc260_dac_nids,
5899 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5900 .adc_nids = alc260_adc_nids_alt,
5901 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5902 .channel_mode = alc260_modes,
5903 .input_mux = &alc260_capture_source,
5904 .unsol_event = alc260_hp_unsol_event,
5905 .init_hook = alc260_hp_automute,
5907 [ALC260_HP_DC7600] = {
5908 .mixers = { alc260_hp_dc7600_mixer,
5909 alc260_input_mixer },
5910 .init_verbs = { alc260_init_verbs,
5911 alc260_hp_dc7600_verbs },
5912 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5913 .dac_nids = alc260_dac_nids,
5914 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5915 .adc_nids = alc260_adc_nids_alt,
5916 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5917 .channel_mode = alc260_modes,
5918 .input_mux = &alc260_capture_source,
5919 .unsol_event = alc260_hp_3012_unsol_event,
5920 .init_hook = alc260_hp_3012_automute,
5922 [ALC260_HP_3013] = {
5923 .mixers = { alc260_hp_3013_mixer,
5924 alc260_input_mixer },
5925 .init_verbs = { alc260_hp_3013_init_verbs,
5926 alc260_hp_3013_unsol_verbs },
5927 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5928 .dac_nids = alc260_dac_nids,
5929 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5930 .adc_nids = alc260_adc_nids_alt,
5931 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5932 .channel_mode = alc260_modes,
5933 .input_mux = &alc260_capture_source,
5934 .unsol_event = alc260_hp_3013_unsol_event,
5935 .init_hook = alc260_hp_3013_automute,
5937 [ALC260_FUJITSU_S702X] = {
5938 .mixers = { alc260_fujitsu_mixer },
5939 .init_verbs = { alc260_fujitsu_init_verbs },
5940 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5941 .dac_nids = alc260_dac_nids,
5942 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5943 .adc_nids = alc260_dual_adc_nids,
5944 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5945 .channel_mode = alc260_modes,
5946 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5947 .input_mux = alc260_fujitsu_capture_sources,
5950 .mixers = { alc260_acer_mixer },
5951 .init_verbs = { alc260_acer_init_verbs },
5952 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5953 .dac_nids = alc260_dac_nids,
5954 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5955 .adc_nids = alc260_dual_adc_nids,
5956 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5957 .channel_mode = alc260_modes,
5958 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5959 .input_mux = alc260_acer_capture_sources,
5961 [ALC260_FAVORIT100] = {
5962 .mixers = { alc260_favorit100_mixer },
5963 .init_verbs = { alc260_favorit100_init_verbs },
5964 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5965 .dac_nids = alc260_dac_nids,
5966 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5967 .adc_nids = alc260_dual_adc_nids,
5968 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5969 .channel_mode = alc260_modes,
5970 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
5971 .input_mux = alc260_favorit100_capture_sources,
5974 .mixers = { alc260_will_mixer },
5975 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5976 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5977 .dac_nids = alc260_dac_nids,
5978 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5979 .adc_nids = alc260_adc_nids,
5980 .dig_out_nid = ALC260_DIGOUT_NID,
5981 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5982 .channel_mode = alc260_modes,
5983 .input_mux = &alc260_capture_source,
5985 [ALC260_REPLACER_672V] = {
5986 .mixers = { alc260_replacer_672v_mixer },
5987 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5988 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5989 .dac_nids = alc260_dac_nids,
5990 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5991 .adc_nids = alc260_adc_nids,
5992 .dig_out_nid = ALC260_DIGOUT_NID,
5993 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5994 .channel_mode = alc260_modes,
5995 .input_mux = &alc260_capture_source,
5996 .unsol_event = alc260_replacer_672v_unsol_event,
5997 .init_hook = alc260_replacer_672v_automute,
5999 #ifdef CONFIG_SND_DEBUG
6001 .mixers = { alc260_test_mixer },
6002 .init_verbs = { alc260_test_init_verbs },
6003 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6004 .dac_nids = alc260_test_dac_nids,
6005 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6006 .adc_nids = alc260_test_adc_nids,
6007 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6008 .channel_mode = alc260_modes,
6009 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6010 .input_mux = alc260_test_capture_sources,
6015 static int patch_alc260(struct hda_codec *codec)
6017 struct alc_spec *spec;
6018 int err, board_config;
6020 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6026 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6029 if (board_config < 0) {
6030 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
6031 "trying auto-probe from BIOS...\n");
6032 board_config = ALC260_AUTO;
6035 if (board_config == ALC260_AUTO) {
6036 /* automatic parse from the BIOS config */
6037 err = alc260_parse_auto_config(codec);
6043 "hda_codec: Cannot set up configuration "
6044 "from BIOS. Using base mode...\n");
6045 board_config = ALC260_BASIC;
6049 err = snd_hda_attach_beep_device(codec, 0x1);
6055 if (board_config != ALC260_AUTO)
6056 setup_preset(spec, &alc260_presets[board_config]);
6058 spec->stream_name_analog = "ALC260 Analog";
6059 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6060 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6062 spec->stream_name_digital = "ALC260 Digital";
6063 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6064 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6066 if (!spec->adc_nids && spec->input_mux) {
6067 /* check whether NID 0x04 is valid */
6068 unsigned int wcap = get_wcaps(codec, 0x04);
6069 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6071 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6072 spec->adc_nids = alc260_adc_nids_alt;
6073 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6075 spec->adc_nids = alc260_adc_nids;
6076 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6079 set_capture_mixer(spec);
6080 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6082 spec->vmaster_nid = 0x08;
6084 codec->patch_ops = alc_patch_ops;
6085 if (board_config == ALC260_AUTO)
6086 spec->init_hook = alc260_auto_init;
6087 #ifdef CONFIG_SND_HDA_POWER_SAVE
6088 if (!spec->loopback.amplist)
6089 spec->loopback.amplist = alc260_loopbacks;
6091 codec->proc_widget_hook = print_realtek_coef;
6100 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6101 * configuration. Each pin widget can choose any input DACs and a mixer.
6102 * Each ADC is connected from a mixer of all inputs. This makes possible
6103 * 6-channel independent captures.
6105 * In addition, an independent DAC for the multi-playback (not used in this
6108 #define ALC882_DIGOUT_NID 0x06
6109 #define ALC882_DIGIN_NID 0x0a
6111 static struct hda_channel_mode alc882_ch_modes[1] = {
6115 static hda_nid_t alc882_dac_nids[4] = {
6116 /* front, rear, clfe, rear_surr */
6117 0x02, 0x03, 0x04, 0x05
6120 /* identical with ALC880 */
6121 #define alc882_adc_nids alc880_adc_nids
6122 #define alc882_adc_nids_alt alc880_adc_nids_alt
6124 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6125 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6128 /* FIXME: should be a matrix-type input source selection */
6130 static struct hda_input_mux alc882_capture_source = {
6134 { "Front Mic", 0x1 },
6142 static struct hda_verb alc882_3ST_ch2_init[] = {
6143 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6144 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6145 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6146 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6153 static struct hda_verb alc882_3ST_ch6_init[] = {
6154 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6155 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6156 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6157 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6158 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6159 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6163 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6164 { 2, alc882_3ST_ch2_init },
6165 { 6, alc882_3ST_ch6_init },
6171 static struct hda_verb alc882_sixstack_ch6_init[] = {
6172 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6173 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6174 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6175 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6182 static struct hda_verb alc882_sixstack_ch8_init[] = {
6183 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6184 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6185 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6186 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6190 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6191 { 6, alc882_sixstack_ch6_init },
6192 { 8, alc882_sixstack_ch8_init },
6196 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6202 static struct hda_verb alc885_mbp_ch2_init[] = {
6203 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6204 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6205 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6212 static struct hda_verb alc885_mbp_ch6_init[] = {
6213 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6214 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6215 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6216 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6217 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6221 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6222 { 2, alc885_mbp_ch2_init },
6223 { 6, alc885_mbp_ch6_init },
6227 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6228 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6230 static struct snd_kcontrol_new alc882_base_mixer[] = {
6231 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6232 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6233 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6234 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6235 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6236 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6237 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6238 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6239 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6240 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6241 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6242 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6243 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6244 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6245 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6247 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6248 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6249 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6250 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6251 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6255 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6256 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6257 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6258 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6259 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6260 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6261 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6263 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6264 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6268 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6269 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6270 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6271 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6272 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6273 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6274 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6276 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6277 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6281 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6282 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6283 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6284 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6285 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6286 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6287 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6288 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6291 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6292 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6293 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6294 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6298 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6299 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6301 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6302 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6303 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6304 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6305 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6306 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6307 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6308 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6309 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6310 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6311 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6312 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6313 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6314 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6318 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6319 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6320 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6322 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6323 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6327 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6332 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6335 .name = "Channel Mode",
6336 .info = alc_ch_mode_info,
6337 .get = alc_ch_mode_get,
6338 .put = alc_ch_mode_put,
6343 static struct hda_verb alc882_init_verbs[] = {
6344 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6350 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6351 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6353 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6361 /* Front Pin: output 0 (0x0c) */
6362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6363 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6364 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6365 /* Rear Pin: output 1 (0x0d) */
6366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6368 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6369 /* CLFE Pin: output 2 (0x0e) */
6370 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6371 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6372 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6373 /* Side Pin: output 3 (0x0f) */
6374 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6375 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6376 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6377 /* Mic (rear) pin: input vref at 80% */
6378 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6379 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6380 /* Front Mic pin: input vref at 80% */
6381 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6382 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6383 /* Line In pin: input */
6384 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6385 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6386 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6387 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6388 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6389 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6390 /* CD pin widget for input */
6391 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6393 /* FIXME: use matrix-type input source selection */
6394 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6395 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6407 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6408 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6410 /* ADC1: mute amp left and right */
6411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6412 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6413 /* ADC2: mute amp left and right */
6414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6415 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6416 /* ADC3: mute amp left and right */
6417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6418 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6423 static struct hda_verb alc882_eapd_verbs[] = {
6424 /* change to EAPD mode */
6425 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6426 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6431 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6433 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6434 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6435 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6436 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6437 /* FIXME: this looks suspicious...
6438 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6439 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6444 static struct hda_verb alc882_macpro_init_verbs[] = {
6445 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6446 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6449 /* Front Pin: output 0 (0x0c) */
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, 0x00},
6453 /* Front Mic pin: input vref at 80% */
6454 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6455 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6456 /* Speaker: output */
6457 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6458 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6459 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6460 /* Headphone output (output 0 - 0x0c) */
6461 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6462 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6463 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6465 /* FIXME: use matrix-type input source selection */
6466 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6467 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6482 /* ADC1: mute amp left and right */
6483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6484 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6485 /* ADC2: mute amp left and right */
6486 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6487 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6488 /* ADC3: mute amp left and right */
6489 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6490 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6495 /* Macbook Pro rev3 */
6496 static struct hda_verb alc885_mbp3_init_verbs[] = {
6497 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6498 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6503 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6505 /* Front Pin: output 0 (0x0c) */
6506 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6508 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6509 /* HP Pin: output 0 (0x0d) */
6510 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6511 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6512 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6513 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6514 /* Mic (rear) pin: input vref at 80% */
6515 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6516 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6517 /* Front Mic pin: input vref at 80% */
6518 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6519 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6520 /* Line In pin: use output 1 when in LineOut mode */
6521 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6522 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6523 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6525 /* FIXME: use matrix-type input source selection */
6526 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6527 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6533 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6534 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6535 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6536 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6538 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6539 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6540 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6541 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6542 /* ADC1: mute amp left and right */
6543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6544 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6545 /* ADC2: mute amp left and right */
6546 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6547 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6548 /* ADC3: mute amp left and right */
6549 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6550 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6555 /* iMac 24 mixer. */
6556 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6557 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6558 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6562 /* iMac 24 init verbs. */
6563 static struct hda_verb alc885_imac24_init_verbs[] = {
6564 /* Internal speakers: output 0 (0x0c) */
6565 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6566 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6567 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6568 /* Internal speakers: output 0 (0x0c) */
6569 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6570 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6571 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6572 /* Headphone: output 0 (0x0c) */
6573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6574 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6575 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6576 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6577 /* Front Mic: input vref at 80% */
6578 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6579 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6583 /* Toggle speaker-output according to the hp-jack state */
6584 static void alc885_imac24_automute(struct hda_codec *codec)
6586 unsigned int present;
6588 present = snd_hda_codec_read(codec, 0x14, 0,
6589 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6590 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6591 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6592 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6593 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6596 /* Processes unsolicited events. */
6597 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6600 /* Headphone insertion or removal. */
6601 if ((res >> 26) == ALC880_HP_EVENT)
6602 alc885_imac24_automute(codec);
6605 static void alc885_mbp3_automute(struct hda_codec *codec)
6607 unsigned int present;
6609 present = snd_hda_codec_read(codec, 0x15, 0,
6610 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6611 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6612 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6613 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6614 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6617 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6620 /* Headphone insertion or removal. */
6621 if ((res >> 26) == ALC880_HP_EVENT)
6622 alc885_mbp3_automute(codec);
6626 static struct hda_verb alc882_targa_verbs[] = {
6627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6631 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6633 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6634 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6635 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6637 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6638 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6639 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6640 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6644 /* toggle speaker-output according to the hp-jack state */
6645 static void alc882_targa_automute(struct hda_codec *codec)
6647 unsigned int present;
6649 present = snd_hda_codec_read(codec, 0x14, 0,
6650 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6651 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6652 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6653 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6657 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6659 /* Looks like the unsol event is incompatible with the standard
6660 * definition. 4bit tag is placed at 26 bit!
6662 if (((res >> 26) == ALC880_HP_EVENT)) {
6663 alc882_targa_automute(codec);
6667 static struct hda_verb alc882_asus_a7j_verbs[] = {
6668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6671 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6673 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6675 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6677 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6679 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6680 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6681 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6685 static struct hda_verb alc882_asus_a7m_verbs[] = {
6686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6691 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6693 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6694 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6695 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6697 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6698 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6699 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6703 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6705 unsigned int gpiostate, gpiomask, gpiodir;
6707 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6708 AC_VERB_GET_GPIO_DATA, 0);
6711 gpiostate |= (1 << pin);
6713 gpiostate &= ~(1 << pin);
6715 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6716 AC_VERB_GET_GPIO_MASK, 0);
6717 gpiomask |= (1 << pin);
6719 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6720 AC_VERB_GET_GPIO_DIRECTION, 0);
6721 gpiodir |= (1 << pin);
6724 snd_hda_codec_write(codec, codec->afg, 0,
6725 AC_VERB_SET_GPIO_MASK, gpiomask);
6726 snd_hda_codec_write(codec, codec->afg, 0,
6727 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6731 snd_hda_codec_write(codec, codec->afg, 0,
6732 AC_VERB_SET_GPIO_DATA, gpiostate);
6735 /* set up GPIO at initialization */
6736 static void alc885_macpro_init_hook(struct hda_codec *codec)
6738 alc882_gpio_mute(codec, 0, 0);
6739 alc882_gpio_mute(codec, 1, 0);
6742 /* set up GPIO and update auto-muting at initialization */
6743 static void alc885_imac24_init_hook(struct hda_codec *codec)
6745 alc885_macpro_init_hook(codec);
6746 alc885_imac24_automute(codec);
6750 * generic initialization of ADC, input mixers and output mixers
6752 static struct hda_verb alc882_auto_init_verbs[] = {
6754 * Unmute ADC0-2 and set the default input to mic-in
6756 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6757 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6758 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6759 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6760 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6761 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6763 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6765 * Note: PASD motherboards uses the Line In 2 as the input for
6766 * front panel mic (mic 2)
6768 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6769 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6770 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6771 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6772 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6773 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6776 * Set up output mixers (0x0c - 0x0f)
6778 /* set vol=0 to output mixers */
6779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6782 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6783 /* set up input amps for analog loopback */
6784 /* Amp Indices: DAC = 0, mixer = 1 */
6785 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6787 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6789 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6791 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6792 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6793 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6794 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6796 /* FIXME: use matrix-type input source selection */
6797 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6798 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6799 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6800 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6801 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6802 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6804 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6805 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6806 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6807 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6809 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6810 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6811 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6812 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6817 #ifdef CONFIG_SND_HDA_POWER_SAVE
6818 #define alc882_loopbacks alc880_loopbacks
6821 /* pcm configuration: identiacal with ALC880 */
6822 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6823 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6824 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6825 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6828 * configuration and preset
6830 static const char *alc882_models[ALC882_MODEL_LAST] = {
6831 [ALC882_3ST_DIG] = "3stack-dig",
6832 [ALC882_6ST_DIG] = "6stack-dig",
6833 [ALC882_ARIMA] = "arima",
6834 [ALC882_W2JC] = "w2jc",
6835 [ALC882_TARGA] = "targa",
6836 [ALC882_ASUS_A7J] = "asus-a7j",
6837 [ALC882_ASUS_A7M] = "asus-a7m",
6838 [ALC885_MACPRO] = "macpro",
6839 [ALC885_MBP3] = "mbp3",
6840 [ALC885_IMAC24] = "imac24",
6841 [ALC882_AUTO] = "auto",
6844 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6845 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6846 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6847 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6848 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6849 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6850 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6851 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6852 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6853 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6854 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6855 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6856 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6860 static struct alc_config_preset alc882_presets[] = {
6861 [ALC882_3ST_DIG] = {
6862 .mixers = { alc882_base_mixer },
6863 .init_verbs = { alc882_init_verbs },
6864 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6865 .dac_nids = alc882_dac_nids,
6866 .dig_out_nid = ALC882_DIGOUT_NID,
6867 .dig_in_nid = ALC882_DIGIN_NID,
6868 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6869 .channel_mode = alc882_ch_modes,
6871 .input_mux = &alc882_capture_source,
6873 [ALC882_6ST_DIG] = {
6874 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6875 .init_verbs = { alc882_init_verbs },
6876 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6877 .dac_nids = alc882_dac_nids,
6878 .dig_out_nid = ALC882_DIGOUT_NID,
6879 .dig_in_nid = ALC882_DIGIN_NID,
6880 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6881 .channel_mode = alc882_sixstack_modes,
6882 .input_mux = &alc882_capture_source,
6885 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6886 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6887 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6888 .dac_nids = alc882_dac_nids,
6889 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6890 .channel_mode = alc882_sixstack_modes,
6891 .input_mux = &alc882_capture_source,
6894 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6895 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6896 alc880_gpio1_init_verbs },
6897 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6898 .dac_nids = alc882_dac_nids,
6899 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6900 .channel_mode = alc880_threestack_modes,
6902 .input_mux = &alc882_capture_source,
6903 .dig_out_nid = ALC882_DIGOUT_NID,
6906 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6907 .init_verbs = { alc885_mbp3_init_verbs,
6908 alc880_gpio1_init_verbs },
6909 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6910 .dac_nids = alc882_dac_nids,
6911 .channel_mode = alc885_mbp_6ch_modes,
6912 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6913 .input_mux = &alc882_capture_source,
6914 .dig_out_nid = ALC882_DIGOUT_NID,
6915 .dig_in_nid = ALC882_DIGIN_NID,
6916 .unsol_event = alc885_mbp3_unsol_event,
6917 .init_hook = alc885_mbp3_automute,
6920 .mixers = { alc882_macpro_mixer },
6921 .init_verbs = { alc882_macpro_init_verbs },
6922 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6923 .dac_nids = alc882_dac_nids,
6924 .dig_out_nid = ALC882_DIGOUT_NID,
6925 .dig_in_nid = ALC882_DIGIN_NID,
6926 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6927 .channel_mode = alc882_ch_modes,
6928 .input_mux = &alc882_capture_source,
6929 .init_hook = alc885_macpro_init_hook,
6932 .mixers = { alc885_imac24_mixer },
6933 .init_verbs = { alc885_imac24_init_verbs },
6934 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6935 .dac_nids = alc882_dac_nids,
6936 .dig_out_nid = ALC882_DIGOUT_NID,
6937 .dig_in_nid = ALC882_DIGIN_NID,
6938 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6939 .channel_mode = alc882_ch_modes,
6940 .input_mux = &alc882_capture_source,
6941 .unsol_event = alc885_imac24_unsol_event,
6942 .init_hook = alc885_imac24_init_hook,
6945 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6946 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6947 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6948 .dac_nids = alc882_dac_nids,
6949 .dig_out_nid = ALC882_DIGOUT_NID,
6950 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6951 .adc_nids = alc882_adc_nids,
6952 .capsrc_nids = alc882_capsrc_nids,
6953 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6954 .channel_mode = alc882_3ST_6ch_modes,
6956 .input_mux = &alc882_capture_source,
6957 .unsol_event = alc882_targa_unsol_event,
6958 .init_hook = alc882_targa_automute,
6960 [ALC882_ASUS_A7J] = {
6961 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6962 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6963 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6964 .dac_nids = alc882_dac_nids,
6965 .dig_out_nid = ALC882_DIGOUT_NID,
6966 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6967 .adc_nids = alc882_adc_nids,
6968 .capsrc_nids = alc882_capsrc_nids,
6969 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6970 .channel_mode = alc882_3ST_6ch_modes,
6972 .input_mux = &alc882_capture_source,
6974 [ALC882_ASUS_A7M] = {
6975 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6976 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6977 alc880_gpio1_init_verbs,
6978 alc882_asus_a7m_verbs },
6979 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6980 .dac_nids = alc882_dac_nids,
6981 .dig_out_nid = ALC882_DIGOUT_NID,
6982 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6983 .channel_mode = alc880_threestack_modes,
6985 .input_mux = &alc882_capture_source,
6994 PINFIX_ABIT_AW9D_MAX
6997 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6998 { 0x15, 0x01080104 }, /* side */
6999 { 0x16, 0x01011012 }, /* rear */
7000 { 0x17, 0x01016011 }, /* clfe */
7004 static const struct alc_pincfg *alc882_pin_fixes[] = {
7005 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7008 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7009 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7014 * BIOS auto configuration
7016 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7017 hda_nid_t nid, int pin_type,
7021 struct alc_spec *spec = codec->spec;
7024 alc_set_pin_output(codec, nid, pin_type);
7025 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7028 idx = spec->multiout.dac_nids[dac_idx] - 2;
7029 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7033 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7035 struct alc_spec *spec = codec->spec;
7038 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7039 for (i = 0; i <= HDA_SIDE; i++) {
7040 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7041 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7043 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7048 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7050 struct alc_spec *spec = codec->spec;
7053 pin = spec->autocfg.hp_pins[0];
7054 if (pin) /* connect to front */
7056 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7057 pin = spec->autocfg.speaker_pins[0];
7059 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7062 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7063 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7065 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7067 struct alc_spec *spec = codec->spec;
7070 for (i = 0; i < AUTO_PIN_LAST; i++) {
7071 hda_nid_t nid = spec->autocfg.input_pins[i];
7076 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
7077 unsigned int pincap;
7078 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
7079 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
7083 snd_hda_codec_write(codec, nid, 0,
7084 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
7085 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7086 snd_hda_codec_write(codec, nid, 0,
7087 AC_VERB_SET_AMP_GAIN_MUTE,
7092 static void alc882_auto_init_input_src(struct hda_codec *codec)
7094 struct alc_spec *spec = codec->spec;
7097 for (c = 0; c < spec->num_adc_nids; c++) {
7098 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7099 hda_nid_t nid = spec->capsrc_nids[c];
7100 unsigned int mux_idx;
7101 const struct hda_input_mux *imux;
7102 int conns, mute, idx, item;
7104 conns = snd_hda_get_connections(codec, nid, conn_list,
7105 ARRAY_SIZE(conn_list));
7108 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7109 imux = &spec->input_mux[mux_idx];
7110 for (idx = 0; idx < conns; idx++) {
7111 /* if the current connection is the selected one,
7112 * unmute it as default - otherwise mute it
7114 mute = AMP_IN_MUTE(idx);
7115 for (item = 0; item < imux->num_items; item++) {
7116 if (imux->items[item].index == idx) {
7117 if (spec->cur_mux[c] == item)
7118 mute = AMP_IN_UNMUTE(idx);
7122 /* check if we have a selector or mixer
7123 * we could check for the widget type instead, but
7124 * just check for Amp-In presence (in case of mixer
7125 * without amp-in there is something wrong, this
7126 * function shouldn't be used or capsrc nid is wrong)
7128 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7129 snd_hda_codec_write(codec, nid, 0,
7130 AC_VERB_SET_AMP_GAIN_MUTE,
7132 else if (mute != AMP_IN_MUTE(idx))
7133 snd_hda_codec_write(codec, nid, 0,
7134 AC_VERB_SET_CONNECT_SEL,
7140 /* add mic boosts if needed */
7141 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7143 struct alc_spec *spec = codec->spec;
7147 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7148 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7149 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7151 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7155 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7156 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7157 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7159 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7166 /* almost identical with ALC880 parser... */
7167 static int alc882_parse_auto_config(struct hda_codec *codec)
7169 struct alc_spec *spec = codec->spec;
7170 int err = alc880_parse_auto_config(codec);
7175 return 0; /* no config found */
7177 err = alc_auto_add_mic_boost(codec);
7181 /* hack - override the init verbs */
7182 spec->init_verbs[0] = alc882_auto_init_verbs;
7184 return 1; /* config found */
7187 /* additional initialization for auto-configuration model */
7188 static void alc882_auto_init(struct hda_codec *codec)
7190 struct alc_spec *spec = codec->spec;
7191 alc882_auto_init_multi_out(codec);
7192 alc882_auto_init_hp_out(codec);
7193 alc882_auto_init_analog_input(codec);
7194 alc882_auto_init_input_src(codec);
7195 if (spec->unsol_event)
7196 alc_inithook(codec);
7199 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7201 static int patch_alc882(struct hda_codec *codec)
7203 struct alc_spec *spec;
7204 int err, board_config;
7206 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7212 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7216 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7217 /* Pick up systems that don't supply PCI SSID */
7218 switch (codec->subsystem_id) {
7219 case 0x106b0c00: /* Mac Pro */
7220 board_config = ALC885_MACPRO;
7222 case 0x106b1000: /* iMac 24 */
7223 case 0x106b2800: /* AppleTV */
7224 case 0x106b3e00: /* iMac 24 Aluminium */
7225 board_config = ALC885_IMAC24;
7227 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7228 case 0x106b00a4: /* MacbookPro4,1 */
7229 case 0x106b2c00: /* Macbook Pro rev3 */
7230 case 0x106b3600: /* Macbook 3.1 */
7231 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7232 board_config = ALC885_MBP3;
7235 /* ALC889A is handled better as ALC888-compatible */
7236 if (codec->revision_id == 0x100101 ||
7237 codec->revision_id == 0x100103) {
7239 return patch_alc883(codec);
7241 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7242 "trying auto-probe from BIOS...\n");
7243 board_config = ALC882_AUTO;
7247 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7249 if (board_config == ALC882_AUTO) {
7250 /* automatic parse from the BIOS config */
7251 err = alc882_parse_auto_config(codec);
7257 "hda_codec: Cannot set up configuration "
7258 "from BIOS. Using base mode...\n");
7259 board_config = ALC882_3ST_DIG;
7263 err = snd_hda_attach_beep_device(codec, 0x1);
7269 if (board_config != ALC882_AUTO)
7270 setup_preset(spec, &alc882_presets[board_config]);
7272 if (codec->vendor_id == 0x10ec0885) {
7273 spec->stream_name_analog = "ALC885 Analog";
7274 spec->stream_name_digital = "ALC885 Digital";
7276 spec->stream_name_analog = "ALC882 Analog";
7277 spec->stream_name_digital = "ALC882 Digital";
7280 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7281 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7282 /* FIXME: setup DAC5 */
7283 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7284 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7286 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7287 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7289 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7290 if (!spec->adc_nids && spec->input_mux) {
7291 /* check whether NID 0x07 is valid */
7292 unsigned int wcap = get_wcaps(codec, 0x07);
7294 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7295 if (wcap != AC_WID_AUD_IN) {
7296 spec->adc_nids = alc882_adc_nids_alt;
7297 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7298 spec->capsrc_nids = alc882_capsrc_nids_alt;
7300 spec->adc_nids = alc882_adc_nids;
7301 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7302 spec->capsrc_nids = alc882_capsrc_nids;
7305 set_capture_mixer(spec);
7306 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7308 spec->vmaster_nid = 0x0c;
7310 codec->patch_ops = alc_patch_ops;
7311 if (board_config == ALC882_AUTO)
7312 spec->init_hook = alc882_auto_init;
7313 #ifdef CONFIG_SND_HDA_POWER_SAVE
7314 if (!spec->loopback.amplist)
7315 spec->loopback.amplist = alc882_loopbacks;
7317 codec->proc_widget_hook = print_realtek_coef;
7325 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7326 * configuration. Each pin widget can choose any input DACs and a mixer.
7327 * Each ADC is connected from a mixer of all inputs. This makes possible
7328 * 6-channel independent captures.
7330 * In addition, an independent DAC for the multi-playback (not used in this
7333 #define ALC883_DIGOUT_NID 0x06
7334 #define ALC883_DIGIN_NID 0x0a
7336 #define ALC1200_DIGOUT_NID 0x10
7338 static hda_nid_t alc883_dac_nids[4] = {
7339 /* front, rear, clfe, rear_surr */
7340 0x02, 0x03, 0x04, 0x05
7343 static hda_nid_t alc883_adc_nids[2] = {
7348 static hda_nid_t alc883_adc_nids_alt[1] = {
7353 static hda_nid_t alc883_adc_nids_rev[2] = {
7358 #define alc889_adc_nids alc880_adc_nids
7360 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7362 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7364 #define alc889_capsrc_nids alc882_capsrc_nids
7367 /* FIXME: should be a matrix-type input source selection */
7369 static struct hda_input_mux alc883_capture_source = {
7373 { "Front Mic", 0x1 },
7379 static struct hda_input_mux alc883_3stack_6ch_intel = {
7383 { "Front Mic", 0x0 },
7389 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7397 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7407 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7415 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7419 { "Front Mic", 0x1 },
7424 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7435 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7442 static struct hda_verb alc883_3ST_ch2_init[] = {
7443 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7444 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7445 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7446 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7453 static struct hda_verb alc883_3ST_ch4_init[] = {
7454 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7455 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7456 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7457 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7458 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7465 static struct hda_verb alc883_3ST_ch6_init[] = {
7466 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7467 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7468 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7469 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7470 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7471 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7475 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7476 { 2, alc883_3ST_ch2_init },
7477 { 4, alc883_3ST_ch4_init },
7478 { 6, alc883_3ST_ch6_init },
7484 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7485 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7486 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7487 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7488 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7495 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7496 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7497 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7498 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7499 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7500 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7507 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7508 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7509 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7510 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7511 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7512 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7513 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7517 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7518 { 2, alc883_3ST_ch2_intel_init },
7519 { 4, alc883_3ST_ch4_intel_init },
7520 { 6, alc883_3ST_ch6_intel_init },
7526 static struct hda_verb alc883_sixstack_ch6_init[] = {
7527 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7528 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7529 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7530 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7537 static struct hda_verb alc883_sixstack_ch8_init[] = {
7538 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7539 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7540 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7541 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7545 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7546 { 6, alc883_sixstack_ch6_init },
7547 { 8, alc883_sixstack_ch8_init },
7550 static struct hda_verb alc883_medion_eapd_verbs[] = {
7551 /* eanable EAPD on medion laptop */
7552 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7553 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7557 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7558 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7561 static struct snd_kcontrol_new alc883_base_mixer[] = {
7562 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7563 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7564 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7565 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7566 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7567 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7568 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7569 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7570 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7571 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7573 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7574 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7575 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7576 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7579 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7580 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7581 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7582 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7586 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7587 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7588 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7589 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7590 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7591 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7592 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7593 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7595 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7596 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7597 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7598 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7599 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7603 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7604 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7605 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7606 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7607 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7608 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7609 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7610 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7611 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7612 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7613 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7617 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7618 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7619 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7620 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7621 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7623 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7624 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7625 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7626 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7627 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7631 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7632 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7633 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7635 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7636 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7637 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7638 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7640 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7644 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7648 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7649 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7651 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7652 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7653 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7654 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7655 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7656 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7658 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7659 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7660 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7661 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7662 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7663 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7664 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7665 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7666 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7667 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7671 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7672 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7673 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7674 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7675 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7676 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7678 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7679 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7680 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7682 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7683 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7684 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7685 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7687 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7690 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7691 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7695 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7696 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7697 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7698 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7699 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7700 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7701 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7702 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7703 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7705 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7706 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7707 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7708 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7709 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7710 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7711 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7712 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7713 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7714 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7718 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7719 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7720 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7721 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7722 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7723 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7724 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7725 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7726 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7727 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7728 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7729 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7731 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7733 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7734 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7738 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7739 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7740 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7741 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7742 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7743 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7745 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7747 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7748 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7749 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7753 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7754 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7755 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7757 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7765 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7766 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7767 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7772 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7773 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7774 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7778 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7779 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7780 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7781 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7782 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7783 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7785 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7786 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7787 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7791 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7792 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7793 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7794 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7803 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7804 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7805 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7806 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7807 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7808 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7809 0x0d, 1, 0x0, HDA_OUTPUT),
7810 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7811 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7812 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7813 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7814 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7816 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7817 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7818 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7819 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7820 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7822 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7823 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7825 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7830 static struct hda_bind_ctls alc883_bind_cap_vol = {
7831 .ops = &snd_hda_bind_vol,
7833 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7834 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7839 static struct hda_bind_ctls alc883_bind_cap_switch = {
7840 .ops = &snd_hda_bind_sw,
7842 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7843 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7848 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7849 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7850 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7851 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7852 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7853 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7860 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7861 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7862 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7864 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7865 /* .name = "Capture Source", */
7866 .name = "Input Source",
7868 .info = alc_mux_enum_info,
7869 .get = alc_mux_enum_get,
7870 .put = alc_mux_enum_put,
7875 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7877 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7878 .name = "Channel Mode",
7879 .info = alc_ch_mode_info,
7880 .get = alc_ch_mode_get,
7881 .put = alc_ch_mode_put,
7886 static struct hda_verb alc883_init_verbs[] = {
7887 /* ADC1: mute amp left and right */
7888 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7889 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7890 /* ADC2: mute amp left and right */
7891 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7892 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7893 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7896 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7898 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7899 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7900 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7902 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7906 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7907 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7908 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7910 /* mute analog input loopbacks */
7911 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7912 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7913 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7914 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7915 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7917 /* Front Pin: output 0 (0x0c) */
7918 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7919 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7920 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7921 /* Rear Pin: output 1 (0x0d) */
7922 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7923 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7924 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7925 /* CLFE Pin: output 2 (0x0e) */
7926 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7927 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7928 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7929 /* Side Pin: output 3 (0x0f) */
7930 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7931 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7932 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7933 /* Mic (rear) pin: input vref at 80% */
7934 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7935 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7936 /* Front Mic pin: input vref at 80% */
7937 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7938 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7939 /* Line In pin: input */
7940 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7941 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7942 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7943 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7944 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7945 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7946 /* CD pin widget for input */
7947 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7949 /* FIXME: use matrix-type input source selection */
7950 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7952 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7953 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7954 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7957 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7958 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7959 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7960 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7964 /* toggle speaker-output according to the hp-jack state */
7965 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7967 unsigned int present;
7969 present = snd_hda_codec_read(codec, 0x15, 0,
7970 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7971 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7972 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7973 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7974 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7977 /* auto-toggle front mic */
7979 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7981 unsigned int present;
7984 present = snd_hda_codec_read(codec, 0x18, 0,
7985 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7986 bits = present ? HDA_AMP_MUTE : 0;
7987 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7991 static void alc883_mitac_automute(struct hda_codec *codec)
7993 alc883_mitac_hp_automute(codec);
7994 /* alc883_mitac_mic_automute(codec); */
7997 static void alc883_mitac_unsol_event(struct hda_codec *codec,
8000 switch (res >> 26) {
8001 case ALC880_HP_EVENT:
8002 alc883_mitac_hp_automute(codec);
8004 case ALC880_MIC_EVENT:
8005 /* alc883_mitac_mic_automute(codec); */
8010 static struct hda_verb alc883_mitac_verbs[] = {
8012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8013 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8015 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8016 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8018 /* enable unsolicited event */
8019 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8020 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8025 static struct hda_verb alc883_clevo_m720_verbs[] = {
8027 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8028 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8030 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8033 /* enable unsolicited event */
8034 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8035 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8040 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8042 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8043 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8048 /* enable unsolicited event */
8049 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8054 static struct hda_verb alc883_tagra_verbs[] = {
8055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8056 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8058 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8059 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8061 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8062 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8063 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8065 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8066 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8067 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8068 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8073 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8074 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8075 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8076 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8080 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8082 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8083 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8088 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8091 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8092 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8093 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8097 static struct hda_verb alc883_haier_w66_verbs[] = {
8098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8101 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8103 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8104 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8105 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8106 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8110 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8112 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8113 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8114 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8115 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8116 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8117 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8118 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8122 static struct hda_verb alc888_3st_hp_verbs[] = {
8123 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8124 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8125 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8129 static struct hda_verb alc888_6st_dell_verbs[] = {
8130 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8134 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8135 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8136 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8137 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8138 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8142 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8143 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8144 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8145 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8146 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8150 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
8151 { 2, alc888_3st_hp_2ch_init },
8152 { 6, alc888_3st_hp_6ch_init },
8155 /* toggle front-jack and RCA according to the hp-jack state */
8156 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8158 unsigned int present;
8160 present = snd_hda_codec_read(codec, 0x1b, 0,
8161 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8162 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8163 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8164 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8165 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8168 /* toggle RCA according to the front-jack state */
8169 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8171 unsigned int present;
8173 present = snd_hda_codec_read(codec, 0x14, 0,
8174 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8175 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8176 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8179 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8182 if ((res >> 26) == ALC880_HP_EVENT)
8183 alc888_lenovo_ms7195_front_automute(codec);
8184 if ((res >> 26) == ALC880_FRONT_EVENT)
8185 alc888_lenovo_ms7195_rca_automute(codec);
8188 static struct hda_verb alc883_medion_md2_verbs[] = {
8189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8192 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8194 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8198 /* toggle speaker-output according to the hp-jack state */
8199 static void alc883_medion_md2_automute(struct hda_codec *codec)
8201 unsigned int present;
8203 present = snd_hda_codec_read(codec, 0x14, 0,
8204 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8205 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8206 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8209 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8212 if ((res >> 26) == ALC880_HP_EVENT)
8213 alc883_medion_md2_automute(codec);
8216 /* toggle speaker-output according to the hp-jack state */
8217 static void alc883_tagra_automute(struct hda_codec *codec)
8219 unsigned int present;
8222 present = snd_hda_codec_read(codec, 0x14, 0,
8223 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8224 bits = present ? HDA_AMP_MUTE : 0;
8225 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8226 HDA_AMP_MUTE, bits);
8227 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8231 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8233 if ((res >> 26) == ALC880_HP_EVENT)
8234 alc883_tagra_automute(codec);
8237 /* toggle speaker-output according to the hp-jack state */
8238 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8240 unsigned int present;
8243 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8244 & AC_PINSENSE_PRESENCE;
8245 bits = present ? HDA_AMP_MUTE : 0;
8246 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8247 HDA_AMP_MUTE, bits);
8250 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8252 unsigned int present;
8254 present = snd_hda_codec_read(codec, 0x18, 0,
8255 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8256 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8257 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8260 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8262 alc883_clevo_m720_hp_automute(codec);
8263 alc883_clevo_m720_mic_automute(codec);
8266 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8269 switch (res >> 26) {
8270 case ALC880_HP_EVENT:
8271 alc883_clevo_m720_hp_automute(codec);
8273 case ALC880_MIC_EVENT:
8274 alc883_clevo_m720_mic_automute(codec);
8279 /* toggle speaker-output according to the hp-jack state */
8280 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8282 unsigned int present;
8285 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8286 & AC_PINSENSE_PRESENCE;
8287 bits = present ? HDA_AMP_MUTE : 0;
8288 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8289 HDA_AMP_MUTE, bits);
8292 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8295 if ((res >> 26) == ALC880_HP_EVENT)
8296 alc883_2ch_fujitsu_pi2515_automute(codec);
8299 static void alc883_haier_w66_automute(struct hda_codec *codec)
8301 unsigned int present;
8304 present = snd_hda_codec_read(codec, 0x1b, 0,
8305 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8306 bits = present ? 0x80 : 0;
8307 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8311 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8314 if ((res >> 26) == ALC880_HP_EVENT)
8315 alc883_haier_w66_automute(codec);
8318 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8320 unsigned int present;
8323 present = snd_hda_codec_read(codec, 0x14, 0,
8324 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8325 bits = present ? HDA_AMP_MUTE : 0;
8326 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8327 HDA_AMP_MUTE, bits);
8330 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8332 unsigned int present;
8335 present = snd_hda_codec_read(codec, 0x1b, 0,
8336 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8337 bits = present ? HDA_AMP_MUTE : 0;
8338 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8339 HDA_AMP_MUTE, bits);
8340 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8341 HDA_AMP_MUTE, bits);
8344 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8347 if ((res >> 26) == ALC880_HP_EVENT)
8348 alc883_lenovo_101e_all_automute(codec);
8349 if ((res >> 26) == ALC880_FRONT_EVENT)
8350 alc883_lenovo_101e_ispeaker_automute(codec);
8353 /* toggle speaker-output according to the hp-jack state */
8354 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8356 unsigned int present;
8358 present = snd_hda_codec_read(codec, 0x14, 0,
8359 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8360 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8361 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8362 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8363 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8366 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8369 if ((res >> 26) == ALC880_HP_EVENT)
8370 alc883_acer_aspire_automute(codec);
8373 static struct hda_verb alc883_acer_eapd_verbs[] = {
8374 /* HP Pin: output 0 (0x0c) */
8375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8376 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8377 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8378 /* Front Pin: output 0 (0x0c) */
8379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8380 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8381 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8382 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8383 /* eanable EAPD on medion laptop */
8384 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8385 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8386 /* enable unsolicited event */
8387 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8391 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8393 unsigned int present;
8395 present = snd_hda_codec_read(codec, 0x1b, 0,
8396 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8397 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8398 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8399 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8400 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8401 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8402 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8403 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8404 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8407 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8410 switch (res >> 26) {
8411 case ALC880_HP_EVENT:
8412 /* printk(KERN_DEBUG "hp_event\n"); */
8413 alc888_6st_dell_front_automute(codec);
8418 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8421 unsigned int present;
8423 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8424 present = snd_hda_codec_read(codec, 0x1b, 0,
8425 AC_VERB_GET_PIN_SENSE, 0);
8426 present = (present & 0x80000000) != 0;
8428 /* mute internal speaker */
8429 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8430 HDA_AMP_MUTE, HDA_AMP_MUTE);
8431 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8432 HDA_AMP_MUTE, HDA_AMP_MUTE);
8433 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8434 HDA_AMP_MUTE, HDA_AMP_MUTE);
8435 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8436 HDA_AMP_MUTE, HDA_AMP_MUTE);
8437 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8438 HDA_AMP_MUTE, HDA_AMP_MUTE);
8440 /* unmute internal speaker if necessary */
8441 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8442 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8443 HDA_AMP_MUTE, mute);
8444 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8445 HDA_AMP_MUTE, mute);
8446 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8447 HDA_AMP_MUTE, mute);
8448 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8449 HDA_AMP_MUTE, mute);
8450 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8451 HDA_AMP_MUTE, mute);
8455 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8458 if ((res >> 26) == ALC880_HP_EVENT)
8459 alc888_lenovo_sky_front_automute(codec);
8463 * generic initialization of ADC, input mixers and output mixers
8465 static struct hda_verb alc883_auto_init_verbs[] = {
8467 * Unmute ADC0-2 and set the default input to mic-in
8469 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8470 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8471 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8472 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8474 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8476 * Note: PASD motherboards uses the Line In 2 as the input for
8477 * front panel mic (mic 2)
8479 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8480 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8481 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8482 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8487 * Set up output mixers (0x0c - 0x0f)
8489 /* set vol=0 to output mixers */
8490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8491 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8492 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8493 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8494 /* set up input amps for analog loopback */
8495 /* Amp Indices: DAC = 0, mixer = 1 */
8496 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8497 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8498 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8499 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8500 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8501 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8502 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8503 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8504 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8505 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8507 /* FIXME: use matrix-type input source selection */
8508 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8511 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8512 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8513 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8517 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8518 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8519 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8520 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8525 static struct hda_verb alc888_asus_m90v_verbs[] = {
8526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8527 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8529 /* enable unsolicited event */
8530 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8531 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8535 static void alc883_nb_mic_automute(struct hda_codec *codec)
8537 unsigned int present;
8539 present = snd_hda_codec_read(codec, 0x18, 0,
8540 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8541 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8542 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8543 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8544 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8547 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8549 unsigned int present;
8552 present = snd_hda_codec_read(codec, 0x1b, 0,
8553 AC_VERB_GET_PIN_SENSE, 0)
8554 & AC_PINSENSE_PRESENCE;
8555 bits = present ? 0 : PIN_OUT;
8556 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8558 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8560 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8564 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8567 switch (res >> 26) {
8568 case ALC880_HP_EVENT:
8569 alc883_M90V_speaker_automute(codec);
8571 case ALC880_MIC_EVENT:
8572 alc883_nb_mic_automute(codec);
8577 static void alc883_mode2_inithook(struct hda_codec *codec)
8579 alc883_M90V_speaker_automute(codec);
8580 alc883_nb_mic_automute(codec);
8583 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8585 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8588 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8589 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8590 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8591 /* enable unsolicited event */
8592 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8596 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8598 unsigned int present;
8601 present = snd_hda_codec_read(codec, 0x14, 0,
8602 AC_VERB_GET_PIN_SENSE, 0)
8603 & AC_PINSENSE_PRESENCE;
8604 bits = present ? 0 : PIN_OUT;
8605 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8609 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8612 switch (res >> 26) {
8613 case ALC880_HP_EVENT:
8614 alc883_eee1601_speaker_automute(codec);
8619 static void alc883_eee1601_inithook(struct hda_codec *codec)
8621 alc883_eee1601_speaker_automute(codec);
8624 #ifdef CONFIG_SND_HDA_POWER_SAVE
8625 #define alc883_loopbacks alc880_loopbacks
8628 /* pcm configuration: identiacal with ALC880 */
8629 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8630 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8631 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8632 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8633 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8636 * configuration and preset
8638 static const char *alc883_models[ALC883_MODEL_LAST] = {
8639 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8640 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8641 [ALC883_3ST_6ch] = "3stack-6ch",
8642 [ALC883_6ST_DIG] = "6stack-dig",
8643 [ALC883_TARGA_DIG] = "targa-dig",
8644 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8645 [ALC883_ACER] = "acer",
8646 [ALC883_ACER_ASPIRE] = "acer-aspire",
8647 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8648 [ALC883_MEDION] = "medion",
8649 [ALC883_MEDION_MD2] = "medion-md2",
8650 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8651 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8652 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8653 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8654 [ALC888_LENOVO_SKY] = "lenovo-sky",
8655 [ALC883_HAIER_W66] = "haier-w66",
8656 [ALC888_3ST_HP] = "3stack-hp",
8657 [ALC888_6ST_DELL] = "6stack-dell",
8658 [ALC883_MITAC] = "mitac",
8659 [ALC883_CLEVO_M720] = "clevo-m720",
8660 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8661 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8662 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8663 [ALC1200_ASUS_P5Q] = "asus-p5q",
8664 [ALC883_AUTO] = "auto",
8667 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8668 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8669 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8670 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8671 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8672 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8673 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8674 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8675 ALC888_ACER_ASPIRE_4930G),
8676 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8677 ALC888_ACER_ASPIRE_4930G),
8678 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8679 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8680 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8681 ALC888_ACER_ASPIRE_4930G),
8683 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8684 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8685 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8686 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8687 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8688 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8689 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8690 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8691 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8692 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8693 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8694 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8695 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8696 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8697 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8698 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8699 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8700 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8701 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8702 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8703 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8704 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8705 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8706 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8707 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8708 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8709 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8710 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8711 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8712 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8713 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8714 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8715 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8716 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8717 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8718 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8719 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8720 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8721 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8722 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8723 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8724 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8725 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8726 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8727 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8728 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8729 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8730 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8731 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8732 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
8733 ALC883_FUJITSU_PI2515),
8734 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8735 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8736 ALC888_FUJITSU_XA3530),
8737 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8738 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8739 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8740 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8741 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8742 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8743 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8744 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8745 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8746 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8747 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8748 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8749 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8750 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8754 static hda_nid_t alc1200_slave_dig_outs[] = {
8755 ALC883_DIGOUT_NID, 0,
8758 static struct alc_config_preset alc883_presets[] = {
8759 [ALC883_3ST_2ch_DIG] = {
8760 .mixers = { alc883_3ST_2ch_mixer },
8761 .init_verbs = { alc883_init_verbs },
8762 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8763 .dac_nids = alc883_dac_nids,
8764 .dig_out_nid = ALC883_DIGOUT_NID,
8765 .dig_in_nid = ALC883_DIGIN_NID,
8766 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8767 .channel_mode = alc883_3ST_2ch_modes,
8768 .input_mux = &alc883_capture_source,
8770 [ALC883_3ST_6ch_DIG] = {
8771 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8772 .init_verbs = { alc883_init_verbs },
8773 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8774 .dac_nids = alc883_dac_nids,
8775 .dig_out_nid = ALC883_DIGOUT_NID,
8776 .dig_in_nid = ALC883_DIGIN_NID,
8777 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8778 .channel_mode = alc883_3ST_6ch_modes,
8780 .input_mux = &alc883_capture_source,
8782 [ALC883_3ST_6ch] = {
8783 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8784 .init_verbs = { alc883_init_verbs },
8785 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8786 .dac_nids = alc883_dac_nids,
8787 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8788 .channel_mode = alc883_3ST_6ch_modes,
8790 .input_mux = &alc883_capture_source,
8792 [ALC883_3ST_6ch_INTEL] = {
8793 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8794 .init_verbs = { alc883_init_verbs },
8795 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8796 .dac_nids = alc883_dac_nids,
8797 .dig_out_nid = ALC883_DIGOUT_NID,
8798 .dig_in_nid = ALC883_DIGIN_NID,
8799 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8800 .channel_mode = alc883_3ST_6ch_intel_modes,
8802 .input_mux = &alc883_3stack_6ch_intel,
8804 [ALC883_6ST_DIG] = {
8805 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8806 .init_verbs = { alc883_init_verbs },
8807 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8808 .dac_nids = alc883_dac_nids,
8809 .dig_out_nid = ALC883_DIGOUT_NID,
8810 .dig_in_nid = ALC883_DIGIN_NID,
8811 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8812 .channel_mode = alc883_sixstack_modes,
8813 .input_mux = &alc883_capture_source,
8815 [ALC883_TARGA_DIG] = {
8816 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8817 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8818 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8819 .dac_nids = alc883_dac_nids,
8820 .dig_out_nid = ALC883_DIGOUT_NID,
8821 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8822 .channel_mode = alc883_3ST_6ch_modes,
8824 .input_mux = &alc883_capture_source,
8825 .unsol_event = alc883_tagra_unsol_event,
8826 .init_hook = alc883_tagra_automute,
8828 [ALC883_TARGA_2ch_DIG] = {
8829 .mixers = { alc883_tagra_2ch_mixer},
8830 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8831 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8832 .dac_nids = alc883_dac_nids,
8833 .adc_nids = alc883_adc_nids_alt,
8834 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8835 .dig_out_nid = ALC883_DIGOUT_NID,
8836 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8837 .channel_mode = alc883_3ST_2ch_modes,
8838 .input_mux = &alc883_capture_source,
8839 .unsol_event = alc883_tagra_unsol_event,
8840 .init_hook = alc883_tagra_automute,
8843 .mixers = { alc883_base_mixer },
8844 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8845 * and the headphone jack. Turn this on and rely on the
8846 * standard mute methods whenever the user wants to turn
8847 * these outputs off.
8849 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8850 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8851 .dac_nids = alc883_dac_nids,
8852 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8853 .channel_mode = alc883_3ST_2ch_modes,
8854 .input_mux = &alc883_capture_source,
8856 [ALC883_ACER_ASPIRE] = {
8857 .mixers = { alc883_acer_aspire_mixer },
8858 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8859 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8860 .dac_nids = alc883_dac_nids,
8861 .dig_out_nid = ALC883_DIGOUT_NID,
8862 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8863 .channel_mode = alc883_3ST_2ch_modes,
8864 .input_mux = &alc883_capture_source,
8865 .unsol_event = alc883_acer_aspire_unsol_event,
8866 .init_hook = alc883_acer_aspire_automute,
8868 [ALC888_ACER_ASPIRE_4930G] = {
8869 .mixers = { alc888_base_mixer,
8870 alc883_chmode_mixer },
8871 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8872 alc888_acer_aspire_4930g_verbs },
8873 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8874 .dac_nids = alc883_dac_nids,
8875 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8876 .adc_nids = alc883_adc_nids_rev,
8877 .capsrc_nids = alc883_capsrc_nids_rev,
8878 .dig_out_nid = ALC883_DIGOUT_NID,
8879 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8880 .channel_mode = alc883_3ST_6ch_modes,
8883 ARRAY_SIZE(alc888_2_capture_sources),
8884 .input_mux = alc888_2_capture_sources,
8885 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8886 .init_hook = alc888_acer_aspire_4930g_automute,
8889 .mixers = { alc883_fivestack_mixer,
8890 alc883_chmode_mixer },
8891 .init_verbs = { alc883_init_verbs,
8892 alc883_medion_eapd_verbs },
8893 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8894 .dac_nids = alc883_dac_nids,
8895 .adc_nids = alc883_adc_nids_alt,
8896 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8897 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8898 .channel_mode = alc883_sixstack_modes,
8899 .input_mux = &alc883_capture_source,
8901 [ALC883_MEDION_MD2] = {
8902 .mixers = { alc883_medion_md2_mixer},
8903 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8904 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8905 .dac_nids = alc883_dac_nids,
8906 .dig_out_nid = ALC883_DIGOUT_NID,
8907 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8908 .channel_mode = alc883_3ST_2ch_modes,
8909 .input_mux = &alc883_capture_source,
8910 .unsol_event = alc883_medion_md2_unsol_event,
8911 .init_hook = alc883_medion_md2_automute,
8913 [ALC883_LAPTOP_EAPD] = {
8914 .mixers = { alc883_base_mixer },
8915 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8916 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8917 .dac_nids = alc883_dac_nids,
8918 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8919 .channel_mode = alc883_3ST_2ch_modes,
8920 .input_mux = &alc883_capture_source,
8922 [ALC883_CLEVO_M720] = {
8923 .mixers = { alc883_clevo_m720_mixer },
8924 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8925 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8926 .dac_nids = alc883_dac_nids,
8927 .dig_out_nid = ALC883_DIGOUT_NID,
8928 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8929 .channel_mode = alc883_3ST_2ch_modes,
8930 .input_mux = &alc883_capture_source,
8931 .unsol_event = alc883_clevo_m720_unsol_event,
8932 .init_hook = alc883_clevo_m720_automute,
8934 [ALC883_LENOVO_101E_2ch] = {
8935 .mixers = { alc883_lenovo_101e_2ch_mixer},
8936 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8937 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8938 .dac_nids = alc883_dac_nids,
8939 .adc_nids = alc883_adc_nids_alt,
8940 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8941 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8942 .channel_mode = alc883_3ST_2ch_modes,
8943 .input_mux = &alc883_lenovo_101e_capture_source,
8944 .unsol_event = alc883_lenovo_101e_unsol_event,
8945 .init_hook = alc883_lenovo_101e_all_automute,
8947 [ALC883_LENOVO_NB0763] = {
8948 .mixers = { alc883_lenovo_nb0763_mixer },
8949 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8950 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8951 .dac_nids = alc883_dac_nids,
8952 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8953 .channel_mode = alc883_3ST_2ch_modes,
8955 .input_mux = &alc883_lenovo_nb0763_capture_source,
8956 .unsol_event = alc883_medion_md2_unsol_event,
8957 .init_hook = alc883_medion_md2_automute,
8959 [ALC888_LENOVO_MS7195_DIG] = {
8960 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8961 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8962 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8963 .dac_nids = alc883_dac_nids,
8964 .dig_out_nid = ALC883_DIGOUT_NID,
8965 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8966 .channel_mode = alc883_3ST_6ch_modes,
8968 .input_mux = &alc883_capture_source,
8969 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8970 .init_hook = alc888_lenovo_ms7195_front_automute,
8972 [ALC883_HAIER_W66] = {
8973 .mixers = { alc883_tagra_2ch_mixer},
8974 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8975 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8976 .dac_nids = alc883_dac_nids,
8977 .dig_out_nid = ALC883_DIGOUT_NID,
8978 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8979 .channel_mode = alc883_3ST_2ch_modes,
8980 .input_mux = &alc883_capture_source,
8981 .unsol_event = alc883_haier_w66_unsol_event,
8982 .init_hook = alc883_haier_w66_automute,
8985 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8986 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8987 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8988 .dac_nids = alc883_dac_nids,
8989 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8990 .channel_mode = alc888_3st_hp_modes,
8992 .input_mux = &alc883_capture_source,
8994 [ALC888_6ST_DELL] = {
8995 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8996 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8997 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8998 .dac_nids = alc883_dac_nids,
8999 .dig_out_nid = ALC883_DIGOUT_NID,
9000 .dig_in_nid = ALC883_DIGIN_NID,
9001 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9002 .channel_mode = alc883_sixstack_modes,
9003 .input_mux = &alc883_capture_source,
9004 .unsol_event = alc888_6st_dell_unsol_event,
9005 .init_hook = alc888_6st_dell_front_automute,
9008 .mixers = { alc883_mitac_mixer },
9009 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9010 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9011 .dac_nids = alc883_dac_nids,
9012 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9013 .channel_mode = alc883_3ST_2ch_modes,
9014 .input_mux = &alc883_capture_source,
9015 .unsol_event = alc883_mitac_unsol_event,
9016 .init_hook = alc883_mitac_automute,
9018 [ALC883_FUJITSU_PI2515] = {
9019 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9020 .init_verbs = { alc883_init_verbs,
9021 alc883_2ch_fujitsu_pi2515_verbs},
9022 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9023 .dac_nids = alc883_dac_nids,
9024 .dig_out_nid = ALC883_DIGOUT_NID,
9025 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9026 .channel_mode = alc883_3ST_2ch_modes,
9027 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9028 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
9029 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
9031 [ALC888_FUJITSU_XA3530] = {
9032 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9033 .init_verbs = { alc883_init_verbs,
9034 alc888_fujitsu_xa3530_verbs },
9035 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9036 .dac_nids = alc883_dac_nids,
9037 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9038 .adc_nids = alc883_adc_nids_rev,
9039 .capsrc_nids = alc883_capsrc_nids_rev,
9040 .dig_out_nid = ALC883_DIGOUT_NID,
9041 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9042 .channel_mode = alc888_4ST_8ch_intel_modes,
9044 ARRAY_SIZE(alc888_2_capture_sources),
9045 .input_mux = alc888_2_capture_sources,
9046 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
9047 .init_hook = alc888_fujitsu_xa3530_automute,
9049 [ALC888_LENOVO_SKY] = {
9050 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9051 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9052 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9053 .dac_nids = alc883_dac_nids,
9054 .dig_out_nid = ALC883_DIGOUT_NID,
9055 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9056 .channel_mode = alc883_sixstack_modes,
9058 .input_mux = &alc883_lenovo_sky_capture_source,
9059 .unsol_event = alc883_lenovo_sky_unsol_event,
9060 .init_hook = alc888_lenovo_sky_front_automute,
9062 [ALC888_ASUS_M90V] = {
9063 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9064 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9065 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9066 .dac_nids = alc883_dac_nids,
9067 .dig_out_nid = ALC883_DIGOUT_NID,
9068 .dig_in_nid = ALC883_DIGIN_NID,
9069 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9070 .channel_mode = alc883_3ST_6ch_modes,
9072 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9073 .unsol_event = alc883_mode2_unsol_event,
9074 .init_hook = alc883_mode2_inithook,
9076 [ALC888_ASUS_EEE1601] = {
9077 .mixers = { alc883_asus_eee1601_mixer },
9078 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9079 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9080 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9081 .dac_nids = alc883_dac_nids,
9082 .dig_out_nid = ALC883_DIGOUT_NID,
9083 .dig_in_nid = ALC883_DIGIN_NID,
9084 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9085 .channel_mode = alc883_3ST_2ch_modes,
9087 .input_mux = &alc883_asus_eee1601_capture_source,
9088 .unsol_event = alc883_eee1601_unsol_event,
9089 .init_hook = alc883_eee1601_inithook,
9091 [ALC1200_ASUS_P5Q] = {
9092 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9093 .init_verbs = { alc883_init_verbs },
9094 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9095 .dac_nids = alc883_dac_nids,
9096 .dig_out_nid = ALC1200_DIGOUT_NID,
9097 .dig_in_nid = ALC883_DIGIN_NID,
9098 .slave_dig_outs = alc1200_slave_dig_outs,
9099 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9100 .channel_mode = alc883_sixstack_modes,
9101 .input_mux = &alc883_capture_source,
9107 * BIOS auto configuration
9109 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9110 hda_nid_t nid, int pin_type,
9114 struct alc_spec *spec = codec->spec;
9117 alc_set_pin_output(codec, nid, pin_type);
9118 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9121 idx = spec->multiout.dac_nids[dac_idx] - 2;
9122 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9126 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9128 struct alc_spec *spec = codec->spec;
9131 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
9132 for (i = 0; i <= HDA_SIDE; i++) {
9133 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9134 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9136 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9141 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9143 struct alc_spec *spec = codec->spec;
9146 pin = spec->autocfg.hp_pins[0];
9147 if (pin) /* connect to front */
9149 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9150 pin = spec->autocfg.speaker_pins[0];
9152 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9155 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9156 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9158 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9160 struct alc_spec *spec = codec->spec;
9163 for (i = 0; i < AUTO_PIN_LAST; i++) {
9164 hda_nid_t nid = spec->autocfg.input_pins[i];
9165 if (alc883_is_input_pin(nid)) {
9166 snd_hda_codec_write(codec, nid, 0,
9167 AC_VERB_SET_PIN_WIDGET_CONTROL,
9168 (i <= AUTO_PIN_FRONT_MIC ?
9169 PIN_VREF80 : PIN_IN));
9170 if (nid != ALC883_PIN_CD_NID)
9171 snd_hda_codec_write(codec, nid, 0,
9172 AC_VERB_SET_AMP_GAIN_MUTE,
9178 #define alc883_auto_init_input_src alc882_auto_init_input_src
9180 /* almost identical with ALC880 parser... */
9181 static int alc883_parse_auto_config(struct hda_codec *codec)
9183 struct alc_spec *spec = codec->spec;
9184 int err = alc880_parse_auto_config(codec);
9185 struct auto_pin_cfg *cfg = &spec->autocfg;
9191 return 0; /* no config found */
9193 err = alc_auto_add_mic_boost(codec);
9197 /* hack - override the init verbs */
9198 spec->init_verbs[0] = alc883_auto_init_verbs;
9200 /* setup input_mux for ALC889 */
9201 if (codec->vendor_id == 0x10ec0889) {
9202 /* digital-mic input pin is excluded in alc880_auto_create..()
9203 * because it's under 0x18
9205 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9206 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9207 struct hda_input_mux *imux = &spec->private_imux[0];
9208 for (i = 1; i < 3; i++)
9209 memcpy(&spec->private_imux[i],
9210 &spec->private_imux[0],
9211 sizeof(spec->private_imux[0]));
9212 imux->items[imux->num_items].label = "Int DMic";
9213 imux->items[imux->num_items].index = 0x0b;
9215 spec->num_mux_defs = 3;
9216 spec->input_mux = spec->private_imux;
9220 return 1; /* config found */
9223 /* additional initialization for auto-configuration model */
9224 static void alc883_auto_init(struct hda_codec *codec)
9226 struct alc_spec *spec = codec->spec;
9227 alc883_auto_init_multi_out(codec);
9228 alc883_auto_init_hp_out(codec);
9229 alc883_auto_init_analog_input(codec);
9230 alc883_auto_init_input_src(codec);
9231 if (spec->unsol_event)
9232 alc_inithook(codec);
9235 static int patch_alc883(struct hda_codec *codec)
9237 struct alc_spec *spec;
9238 int err, board_config;
9240 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9246 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9248 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9251 if (board_config < 0) {
9252 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9253 "trying auto-probe from BIOS...\n");
9254 board_config = ALC883_AUTO;
9257 if (board_config == ALC883_AUTO) {
9258 /* automatic parse from the BIOS config */
9259 err = alc883_parse_auto_config(codec);
9265 "hda_codec: Cannot set up configuration "
9266 "from BIOS. Using base mode...\n");
9267 board_config = ALC883_3ST_2ch_DIG;
9271 err = snd_hda_attach_beep_device(codec, 0x1);
9277 if (board_config != ALC883_AUTO)
9278 setup_preset(spec, &alc883_presets[board_config]);
9280 switch (codec->vendor_id) {
9282 if (codec->revision_id == 0x100101) {
9283 spec->stream_name_analog = "ALC1200 Analog";
9284 spec->stream_name_digital = "ALC1200 Digital";
9286 spec->stream_name_analog = "ALC888 Analog";
9287 spec->stream_name_digital = "ALC888 Digital";
9289 if (!spec->num_adc_nids) {
9290 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9291 spec->adc_nids = alc883_adc_nids;
9293 if (!spec->capsrc_nids)
9294 spec->capsrc_nids = alc883_capsrc_nids;
9295 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9298 spec->stream_name_analog = "ALC889 Analog";
9299 spec->stream_name_digital = "ALC889 Digital";
9300 if (!spec->num_adc_nids) {
9301 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9302 spec->adc_nids = alc889_adc_nids;
9304 if (!spec->capsrc_nids)
9305 spec->capsrc_nids = alc889_capsrc_nids;
9306 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9310 spec->stream_name_analog = "ALC883 Analog";
9311 spec->stream_name_digital = "ALC883 Digital";
9312 if (!spec->num_adc_nids) {
9313 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9314 spec->adc_nids = alc883_adc_nids;
9316 if (!spec->capsrc_nids)
9317 spec->capsrc_nids = alc883_capsrc_nids;
9318 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9322 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9323 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9324 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9326 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9327 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9329 if (!spec->cap_mixer)
9330 set_capture_mixer(spec);
9331 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9333 spec->vmaster_nid = 0x0c;
9335 codec->patch_ops = alc_patch_ops;
9336 if (board_config == ALC883_AUTO)
9337 spec->init_hook = alc883_auto_init;
9339 #ifdef CONFIG_SND_HDA_POWER_SAVE
9340 if (!spec->loopback.amplist)
9341 spec->loopback.amplist = alc883_loopbacks;
9343 codec->proc_widget_hook = print_realtek_coef;
9352 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9353 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9355 #define alc262_dac_nids alc260_dac_nids
9356 #define alc262_adc_nids alc882_adc_nids
9357 #define alc262_adc_nids_alt alc882_adc_nids_alt
9358 #define alc262_capsrc_nids alc882_capsrc_nids
9359 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9361 #define alc262_modes alc260_modes
9362 #define alc262_capture_source alc882_capture_source
9364 static hda_nid_t alc262_dmic_adc_nids[1] = {
9369 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9371 static struct snd_kcontrol_new alc262_base_mixer[] = {
9372 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9373 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9374 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9375 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9376 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9377 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9380 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9381 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9382 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9383 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9384 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9386 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9387 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9391 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9392 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9393 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9394 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9395 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9399 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9400 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9401 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9402 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9403 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9404 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9405 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9409 /* update HP, line and mono-out pins according to the master switch */
9410 static void alc262_hp_master_update(struct hda_codec *codec)
9412 struct alc_spec *spec = codec->spec;
9413 int val = spec->master_sw;
9416 snd_hda_codec_write_cache(codec, 0x1b, 0,
9417 AC_VERB_SET_PIN_WIDGET_CONTROL,
9419 snd_hda_codec_write_cache(codec, 0x15, 0,
9420 AC_VERB_SET_PIN_WIDGET_CONTROL,
9422 /* mono (speaker) depending on the HP jack sense */
9423 val = val && !spec->jack_present;
9424 snd_hda_codec_write_cache(codec, 0x16, 0,
9425 AC_VERB_SET_PIN_WIDGET_CONTROL,
9429 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9431 struct alc_spec *spec = codec->spec;
9432 unsigned int presence;
9433 presence = snd_hda_codec_read(codec, 0x1b, 0,
9434 AC_VERB_GET_PIN_SENSE, 0);
9435 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9436 alc262_hp_master_update(codec);
9439 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9441 if ((res >> 26) != ALC880_HP_EVENT)
9443 alc262_hp_bpc_automute(codec);
9446 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9448 struct alc_spec *spec = codec->spec;
9449 unsigned int presence;
9450 presence = snd_hda_codec_read(codec, 0x15, 0,
9451 AC_VERB_GET_PIN_SENSE, 0);
9452 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9453 alc262_hp_master_update(codec);
9456 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9459 if ((res >> 26) != ALC880_HP_EVENT)
9461 alc262_hp_wildwest_automute(codec);
9464 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9465 struct snd_ctl_elem_value *ucontrol)
9467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9468 struct alc_spec *spec = codec->spec;
9469 *ucontrol->value.integer.value = spec->master_sw;
9473 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9474 struct snd_ctl_elem_value *ucontrol)
9476 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9477 struct alc_spec *spec = codec->spec;
9478 int val = !!*ucontrol->value.integer.value;
9480 if (val == spec->master_sw)
9482 spec->master_sw = val;
9483 alc262_hp_master_update(codec);
9487 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9490 .name = "Master Playback Switch",
9491 .info = snd_ctl_boolean_mono_info,
9492 .get = alc262_hp_master_sw_get,
9493 .put = alc262_hp_master_sw_put,
9495 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9496 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9497 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9498 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9500 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9504 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9505 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9506 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9507 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9508 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9509 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9510 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9511 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9512 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9513 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9517 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9519 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9520 .name = "Master Playback Switch",
9521 .info = snd_ctl_boolean_mono_info,
9522 .get = alc262_hp_master_sw_get,
9523 .put = alc262_hp_master_sw_put,
9525 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9526 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9527 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9529 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9531 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9533 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9534 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9535 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9536 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9537 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9538 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9539 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9543 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9544 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9545 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9546 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9550 /* mute/unmute internal speaker according to the hp jack and mute state */
9551 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9553 struct alc_spec *spec = codec->spec;
9555 if (force || !spec->sense_updated) {
9556 unsigned int present;
9557 present = snd_hda_codec_read(codec, 0x15, 0,
9558 AC_VERB_GET_PIN_SENSE, 0);
9559 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9560 spec->sense_updated = 1;
9562 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9563 spec->jack_present ? HDA_AMP_MUTE : 0);
9566 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9569 if ((res >> 26) != ALC880_HP_EVENT)
9571 alc262_hp_t5735_automute(codec, 1);
9574 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9576 alc262_hp_t5735_automute(codec, 1);
9579 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9580 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9581 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9582 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9583 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9584 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9585 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9586 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9590 static struct hda_verb alc262_hp_t5735_verbs[] = {
9591 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9594 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9598 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9599 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9600 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9601 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9602 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9603 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9604 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9608 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9609 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9610 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9611 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9612 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9613 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9614 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9618 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9622 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9629 /* bind hp and internal speaker mute (with plug check) */
9630 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9631 struct snd_ctl_elem_value *ucontrol)
9633 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9634 long *valp = ucontrol->value.integer.value;
9637 /* change hp mute */
9638 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9640 valp[0] ? 0 : HDA_AMP_MUTE);
9641 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9643 valp[1] ? 0 : HDA_AMP_MUTE);
9645 /* change speaker according to HP jack state */
9646 struct alc_spec *spec = codec->spec;
9648 if (spec->jack_present)
9649 mute = HDA_AMP_MUTE;
9651 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9653 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9654 HDA_AMP_MUTE, mute);
9659 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9660 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9662 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9663 .name = "Master Playback Switch",
9664 .info = snd_hda_mixer_amp_switch_info,
9665 .get = snd_hda_mixer_amp_switch_get,
9666 .put = alc262_sony_master_sw_put,
9667 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9671 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9672 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9676 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9677 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9678 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9682 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9683 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9687 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9688 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9689 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9690 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9691 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9692 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9693 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9696 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9697 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9698 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9699 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9703 static struct hda_verb alc262_tyan_verbs[] = {
9704 /* Headphone automute */
9705 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9706 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9707 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9709 /* P11 AUX_IN, white 4-pin connector */
9710 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9711 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9712 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9713 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9718 /* unsolicited event for HP jack sensing */
9719 static void alc262_tyan_automute(struct hda_codec *codec)
9722 unsigned int present;
9724 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9725 present = snd_hda_codec_read(codec, 0x1b, 0,
9726 AC_VERB_GET_PIN_SENSE, 0);
9727 present = (present & 0x80000000) != 0;
9729 /* mute line output on ATX panel */
9730 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9731 HDA_AMP_MUTE, HDA_AMP_MUTE);
9733 /* unmute line output if necessary */
9734 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9735 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9736 HDA_AMP_MUTE, mute);
9740 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9743 if ((res >> 26) != ALC880_HP_EVENT)
9745 alc262_tyan_automute(codec);
9748 #define alc262_capture_mixer alc882_capture_mixer
9749 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9752 * generic initialization of ADC, input mixers and output mixers
9754 static struct hda_verb alc262_init_verbs[] = {
9756 * Unmute ADC0-2 and set the default input to mic-in
9758 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9760 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9761 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9762 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9763 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9765 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9767 * Note: PASD motherboards uses the Line In 2 as the input for
9768 * front panel mic (mic 2)
9770 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9771 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9772 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9773 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9774 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9775 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9778 * Set up output mixers (0x0c - 0x0e)
9780 /* set vol=0 to output mixers */
9781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9782 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9784 /* set up input amps for analog loopback */
9785 /* Amp Indices: DAC = 0, mixer = 1 */
9786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9789 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9791 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9793 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9794 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9795 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9796 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9797 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9800 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9803 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9804 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9806 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9807 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9809 /* FIXME: use matrix-type input source selection */
9810 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9811 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9812 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9813 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9814 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9815 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9817 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9818 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9819 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9820 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9822 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9823 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9824 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9830 static struct hda_verb alc262_eapd_verbs[] = {
9831 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9832 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9836 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9837 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9842 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9843 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9844 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9845 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9847 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9848 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9852 static struct hda_verb alc262_sony_unsol_verbs[] = {
9853 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9854 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9857 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9858 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9862 static struct hda_input_mux alc262_dmic_capture_source = {
9865 { "Int DMic", 0x9 },
9870 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9871 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9872 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9873 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9879 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9880 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9882 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9883 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9884 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9885 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9886 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9887 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9891 static void alc262_dmic_automute(struct hda_codec *codec)
9893 unsigned int present;
9895 present = snd_hda_codec_read(codec, 0x18, 0,
9896 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9897 snd_hda_codec_write(codec, 0x22, 0,
9898 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9901 /* toggle speaker-output according to the hp-jack state */
9902 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9904 unsigned int present;
9907 present = snd_hda_codec_read(codec, 0x15, 0,
9908 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9909 bits = present ? 0 : PIN_OUT;
9910 snd_hda_codec_write(codec, 0x14, 0,
9911 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9916 /* unsolicited event for HP jack sensing */
9917 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9920 if ((res >> 26) == ALC880_HP_EVENT)
9921 alc262_toshiba_s06_speaker_automute(codec);
9922 if ((res >> 26) == ALC880_MIC_EVENT)
9923 alc262_dmic_automute(codec);
9927 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9929 alc262_toshiba_s06_speaker_automute(codec);
9930 alc262_dmic_automute(codec);
9933 /* mute/unmute internal speaker according to the hp jack and mute state */
9934 static void alc262_hippo_automute(struct hda_codec *codec)
9936 struct alc_spec *spec = codec->spec;
9938 unsigned int present;
9940 /* need to execute and sync at first */
9941 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9942 present = snd_hda_codec_read(codec, 0x15, 0,
9943 AC_VERB_GET_PIN_SENSE, 0);
9944 spec->jack_present = (present & 0x80000000) != 0;
9945 if (spec->jack_present) {
9946 /* mute internal speaker */
9947 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9948 HDA_AMP_MUTE, HDA_AMP_MUTE);
9950 /* unmute internal speaker if necessary */
9951 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9952 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9953 HDA_AMP_MUTE, mute);
9957 /* unsolicited event for HP jack sensing */
9958 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9961 if ((res >> 26) != ALC880_HP_EVENT)
9963 alc262_hippo_automute(codec);
9966 static void alc262_hippo1_automute(struct hda_codec *codec)
9969 unsigned int present;
9971 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9972 present = snd_hda_codec_read(codec, 0x1b, 0,
9973 AC_VERB_GET_PIN_SENSE, 0);
9974 present = (present & 0x80000000) != 0;
9976 /* mute internal speaker */
9977 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9978 HDA_AMP_MUTE, HDA_AMP_MUTE);
9980 /* unmute internal speaker if necessary */
9981 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9982 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9983 HDA_AMP_MUTE, mute);
9987 /* unsolicited event for HP jack sensing */
9988 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9991 if ((res >> 26) != ALC880_HP_EVENT)
9993 alc262_hippo1_automute(codec);
9999 * 0x16 = internal speaker
10000 * 0x18 = external mic
10003 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10004 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10005 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10009 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10011 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10012 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10016 static struct hda_verb alc262_nec_verbs[] = {
10017 /* Unmute Speaker */
10018 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10021 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10022 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10024 /* External mic to headphone */
10025 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10026 /* External mic to speaker */
10027 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10033 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10034 * 0x1b = port replicator headphone out
10037 #define ALC_HP_EVENT 0x37
10039 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10040 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10041 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10042 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10043 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10047 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10048 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10049 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10053 static struct hda_input_mux alc262_fujitsu_capture_source = {
10057 { "Int Mic", 0x1 },
10062 static struct hda_input_mux alc262_HP_capture_source = {
10066 { "Front Mic", 0x1 },
10073 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10077 { "Front Mic", 0x2 },
10083 /* mute/unmute internal speaker according to the hp jacks and mute state */
10084 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10086 struct alc_spec *spec = codec->spec;
10089 if (force || !spec->sense_updated) {
10090 unsigned int present;
10091 /* need to execute and sync at first */
10092 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10093 /* check laptop HP jack */
10094 present = snd_hda_codec_read(codec, 0x14, 0,
10095 AC_VERB_GET_PIN_SENSE, 0);
10096 /* need to execute and sync at first */
10097 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10098 /* check docking HP jack */
10099 present |= snd_hda_codec_read(codec, 0x1b, 0,
10100 AC_VERB_GET_PIN_SENSE, 0);
10101 if (present & AC_PINSENSE_PRESENCE)
10102 spec->jack_present = 1;
10104 spec->jack_present = 0;
10105 spec->sense_updated = 1;
10107 /* unmute internal speaker only if both HPs are unplugged and
10108 * master switch is on
10110 if (spec->jack_present)
10111 mute = HDA_AMP_MUTE;
10113 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10114 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10115 HDA_AMP_MUTE, mute);
10118 /* unsolicited event for HP jack sensing */
10119 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10122 if ((res >> 26) != ALC_HP_EVENT)
10124 alc262_fujitsu_automute(codec, 1);
10127 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10129 alc262_fujitsu_automute(codec, 1);
10132 /* bind volumes of both NID 0x0c and 0x0d */
10133 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10134 .ops = &snd_hda_bind_vol,
10136 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10137 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10142 /* mute/unmute internal speaker according to the hp jack and mute state */
10143 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10145 struct alc_spec *spec = codec->spec;
10148 if (force || !spec->sense_updated) {
10149 unsigned int present_int_hp;
10150 /* need to execute and sync at first */
10151 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10152 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10153 AC_VERB_GET_PIN_SENSE, 0);
10154 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10155 spec->sense_updated = 1;
10157 if (spec->jack_present) {
10158 /* mute internal speaker */
10159 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10160 HDA_AMP_MUTE, HDA_AMP_MUTE);
10161 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10162 HDA_AMP_MUTE, HDA_AMP_MUTE);
10164 /* unmute internal speaker if necessary */
10165 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10166 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10167 HDA_AMP_MUTE, mute);
10168 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10169 HDA_AMP_MUTE, mute);
10173 /* unsolicited event for HP jack sensing */
10174 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10177 if ((res >> 26) != ALC_HP_EVENT)
10179 alc262_lenovo_3000_automute(codec, 1);
10182 /* bind hp and internal speaker mute (with plug check) */
10183 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10184 struct snd_ctl_elem_value *ucontrol)
10186 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10187 long *valp = ucontrol->value.integer.value;
10190 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10192 valp ? 0 : HDA_AMP_MUTE);
10193 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10195 valp ? 0 : HDA_AMP_MUTE);
10198 alc262_fujitsu_automute(codec, 0);
10202 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10203 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10206 .name = "Master Playback Switch",
10207 .info = snd_hda_mixer_amp_switch_info,
10208 .get = snd_hda_mixer_amp_switch_get,
10209 .put = alc262_fujitsu_master_sw_put,
10210 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10212 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10213 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10214 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10217 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10218 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10219 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10223 /* bind hp and internal speaker mute (with plug check) */
10224 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10225 struct snd_ctl_elem_value *ucontrol)
10227 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10228 long *valp = ucontrol->value.integer.value;
10231 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10233 valp ? 0 : HDA_AMP_MUTE);
10236 alc262_lenovo_3000_automute(codec, 0);
10240 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10241 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10243 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10244 .name = "Master Playback Switch",
10245 .info = snd_hda_mixer_amp_switch_info,
10246 .get = snd_hda_mixer_amp_switch_get,
10247 .put = alc262_lenovo_3000_master_sw_put,
10248 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10250 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10251 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10255 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10256 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10257 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10261 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10262 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10265 .name = "Master Playback Switch",
10266 .info = snd_hda_mixer_amp_switch_info,
10267 .get = snd_hda_mixer_amp_switch_get,
10268 .put = alc262_sony_master_sw_put,
10269 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10274 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10275 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10276 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10280 /* additional init verbs for Benq laptops */
10281 static struct hda_verb alc262_EAPD_verbs[] = {
10282 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10283 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10287 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10288 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10289 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10291 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10292 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10296 /* Samsung Q1 Ultra Vista model setup */
10297 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10298 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10299 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10302 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10303 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10307 static struct hda_verb alc262_ultra_verbs[] = {
10309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10314 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10315 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10316 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10318 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10321 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10322 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10324 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10326 /* ADC, choose mic */
10327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10328 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10330 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10340 /* mute/unmute internal speaker according to the hp jack and mute state */
10341 static void alc262_ultra_automute(struct hda_codec *codec)
10343 struct alc_spec *spec = codec->spec;
10347 /* auto-mute only when HP is used as HP */
10348 if (!spec->cur_mux[0]) {
10349 unsigned int present;
10350 /* need to execute and sync at first */
10351 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10352 present = snd_hda_codec_read(codec, 0x15, 0,
10353 AC_VERB_GET_PIN_SENSE, 0);
10354 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10355 if (spec->jack_present)
10356 mute = HDA_AMP_MUTE;
10358 /* mute/unmute internal speaker */
10359 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10360 HDA_AMP_MUTE, mute);
10361 /* mute/unmute HP */
10362 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10363 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10366 /* unsolicited event for HP jack sensing */
10367 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10370 if ((res >> 26) != ALC880_HP_EVENT)
10372 alc262_ultra_automute(codec);
10375 static struct hda_input_mux alc262_ultra_capture_source = {
10379 { "Headphone", 0x7 },
10383 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10384 struct snd_ctl_elem_value *ucontrol)
10386 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10387 struct alc_spec *spec = codec->spec;
10390 ret = alc_mux_enum_put(kcontrol, ucontrol);
10393 /* reprogram the HP pin as mic or HP according to the input source */
10394 snd_hda_codec_write_cache(codec, 0x15, 0,
10395 AC_VERB_SET_PIN_WIDGET_CONTROL,
10396 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10397 alc262_ultra_automute(codec); /* mute/unmute HP */
10401 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10402 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10403 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10405 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10406 .name = "Capture Source",
10407 .info = alc_mux_enum_info,
10408 .get = alc_mux_enum_get,
10409 .put = alc262_ultra_mux_enum_put,
10414 /* add playback controls from the parsed DAC table */
10415 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10416 const struct auto_pin_cfg *cfg)
10421 spec->multiout.num_dacs = 1; /* only use one dac */
10422 spec->multiout.dac_nids = spec->private_dac_nids;
10423 spec->multiout.dac_nids[0] = 2;
10425 nid = cfg->line_out_pins[0];
10427 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10428 "Front Playback Volume",
10429 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10432 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10433 "Front Playback Switch",
10434 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10439 nid = cfg->speaker_pins[0];
10442 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10443 "Speaker Playback Volume",
10444 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10448 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10449 "Speaker Playback Switch",
10450 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10455 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10456 "Speaker Playback Switch",
10457 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10463 nid = cfg->hp_pins[0];
10465 /* spec->multiout.hp_nid = 2; */
10467 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10468 "Headphone Playback Volume",
10469 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10473 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10474 "Headphone Playback Switch",
10475 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10480 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10481 "Headphone Playback Switch",
10482 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10491 /* identical with ALC880 */
10492 #define alc262_auto_create_analog_input_ctls \
10493 alc880_auto_create_analog_input_ctls
10496 * generic initialization of ADC, input mixers and output mixers
10498 static struct hda_verb alc262_volume_init_verbs[] = {
10500 * Unmute ADC0-2 and set the default input to mic-in
10502 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10504 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10506 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10507 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10509 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10511 * Note: PASD motherboards uses the Line In 2 as the input for
10512 * front panel mic (mic 2)
10514 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10522 * Set up output mixers (0x0c - 0x0f)
10524 /* set vol=0 to output mixers */
10525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10526 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10529 /* set up input amps for analog loopback */
10530 /* Amp Indices: DAC = 0, mixer = 1 */
10531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10533 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10535 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10536 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10538 /* FIXME: use matrix-type input source selection */
10539 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10540 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10559 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10561 * Unmute ADC0-2 and set the default input to mic-in
10563 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10565 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10566 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10567 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10568 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10570 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10572 * Note: PASD motherboards uses the Line In 2 as the input for
10573 * front panel mic (mic 2)
10575 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10578 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10580 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10585 * Set up output mixers (0x0c - 0x0e)
10587 /* set vol=0 to output mixers */
10588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10590 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10592 /* set up input amps for analog loopback */
10593 /* Amp Indices: DAC = 0, mixer = 1 */
10594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10595 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10596 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10597 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10598 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10599 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10601 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10602 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10603 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10605 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10606 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10608 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10611 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10612 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10613 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10614 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10615 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10617 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10618 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10619 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10620 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10621 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10622 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10625 /* FIXME: use matrix-type input source selection */
10626 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10627 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10628 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10629 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10630 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10631 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10633 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10635 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10638 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10643 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10648 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10650 * Unmute ADC0-2 and set the default input to mic-in
10652 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10654 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10656 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10659 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10661 * Note: PASD motherboards uses the Line In 2 as the input for front
10662 * panel mic (mic 2)
10664 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10665 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10666 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10667 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10668 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10669 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10670 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10671 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10672 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10674 * Set up output mixers (0x0c - 0x0e)
10676 /* set vol=0 to output mixers */
10677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10678 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10679 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10681 /* set up input amps for analog loopback */
10682 /* Amp Indices: DAC = 0, mixer = 1 */
10683 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10685 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10686 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10687 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10688 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10693 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10695 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10696 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10697 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10700 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10702 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10703 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10705 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10706 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10707 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10709 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10710 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10712 /* FIXME: use matrix-type input source selection */
10713 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10714 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10715 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10716 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10717 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10718 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10719 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10720 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10721 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10724 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10725 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10726 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10727 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10728 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10729 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10731 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10733 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10734 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10736 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10739 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10744 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10747 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10748 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10751 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10752 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10756 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10757 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10762 #ifdef CONFIG_SND_HDA_POWER_SAVE
10763 #define alc262_loopbacks alc880_loopbacks
10766 /* pcm configuration: identiacal with ALC880 */
10767 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10768 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10769 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10770 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10773 * BIOS auto configuration
10775 static int alc262_parse_auto_config(struct hda_codec *codec)
10777 struct alc_spec *spec = codec->spec;
10779 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10781 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10785 if (!spec->autocfg.line_outs) {
10786 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10787 spec->multiout.max_channels = 2;
10788 spec->no_analog = 1;
10791 return 0; /* can't find valid BIOS pin config */
10793 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10796 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10800 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10803 if (spec->autocfg.dig_outs) {
10804 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10805 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10807 if (spec->autocfg.dig_in_pin)
10808 spec->dig_in_nid = ALC262_DIGIN_NID;
10810 if (spec->kctls.list)
10811 add_mixer(spec, spec->kctls.list);
10813 add_verb(spec, alc262_volume_init_verbs);
10814 spec->num_mux_defs = 1;
10815 spec->input_mux = &spec->private_imux[0];
10817 err = alc_auto_add_mic_boost(codec);
10821 store_pin_configs(codec);
10825 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10826 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10827 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10828 #define alc262_auto_init_input_src alc882_auto_init_input_src
10831 /* init callback for auto-configuration model -- overriding the default init */
10832 static void alc262_auto_init(struct hda_codec *codec)
10834 struct alc_spec *spec = codec->spec;
10835 alc262_auto_init_multi_out(codec);
10836 alc262_auto_init_hp_out(codec);
10837 alc262_auto_init_analog_input(codec);
10838 alc262_auto_init_input_src(codec);
10839 if (spec->unsol_event)
10840 alc_inithook(codec);
10844 * configuration and preset
10846 static const char *alc262_models[ALC262_MODEL_LAST] = {
10847 [ALC262_BASIC] = "basic",
10848 [ALC262_HIPPO] = "hippo",
10849 [ALC262_HIPPO_1] = "hippo_1",
10850 [ALC262_FUJITSU] = "fujitsu",
10851 [ALC262_HP_BPC] = "hp-bpc",
10852 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10853 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10854 [ALC262_HP_RP5700] = "hp-rp5700",
10855 [ALC262_BENQ_ED8] = "benq",
10856 [ALC262_BENQ_T31] = "benq-t31",
10857 [ALC262_SONY_ASSAMD] = "sony-assamd",
10858 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10859 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10860 [ALC262_ULTRA] = "ultra",
10861 [ALC262_LENOVO_3000] = "lenovo-3000",
10862 [ALC262_NEC] = "nec",
10863 [ALC262_TYAN] = "tyan",
10864 [ALC262_AUTO] = "auto",
10867 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10868 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10869 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10870 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10872 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10874 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10875 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10876 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10877 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10878 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10879 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10880 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10881 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10882 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10883 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10884 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10885 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10886 ALC262_HP_TC_T5735),
10887 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10888 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10889 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10890 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10891 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10892 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10893 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10894 ALC262_SONY_ASSAMD),
10895 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10896 ALC262_TOSHIBA_RX1),
10897 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10898 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10899 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10900 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10901 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10903 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10904 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10905 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10906 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10907 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10911 static struct alc_config_preset alc262_presets[] = {
10913 .mixers = { alc262_base_mixer },
10914 .init_verbs = { alc262_init_verbs },
10915 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10916 .dac_nids = alc262_dac_nids,
10918 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10919 .channel_mode = alc262_modes,
10920 .input_mux = &alc262_capture_source,
10923 .mixers = { alc262_base_mixer },
10924 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10925 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10926 .dac_nids = alc262_dac_nids,
10928 .dig_out_nid = ALC262_DIGOUT_NID,
10929 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10930 .channel_mode = alc262_modes,
10931 .input_mux = &alc262_capture_source,
10932 .unsol_event = alc262_hippo_unsol_event,
10933 .init_hook = alc262_hippo_automute,
10935 [ALC262_HIPPO_1] = {
10936 .mixers = { alc262_hippo1_mixer },
10937 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10938 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10939 .dac_nids = alc262_dac_nids,
10941 .dig_out_nid = ALC262_DIGOUT_NID,
10942 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10943 .channel_mode = alc262_modes,
10944 .input_mux = &alc262_capture_source,
10945 .unsol_event = alc262_hippo1_unsol_event,
10946 .init_hook = alc262_hippo1_automute,
10948 [ALC262_FUJITSU] = {
10949 .mixers = { alc262_fujitsu_mixer },
10950 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10951 alc262_fujitsu_unsol_verbs },
10952 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10953 .dac_nids = alc262_dac_nids,
10955 .dig_out_nid = ALC262_DIGOUT_NID,
10956 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10957 .channel_mode = alc262_modes,
10958 .input_mux = &alc262_fujitsu_capture_source,
10959 .unsol_event = alc262_fujitsu_unsol_event,
10960 .init_hook = alc262_fujitsu_init_hook,
10962 [ALC262_HP_BPC] = {
10963 .mixers = { alc262_HP_BPC_mixer },
10964 .init_verbs = { alc262_HP_BPC_init_verbs },
10965 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10966 .dac_nids = alc262_dac_nids,
10968 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10969 .channel_mode = alc262_modes,
10970 .input_mux = &alc262_HP_capture_source,
10971 .unsol_event = alc262_hp_bpc_unsol_event,
10972 .init_hook = alc262_hp_bpc_automute,
10974 [ALC262_HP_BPC_D7000_WF] = {
10975 .mixers = { alc262_HP_BPC_WildWest_mixer },
10976 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10977 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10978 .dac_nids = alc262_dac_nids,
10980 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10981 .channel_mode = alc262_modes,
10982 .input_mux = &alc262_HP_D7000_capture_source,
10983 .unsol_event = alc262_hp_wildwest_unsol_event,
10984 .init_hook = alc262_hp_wildwest_automute,
10986 [ALC262_HP_BPC_D7000_WL] = {
10987 .mixers = { alc262_HP_BPC_WildWest_mixer,
10988 alc262_HP_BPC_WildWest_option_mixer },
10989 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10990 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10991 .dac_nids = alc262_dac_nids,
10993 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10994 .channel_mode = alc262_modes,
10995 .input_mux = &alc262_HP_D7000_capture_source,
10996 .unsol_event = alc262_hp_wildwest_unsol_event,
10997 .init_hook = alc262_hp_wildwest_automute,
10999 [ALC262_HP_TC_T5735] = {
11000 .mixers = { alc262_hp_t5735_mixer },
11001 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11002 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11003 .dac_nids = alc262_dac_nids,
11005 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11006 .channel_mode = alc262_modes,
11007 .input_mux = &alc262_capture_source,
11008 .unsol_event = alc262_hp_t5735_unsol_event,
11009 .init_hook = alc262_hp_t5735_init_hook,
11011 [ALC262_HP_RP5700] = {
11012 .mixers = { alc262_hp_rp5700_mixer },
11013 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11014 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11015 .dac_nids = alc262_dac_nids,
11016 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11017 .channel_mode = alc262_modes,
11018 .input_mux = &alc262_hp_rp5700_capture_source,
11020 [ALC262_BENQ_ED8] = {
11021 .mixers = { alc262_base_mixer },
11022 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11023 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11024 .dac_nids = alc262_dac_nids,
11026 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11027 .channel_mode = alc262_modes,
11028 .input_mux = &alc262_capture_source,
11030 [ALC262_SONY_ASSAMD] = {
11031 .mixers = { alc262_sony_mixer },
11032 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11033 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11034 .dac_nids = alc262_dac_nids,
11036 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11037 .channel_mode = alc262_modes,
11038 .input_mux = &alc262_capture_source,
11039 .unsol_event = alc262_hippo_unsol_event,
11040 .init_hook = alc262_hippo_automute,
11042 [ALC262_BENQ_T31] = {
11043 .mixers = { alc262_benq_t31_mixer },
11044 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11045 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11046 .dac_nids = alc262_dac_nids,
11048 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11049 .channel_mode = alc262_modes,
11050 .input_mux = &alc262_capture_source,
11051 .unsol_event = alc262_hippo_unsol_event,
11052 .init_hook = alc262_hippo_automute,
11055 .mixers = { alc262_ultra_mixer },
11056 .cap_mixer = alc262_ultra_capture_mixer,
11057 .init_verbs = { alc262_ultra_verbs },
11058 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11059 .dac_nids = alc262_dac_nids,
11060 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11061 .channel_mode = alc262_modes,
11062 .input_mux = &alc262_ultra_capture_source,
11063 .adc_nids = alc262_adc_nids, /* ADC0 */
11064 .capsrc_nids = alc262_capsrc_nids,
11065 .num_adc_nids = 1, /* single ADC */
11066 .unsol_event = alc262_ultra_unsol_event,
11067 .init_hook = alc262_ultra_automute,
11069 [ALC262_LENOVO_3000] = {
11070 .mixers = { alc262_lenovo_3000_mixer },
11071 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11072 alc262_lenovo_3000_unsol_verbs },
11073 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11074 .dac_nids = alc262_dac_nids,
11076 .dig_out_nid = ALC262_DIGOUT_NID,
11077 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11078 .channel_mode = alc262_modes,
11079 .input_mux = &alc262_fujitsu_capture_source,
11080 .unsol_event = alc262_lenovo_3000_unsol_event,
11083 .mixers = { alc262_nec_mixer },
11084 .init_verbs = { alc262_nec_verbs },
11085 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11086 .dac_nids = alc262_dac_nids,
11088 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11089 .channel_mode = alc262_modes,
11090 .input_mux = &alc262_capture_source,
11092 [ALC262_TOSHIBA_S06] = {
11093 .mixers = { alc262_toshiba_s06_mixer },
11094 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11095 alc262_eapd_verbs },
11096 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11097 .capsrc_nids = alc262_dmic_capsrc_nids,
11098 .dac_nids = alc262_dac_nids,
11099 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11100 .dig_out_nid = ALC262_DIGOUT_NID,
11101 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11102 .channel_mode = alc262_modes,
11103 .input_mux = &alc262_dmic_capture_source,
11104 .unsol_event = alc262_toshiba_s06_unsol_event,
11105 .init_hook = alc262_toshiba_s06_init_hook,
11107 [ALC262_TOSHIBA_RX1] = {
11108 .mixers = { alc262_toshiba_rx1_mixer },
11109 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11110 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11111 .dac_nids = alc262_dac_nids,
11113 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11114 .channel_mode = alc262_modes,
11115 .input_mux = &alc262_capture_source,
11116 .unsol_event = alc262_hippo_unsol_event,
11117 .init_hook = alc262_hippo_automute,
11120 .mixers = { alc262_tyan_mixer },
11121 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11122 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11123 .dac_nids = alc262_dac_nids,
11125 .dig_out_nid = ALC262_DIGOUT_NID,
11126 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11127 .channel_mode = alc262_modes,
11128 .input_mux = &alc262_capture_source,
11129 .unsol_event = alc262_tyan_unsol_event,
11130 .init_hook = alc262_tyan_automute,
11134 static int patch_alc262(struct hda_codec *codec)
11136 struct alc_spec *spec;
11140 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11144 codec->spec = spec;
11146 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11151 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11152 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11153 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11154 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11158 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11160 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11164 if (board_config < 0) {
11165 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11166 "trying auto-probe from BIOS...\n");
11167 board_config = ALC262_AUTO;
11170 if (board_config == ALC262_AUTO) {
11171 /* automatic parse from the BIOS config */
11172 err = alc262_parse_auto_config(codec);
11178 "hda_codec: Cannot set up configuration "
11179 "from BIOS. Using base mode...\n");
11180 board_config = ALC262_BASIC;
11184 if (!spec->no_analog) {
11185 err = snd_hda_attach_beep_device(codec, 0x1);
11192 if (board_config != ALC262_AUTO)
11193 setup_preset(spec, &alc262_presets[board_config]);
11195 spec->stream_name_analog = "ALC262 Analog";
11196 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11197 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11199 spec->stream_name_digital = "ALC262 Digital";
11200 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11201 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11203 spec->capture_style = CAPT_MIX;
11204 if (!spec->adc_nids && spec->input_mux) {
11205 /* check whether NID 0x07 is valid */
11206 unsigned int wcap = get_wcaps(codec, 0x07);
11209 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11210 if (wcap != AC_WID_AUD_IN) {
11211 spec->adc_nids = alc262_adc_nids_alt;
11212 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11213 spec->capsrc_nids = alc262_capsrc_nids_alt;
11215 spec->adc_nids = alc262_adc_nids;
11216 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11217 spec->capsrc_nids = alc262_capsrc_nids;
11220 if (!spec->cap_mixer && !spec->no_analog)
11221 set_capture_mixer(spec);
11222 if (!spec->no_analog)
11223 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11225 spec->vmaster_nid = 0x0c;
11227 codec->patch_ops = alc_patch_ops;
11228 if (board_config == ALC262_AUTO)
11229 spec->init_hook = alc262_auto_init;
11230 #ifdef CONFIG_SND_HDA_POWER_SAVE
11231 if (!spec->loopback.amplist)
11232 spec->loopback.amplist = alc262_loopbacks;
11234 codec->proc_widget_hook = print_realtek_coef;
11240 * ALC268 channel source setting (2 channel)
11242 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11243 #define alc268_modes alc260_modes
11245 static hda_nid_t alc268_dac_nids[2] = {
11250 static hda_nid_t alc268_adc_nids[2] = {
11255 static hda_nid_t alc268_adc_nids_alt[1] = {
11260 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11262 static struct snd_kcontrol_new alc268_base_mixer[] = {
11263 /* output mixer control */
11264 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11265 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11266 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11268 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11269 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11270 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11274 /* bind Beep switches of both NID 0x0f and 0x10 */
11275 static struct hda_bind_ctls alc268_bind_beep_sw = {
11276 .ops = &snd_hda_bind_sw,
11278 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11279 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11284 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11285 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11286 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11290 static struct hda_verb alc268_eapd_verbs[] = {
11291 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11292 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11296 /* Toshiba specific */
11297 #define alc268_toshiba_automute alc262_hippo_automute
11299 static struct hda_verb alc268_toshiba_verbs[] = {
11300 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11304 static struct hda_input_mux alc268_acer_lc_capture_source = {
11312 /* Acer specific */
11313 /* bind volumes of both NID 0x02 and 0x03 */
11314 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11315 .ops = &snd_hda_bind_vol,
11317 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11318 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11323 /* mute/unmute internal speaker according to the hp jack and mute state */
11324 static void alc268_acer_automute(struct hda_codec *codec, int force)
11326 struct alc_spec *spec = codec->spec;
11329 if (force || !spec->sense_updated) {
11330 unsigned int present;
11331 present = snd_hda_codec_read(codec, 0x14, 0,
11332 AC_VERB_GET_PIN_SENSE, 0);
11333 spec->jack_present = (present & 0x80000000) != 0;
11334 spec->sense_updated = 1;
11336 if (spec->jack_present)
11337 mute = HDA_AMP_MUTE; /* mute internal speaker */
11338 else /* unmute internal speaker if necessary */
11339 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11340 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11341 HDA_AMP_MUTE, mute);
11345 /* bind hp and internal speaker mute (with plug check) */
11346 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11347 struct snd_ctl_elem_value *ucontrol)
11349 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11350 long *valp = ucontrol->value.integer.value;
11353 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11355 valp[0] ? 0 : HDA_AMP_MUTE);
11356 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11358 valp[1] ? 0 : HDA_AMP_MUTE);
11360 alc268_acer_automute(codec, 0);
11364 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11365 /* output mixer control */
11366 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11368 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11369 .name = "Master Playback Switch",
11370 .info = snd_hda_mixer_amp_switch_info,
11371 .get = snd_hda_mixer_amp_switch_get,
11372 .put = alc268_acer_master_sw_put,
11373 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11375 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11379 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11380 /* output mixer control */
11381 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11383 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11384 .name = "Master Playback Switch",
11385 .info = snd_hda_mixer_amp_switch_info,
11386 .get = snd_hda_mixer_amp_switch_get,
11387 .put = alc268_acer_master_sw_put,
11388 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11391 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11392 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11396 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11397 /* output mixer control */
11398 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11400 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11401 .name = "Master Playback Switch",
11402 .info = snd_hda_mixer_amp_switch_info,
11403 .get = snd_hda_mixer_amp_switch_get,
11404 .put = alc268_acer_master_sw_put,
11405 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11407 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11408 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11412 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11413 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11414 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11415 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11416 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11417 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11422 static struct hda_verb alc268_acer_verbs[] = {
11423 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11424 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11426 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11427 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11428 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11429 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11433 /* unsolicited event for HP jack sensing */
11434 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11437 if ((res >> 26) != ALC880_HP_EVENT)
11439 alc268_toshiba_automute(codec);
11442 static void alc268_acer_unsol_event(struct hda_codec *codec,
11445 if ((res >> 26) != ALC880_HP_EVENT)
11447 alc268_acer_automute(codec, 1);
11450 static void alc268_acer_init_hook(struct hda_codec *codec)
11452 alc268_acer_automute(codec, 1);
11455 /* toggle speaker-output according to the hp-jack state */
11456 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11458 unsigned int present;
11459 unsigned char bits;
11461 present = snd_hda_codec_read(codec, 0x15, 0,
11462 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11463 bits = present ? AMP_IN_MUTE(0) : 0;
11464 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11465 AMP_IN_MUTE(0), bits);
11466 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11467 AMP_IN_MUTE(0), bits);
11471 static void alc268_acer_mic_automute(struct hda_codec *codec)
11473 unsigned int present;
11475 present = snd_hda_codec_read(codec, 0x18, 0,
11476 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11477 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11478 present ? 0x0 : 0x6);
11481 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11484 if ((res >> 26) == ALC880_HP_EVENT)
11485 alc268_aspire_one_speaker_automute(codec);
11486 if ((res >> 26) == ALC880_MIC_EVENT)
11487 alc268_acer_mic_automute(codec);
11490 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11492 alc268_aspire_one_speaker_automute(codec);
11493 alc268_acer_mic_automute(codec);
11496 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11497 /* output mixer control */
11498 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11499 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11500 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11501 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11502 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11503 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11507 static struct hda_verb alc268_dell_verbs[] = {
11508 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11509 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11510 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11514 /* mute/unmute internal speaker according to the hp jack and mute state */
11515 static void alc268_dell_automute(struct hda_codec *codec)
11517 unsigned int present;
11520 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11521 if (present & 0x80000000)
11522 mute = HDA_AMP_MUTE;
11524 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11525 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11526 HDA_AMP_MUTE, mute);
11529 static void alc268_dell_unsol_event(struct hda_codec *codec,
11532 if ((res >> 26) != ALC880_HP_EVENT)
11534 alc268_dell_automute(codec);
11537 #define alc268_dell_init_hook alc268_dell_automute
11539 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11540 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11541 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11542 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11544 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11545 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11546 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11547 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11551 static struct hda_verb alc267_quanta_il1_verbs[] = {
11552 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11553 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11557 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11559 unsigned int present;
11561 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11562 & AC_PINSENSE_PRESENCE;
11563 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11564 present ? 0 : PIN_OUT);
11567 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11569 unsigned int present;
11571 present = snd_hda_codec_read(codec, 0x18, 0,
11572 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11573 snd_hda_codec_write(codec, 0x23, 0,
11574 AC_VERB_SET_CONNECT_SEL,
11575 present ? 0x00 : 0x01);
11578 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11580 alc267_quanta_il1_hp_automute(codec);
11581 alc267_quanta_il1_mic_automute(codec);
11584 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11587 switch (res >> 26) {
11588 case ALC880_HP_EVENT:
11589 alc267_quanta_il1_hp_automute(codec);
11591 case ALC880_MIC_EVENT:
11592 alc267_quanta_il1_mic_automute(codec);
11598 * generic initialization of ADC, input mixers and output mixers
11600 static struct hda_verb alc268_base_init_verbs[] = {
11601 /* Unmute DAC0-1 and set vol = 0 */
11602 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11603 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11606 * Set up output mixers (0x0c - 0x0e)
11608 /* set vol=0 to output mixers */
11609 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11610 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11612 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11613 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11616 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11617 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11619 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11620 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11621 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11622 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11624 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11625 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11626 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11627 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11630 /* set PCBEEP vol = 0, mute connections */
11631 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11632 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11633 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11635 /* Unmute Selector 23h,24h and set the default input to mic-in */
11637 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11638 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11639 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11640 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11646 * generic initialization of ADC, input mixers and output mixers
11648 static struct hda_verb alc268_volume_init_verbs[] = {
11649 /* set output DAC */
11650 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11651 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11653 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11654 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11655 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11656 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11657 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11659 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11661 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11663 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11664 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11666 /* set PCBEEP vol = 0, mute connections */
11667 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11668 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11669 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11674 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11675 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11676 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11678 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11679 /* The multiple "Capture Source" controls confuse alsamixer
11680 * So call somewhat different..
11682 /* .name = "Capture Source", */
11683 .name = "Input Source",
11685 .info = alc_mux_enum_info,
11686 .get = alc_mux_enum_get,
11687 .put = alc_mux_enum_put,
11692 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11693 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11694 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11695 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11696 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11698 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11699 /* The multiple "Capture Source" controls confuse alsamixer
11700 * So call somewhat different..
11702 /* .name = "Capture Source", */
11703 .name = "Input Source",
11705 .info = alc_mux_enum_info,
11706 .get = alc_mux_enum_get,
11707 .put = alc_mux_enum_put,
11712 static struct hda_input_mux alc268_capture_source = {
11716 { "Front Mic", 0x1 },
11722 static struct hda_input_mux alc268_acer_capture_source = {
11726 { "Internal Mic", 0x1 },
11731 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11735 { "Internal Mic", 0x6 },
11740 #ifdef CONFIG_SND_DEBUG
11741 static struct snd_kcontrol_new alc268_test_mixer[] = {
11742 /* Volume widgets */
11743 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11744 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11745 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11746 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11747 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11748 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11749 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11750 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11751 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11752 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11753 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11754 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11755 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11756 /* The below appears problematic on some hardwares */
11757 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11758 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11759 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11760 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11761 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11763 /* Modes for retasking pin widgets */
11764 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11765 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11766 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11767 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11769 /* Controls for GPIO pins, assuming they are configured as outputs */
11770 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11771 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11772 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11773 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11775 /* Switches to allow the digital SPDIF output pin to be enabled.
11776 * The ALC268 does not have an SPDIF input.
11778 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11780 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11781 * this output to turn on an external amplifier.
11783 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11784 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11790 /* create input playback/capture controls for the given pin */
11791 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11792 const char *ctlname, int idx)
11797 sprintf(name, "%s Playback Volume", ctlname);
11799 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11800 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11804 } else if (nid == 0x15) {
11805 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11806 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11812 sprintf(name, "%s Playback Switch", ctlname);
11813 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11814 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11820 /* add playback controls from the parsed DAC table */
11821 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11822 const struct auto_pin_cfg *cfg)
11827 spec->multiout.num_dacs = 2; /* only use one dac */
11828 spec->multiout.dac_nids = spec->private_dac_nids;
11829 spec->multiout.dac_nids[0] = 2;
11830 spec->multiout.dac_nids[1] = 3;
11832 nid = cfg->line_out_pins[0];
11834 alc268_new_analog_output(spec, nid, "Front", 0);
11836 nid = cfg->speaker_pins[0];
11838 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11839 "Speaker Playback Volume",
11840 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11844 nid = cfg->hp_pins[0];
11846 alc268_new_analog_output(spec, nid, "Headphone", 0);
11848 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11850 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11851 "Mono Playback Switch",
11852 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11859 /* create playback/capture controls for input pins */
11860 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11861 const struct auto_pin_cfg *cfg)
11863 struct hda_input_mux *imux = &spec->private_imux[0];
11866 for (i = 0; i < AUTO_PIN_LAST; i++) {
11867 switch(cfg->input_pins[i]) {
11869 idx1 = 0; /* Mic 1 */
11872 idx1 = 1; /* Mic 2 */
11875 idx1 = 2; /* Line In */
11882 idx1 = 6; /* digital mics */
11887 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11888 imux->items[imux->num_items].index = idx1;
11894 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11896 struct alc_spec *spec = codec->spec;
11897 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11898 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11899 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11900 unsigned int dac_vol1, dac_vol2;
11903 snd_hda_codec_write(codec, speaker_nid, 0,
11904 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11905 snd_hda_codec_write(codec, 0x0f, 0,
11906 AC_VERB_SET_AMP_GAIN_MUTE,
11908 snd_hda_codec_write(codec, 0x10, 0,
11909 AC_VERB_SET_AMP_GAIN_MUTE,
11912 snd_hda_codec_write(codec, 0x0f, 0,
11913 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11914 snd_hda_codec_write(codec, 0x10, 0,
11915 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11918 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11919 if (line_nid == 0x14)
11920 dac_vol2 = AMP_OUT_ZERO;
11921 else if (line_nid == 0x15)
11922 dac_vol1 = AMP_OUT_ZERO;
11923 if (hp_nid == 0x14)
11924 dac_vol2 = AMP_OUT_ZERO;
11925 else if (hp_nid == 0x15)
11926 dac_vol1 = AMP_OUT_ZERO;
11927 if (line_nid != 0x16 || hp_nid != 0x16 ||
11928 spec->autocfg.line_out_pins[1] != 0x16 ||
11929 spec->autocfg.line_out_pins[2] != 0x16)
11930 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11932 snd_hda_codec_write(codec, 0x02, 0,
11933 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11934 snd_hda_codec_write(codec, 0x03, 0,
11935 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11938 /* pcm configuration: identiacal with ALC880 */
11939 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11940 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11941 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11942 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11945 * BIOS auto configuration
11947 static int alc268_parse_auto_config(struct hda_codec *codec)
11949 struct alc_spec *spec = codec->spec;
11951 static hda_nid_t alc268_ignore[] = { 0 };
11953 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11957 if (!spec->autocfg.line_outs) {
11958 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11959 spec->multiout.max_channels = 2;
11960 spec->no_analog = 1;
11963 return 0; /* can't find valid BIOS pin config */
11965 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11968 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11972 spec->multiout.max_channels = 2;
11975 /* digital only support output */
11976 if (spec->autocfg.dig_outs) {
11977 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11978 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11980 if (spec->kctls.list)
11981 add_mixer(spec, spec->kctls.list);
11983 if (spec->autocfg.speaker_pins[0] != 0x1d)
11984 add_mixer(spec, alc268_beep_mixer);
11986 add_verb(spec, alc268_volume_init_verbs);
11987 spec->num_mux_defs = 1;
11988 spec->input_mux = &spec->private_imux[0];
11990 err = alc_auto_add_mic_boost(codec);
11994 store_pin_configs(codec);
11998 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11999 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12000 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12002 /* init callback for auto-configuration model -- overriding the default init */
12003 static void alc268_auto_init(struct hda_codec *codec)
12005 struct alc_spec *spec = codec->spec;
12006 alc268_auto_init_multi_out(codec);
12007 alc268_auto_init_hp_out(codec);
12008 alc268_auto_init_mono_speaker_out(codec);
12009 alc268_auto_init_analog_input(codec);
12010 if (spec->unsol_event)
12011 alc_inithook(codec);
12015 * configuration and preset
12017 static const char *alc268_models[ALC268_MODEL_LAST] = {
12018 [ALC267_QUANTA_IL1] = "quanta-il1",
12019 [ALC268_3ST] = "3stack",
12020 [ALC268_TOSHIBA] = "toshiba",
12021 [ALC268_ACER] = "acer",
12022 [ALC268_ACER_DMIC] = "acer-dmic",
12023 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12024 [ALC268_DELL] = "dell",
12025 [ALC268_ZEPTO] = "zepto",
12026 #ifdef CONFIG_SND_DEBUG
12027 [ALC268_TEST] = "test",
12029 [ALC268_AUTO] = "auto",
12032 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12033 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12034 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12035 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12036 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12037 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12038 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12039 ALC268_ACER_ASPIRE_ONE),
12040 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12041 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12042 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
12043 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12044 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
12045 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
12046 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
12047 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12048 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12049 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12050 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12054 static struct alc_config_preset alc268_presets[] = {
12055 [ALC267_QUANTA_IL1] = {
12056 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12057 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12058 alc267_quanta_il1_verbs },
12059 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12060 .dac_nids = alc268_dac_nids,
12061 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12062 .adc_nids = alc268_adc_nids_alt,
12064 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12065 .channel_mode = alc268_modes,
12066 .input_mux = &alc268_capture_source,
12067 .unsol_event = alc267_quanta_il1_unsol_event,
12068 .init_hook = alc267_quanta_il1_automute,
12071 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12072 alc268_beep_mixer },
12073 .init_verbs = { alc268_base_init_verbs },
12074 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12075 .dac_nids = alc268_dac_nids,
12076 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12077 .adc_nids = alc268_adc_nids_alt,
12078 .capsrc_nids = alc268_capsrc_nids,
12080 .dig_out_nid = ALC268_DIGOUT_NID,
12081 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12082 .channel_mode = alc268_modes,
12083 .input_mux = &alc268_capture_source,
12085 [ALC268_TOSHIBA] = {
12086 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12087 alc268_beep_mixer },
12088 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12089 alc268_toshiba_verbs },
12090 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12091 .dac_nids = alc268_dac_nids,
12092 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12093 .adc_nids = alc268_adc_nids_alt,
12094 .capsrc_nids = alc268_capsrc_nids,
12096 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12097 .channel_mode = alc268_modes,
12098 .input_mux = &alc268_capture_source,
12099 .unsol_event = alc268_toshiba_unsol_event,
12100 .init_hook = alc268_toshiba_automute,
12103 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12104 alc268_beep_mixer },
12105 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12106 alc268_acer_verbs },
12107 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12108 .dac_nids = alc268_dac_nids,
12109 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12110 .adc_nids = alc268_adc_nids_alt,
12111 .capsrc_nids = alc268_capsrc_nids,
12113 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12114 .channel_mode = alc268_modes,
12115 .input_mux = &alc268_acer_capture_source,
12116 .unsol_event = alc268_acer_unsol_event,
12117 .init_hook = alc268_acer_init_hook,
12119 [ALC268_ACER_DMIC] = {
12120 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12121 alc268_beep_mixer },
12122 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12123 alc268_acer_verbs },
12124 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12125 .dac_nids = alc268_dac_nids,
12126 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12127 .adc_nids = alc268_adc_nids_alt,
12128 .capsrc_nids = alc268_capsrc_nids,
12130 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12131 .channel_mode = alc268_modes,
12132 .input_mux = &alc268_acer_dmic_capture_source,
12133 .unsol_event = alc268_acer_unsol_event,
12134 .init_hook = alc268_acer_init_hook,
12136 [ALC268_ACER_ASPIRE_ONE] = {
12137 .mixers = { alc268_acer_aspire_one_mixer,
12139 alc268_capture_alt_mixer },
12140 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12141 alc268_acer_aspire_one_verbs },
12142 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12143 .dac_nids = alc268_dac_nids,
12144 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12145 .adc_nids = alc268_adc_nids_alt,
12146 .capsrc_nids = alc268_capsrc_nids,
12148 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12149 .channel_mode = alc268_modes,
12150 .input_mux = &alc268_acer_lc_capture_source,
12151 .unsol_event = alc268_acer_lc_unsol_event,
12152 .init_hook = alc268_acer_lc_init_hook,
12155 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12156 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12157 alc268_dell_verbs },
12158 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12159 .dac_nids = alc268_dac_nids,
12161 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12162 .channel_mode = alc268_modes,
12163 .unsol_event = alc268_dell_unsol_event,
12164 .init_hook = alc268_dell_init_hook,
12165 .input_mux = &alc268_capture_source,
12168 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12169 alc268_beep_mixer },
12170 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12171 alc268_toshiba_verbs },
12172 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12173 .dac_nids = alc268_dac_nids,
12174 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12175 .adc_nids = alc268_adc_nids_alt,
12176 .capsrc_nids = alc268_capsrc_nids,
12178 .dig_out_nid = ALC268_DIGOUT_NID,
12179 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12180 .channel_mode = alc268_modes,
12181 .input_mux = &alc268_capture_source,
12182 .unsol_event = alc268_toshiba_unsol_event,
12183 .init_hook = alc268_toshiba_automute
12185 #ifdef CONFIG_SND_DEBUG
12187 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12188 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12189 alc268_volume_init_verbs },
12190 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12191 .dac_nids = alc268_dac_nids,
12192 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12193 .adc_nids = alc268_adc_nids_alt,
12194 .capsrc_nids = alc268_capsrc_nids,
12196 .dig_out_nid = ALC268_DIGOUT_NID,
12197 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12198 .channel_mode = alc268_modes,
12199 .input_mux = &alc268_capture_source,
12204 static int patch_alc268(struct hda_codec *codec)
12206 struct alc_spec *spec;
12208 int i, has_beep, err;
12210 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12214 codec->spec = spec;
12216 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12220 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12221 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12222 "trying auto-probe from BIOS...\n");
12223 board_config = ALC268_AUTO;
12226 if (board_config == ALC268_AUTO) {
12227 /* automatic parse from the BIOS config */
12228 err = alc268_parse_auto_config(codec);
12234 "hda_codec: Cannot set up configuration "
12235 "from BIOS. Using base mode...\n");
12236 board_config = ALC268_3ST;
12240 if (board_config != ALC268_AUTO)
12241 setup_preset(spec, &alc268_presets[board_config]);
12243 if (codec->vendor_id == 0x10ec0267) {
12244 spec->stream_name_analog = "ALC267 Analog";
12245 spec->stream_name_digital = "ALC267 Digital";
12247 spec->stream_name_analog = "ALC268 Analog";
12248 spec->stream_name_digital = "ALC268 Digital";
12251 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12252 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12253 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12255 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12258 for (i = 0; i < spec->num_mixers; i++) {
12259 if (spec->mixers[i] == alc268_beep_mixer) {
12266 err = snd_hda_attach_beep_device(codec, 0x1);
12271 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12272 /* override the amp caps for beep generator */
12273 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12274 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12275 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12276 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12277 (0 << AC_AMPCAP_MUTE_SHIFT));
12280 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12281 /* check whether NID 0x07 is valid */
12282 unsigned int wcap = get_wcaps(codec, 0x07);
12286 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12287 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12288 spec->adc_nids = alc268_adc_nids_alt;
12289 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12290 add_mixer(spec, alc268_capture_alt_mixer);
12292 spec->adc_nids = alc268_adc_nids;
12293 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12294 add_mixer(spec, alc268_capture_mixer);
12296 spec->capsrc_nids = alc268_capsrc_nids;
12297 /* set default input source */
12298 for (i = 0; i < spec->num_adc_nids; i++)
12299 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12300 0, AC_VERB_SET_CONNECT_SEL,
12301 spec->input_mux->items[0].index);
12304 spec->vmaster_nid = 0x02;
12306 codec->patch_ops = alc_patch_ops;
12307 if (board_config == ALC268_AUTO)
12308 spec->init_hook = alc268_auto_init;
12310 codec->proc_widget_hook = print_realtek_coef;
12316 * ALC269 channel source setting (2 channel)
12318 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12320 #define alc269_dac_nids alc260_dac_nids
12322 static hda_nid_t alc269_adc_nids[1] = {
12327 static hda_nid_t alc269_capsrc_nids[1] = {
12331 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12335 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12343 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12351 #define alc269_modes alc260_modes
12352 #define alc269_capture_source alc880_lg_lw_capture_source
12354 static struct snd_kcontrol_new alc269_base_mixer[] = {
12355 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12356 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12361 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12362 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12363 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12364 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12366 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12370 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12371 /* output mixer control */
12372 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12374 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12375 .name = "Master Playback Switch",
12376 .info = snd_hda_mixer_amp_switch_info,
12377 .get = snd_hda_mixer_amp_switch_get,
12378 .put = alc268_acer_master_sw_put,
12379 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12383 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12384 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12385 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12386 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12390 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12391 /* output mixer control */
12392 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12394 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12395 .name = "Master Playback Switch",
12396 .info = snd_hda_mixer_amp_switch_info,
12397 .get = snd_hda_mixer_amp_switch_get,
12398 .put = alc268_acer_master_sw_put,
12399 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12403 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12404 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12405 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12406 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12407 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12408 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12409 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12413 /* bind volumes of both NID 0x0c and 0x0d */
12414 static struct hda_bind_ctls alc269_epc_bind_vol = {
12415 .ops = &snd_hda_bind_vol,
12417 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12418 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12423 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12424 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12425 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12426 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12430 /* capture mixer elements */
12431 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12432 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12433 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12434 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12439 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12440 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12441 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12442 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12446 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12447 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12448 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12450 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12451 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12452 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12456 static struct hda_verb alc269_lifebook_verbs[] = {
12457 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12458 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12459 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12461 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12462 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12463 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12464 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12465 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12466 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12470 /* toggle speaker-output according to the hp-jack state */
12471 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12473 unsigned int present;
12474 unsigned char bits;
12476 present = snd_hda_codec_read(codec, 0x15, 0,
12477 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12478 bits = present ? AMP_IN_MUTE(0) : 0;
12479 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12480 AMP_IN_MUTE(0), bits);
12481 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12482 AMP_IN_MUTE(0), bits);
12484 snd_hda_codec_write(codec, 0x20, 0,
12485 AC_VERB_SET_COEF_INDEX, 0x0c);
12486 snd_hda_codec_write(codec, 0x20, 0,
12487 AC_VERB_SET_PROC_COEF, 0x680);
12489 snd_hda_codec_write(codec, 0x20, 0,
12490 AC_VERB_SET_COEF_INDEX, 0x0c);
12491 snd_hda_codec_write(codec, 0x20, 0,
12492 AC_VERB_SET_PROC_COEF, 0x480);
12495 /* toggle speaker-output according to the hp-jacks state */
12496 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12498 unsigned int present;
12499 unsigned char bits;
12501 /* Check laptop headphone socket */
12502 present = snd_hda_codec_read(codec, 0x15, 0,
12503 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12505 /* Check port replicator headphone socket */
12506 present |= snd_hda_codec_read(codec, 0x1a, 0,
12507 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12509 bits = present ? AMP_IN_MUTE(0) : 0;
12510 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12511 AMP_IN_MUTE(0), bits);
12512 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12513 AMP_IN_MUTE(0), bits);
12515 snd_hda_codec_write(codec, 0x20, 0,
12516 AC_VERB_SET_COEF_INDEX, 0x0c);
12517 snd_hda_codec_write(codec, 0x20, 0,
12518 AC_VERB_SET_PROC_COEF, 0x680);
12520 snd_hda_codec_write(codec, 0x20, 0,
12521 AC_VERB_SET_COEF_INDEX, 0x0c);
12522 snd_hda_codec_write(codec, 0x20, 0,
12523 AC_VERB_SET_PROC_COEF, 0x480);
12526 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12528 unsigned int present;
12530 present = snd_hda_codec_read(codec, 0x18, 0,
12531 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12532 snd_hda_codec_write(codec, 0x23, 0,
12533 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12536 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12538 unsigned int present_laptop;
12539 unsigned int present_dock;
12541 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12542 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12544 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12545 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12547 /* Laptop mic port overrides dock mic port, design decision */
12549 snd_hda_codec_write(codec, 0x23, 0,
12550 AC_VERB_SET_CONNECT_SEL, 0x3);
12551 if (present_laptop)
12552 snd_hda_codec_write(codec, 0x23, 0,
12553 AC_VERB_SET_CONNECT_SEL, 0x0);
12554 if (!present_dock && !present_laptop)
12555 snd_hda_codec_write(codec, 0x23, 0,
12556 AC_VERB_SET_CONNECT_SEL, 0x1);
12559 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12562 if ((res >> 26) == ALC880_HP_EVENT)
12563 alc269_quanta_fl1_speaker_automute(codec);
12564 if ((res >> 26) == ALC880_MIC_EVENT)
12565 alc269_quanta_fl1_mic_automute(codec);
12568 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12571 if ((res >> 26) == ALC880_HP_EVENT)
12572 alc269_lifebook_speaker_automute(codec);
12573 if ((res >> 26) == ALC880_MIC_EVENT)
12574 alc269_lifebook_mic_autoswitch(codec);
12577 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12579 alc269_quanta_fl1_speaker_automute(codec);
12580 alc269_quanta_fl1_mic_automute(codec);
12583 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12585 alc269_lifebook_speaker_automute(codec);
12586 alc269_lifebook_mic_autoswitch(codec);
12589 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12590 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12591 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12592 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12594 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12595 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12596 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12600 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12601 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12602 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12603 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12604 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12605 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12606 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12610 /* toggle speaker-output according to the hp-jack state */
12611 static void alc269_speaker_automute(struct hda_codec *codec)
12613 unsigned int present;
12614 unsigned char bits;
12616 present = snd_hda_codec_read(codec, 0x15, 0,
12617 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12618 bits = present ? AMP_IN_MUTE(0) : 0;
12619 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12620 AMP_IN_MUTE(0), bits);
12621 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12622 AMP_IN_MUTE(0), bits);
12625 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12627 unsigned int present;
12629 present = snd_hda_codec_read(codec, 0x18, 0,
12630 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12631 snd_hda_codec_write(codec, 0x23, 0,
12632 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12635 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12637 unsigned int present;
12639 present = snd_hda_codec_read(codec, 0x18, 0,
12640 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12641 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12642 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12643 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12644 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12647 /* unsolicited event for HP jack sensing */
12648 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12651 if ((res >> 26) == ALC880_HP_EVENT)
12652 alc269_speaker_automute(codec);
12654 if ((res >> 26) == ALC880_MIC_EVENT)
12655 alc269_eeepc_dmic_automute(codec);
12658 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12660 alc269_speaker_automute(codec);
12661 alc269_eeepc_dmic_automute(codec);
12664 /* unsolicited event for HP jack sensing */
12665 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12668 if ((res >> 26) == ALC880_HP_EVENT)
12669 alc269_speaker_automute(codec);
12671 if ((res >> 26) == ALC880_MIC_EVENT)
12672 alc269_eeepc_amic_automute(codec);
12675 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12677 alc269_speaker_automute(codec);
12678 alc269_eeepc_amic_automute(codec);
12682 * generic initialization of ADC, input mixers and output mixers
12684 static struct hda_verb alc269_init_verbs[] = {
12686 * Unmute ADC0 and set the default input to mic-in
12688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12690 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12691 * analog-loopback mixer widget
12692 * Note: PASD motherboards uses the Line In 2 as the input for
12693 * front panel mic (mic 2)
12695 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12703 * Set up output mixers (0x0c - 0x0e)
12705 /* set vol=0 to output mixers */
12706 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12707 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12709 /* set up input amps for analog loopback */
12710 /* Amp Indices: DAC = 0, mixer = 1 */
12711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12714 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12718 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12720 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12721 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12722 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12723 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12724 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12726 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12728 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12729 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12731 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12732 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12734 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12735 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12737 /* FIXME: use matrix-type input source selection */
12738 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12739 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12741 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12742 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12743 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12746 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12747 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12751 /* add playback controls from the parsed DAC table */
12752 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12753 const struct auto_pin_cfg *cfg)
12758 spec->multiout.num_dacs = 1; /* only use one dac */
12759 spec->multiout.dac_nids = spec->private_dac_nids;
12760 spec->multiout.dac_nids[0] = 2;
12762 nid = cfg->line_out_pins[0];
12764 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12765 "Front Playback Volume",
12766 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12769 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12770 "Front Playback Switch",
12771 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12776 nid = cfg->speaker_pins[0];
12778 if (!cfg->line_out_pins[0]) {
12779 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12780 "Speaker Playback Volume",
12781 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12787 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12788 "Speaker Playback Switch",
12789 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12794 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12795 "Speaker Playback Switch",
12796 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12802 nid = cfg->hp_pins[0];
12804 /* spec->multiout.hp_nid = 2; */
12805 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12806 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12807 "Headphone Playback Volume",
12808 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12814 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12815 "Headphone Playback Switch",
12816 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12821 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12822 "Headphone Playback Switch",
12823 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12832 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12833 const struct auto_pin_cfg *cfg)
12837 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12840 /* digital-mic input pin is excluded in alc880_auto_create..()
12841 * because it's under 0x18
12843 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12844 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12845 struct hda_input_mux *imux = &spec->private_imux[0];
12846 imux->items[imux->num_items].label = "Int Mic";
12847 imux->items[imux->num_items].index = 0x05;
12853 #ifdef CONFIG_SND_HDA_POWER_SAVE
12854 #define alc269_loopbacks alc880_loopbacks
12857 /* pcm configuration: identiacal with ALC880 */
12858 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12859 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12860 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12861 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12864 * BIOS auto configuration
12866 static int alc269_parse_auto_config(struct hda_codec *codec)
12868 struct alc_spec *spec = codec->spec;
12870 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12872 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12877 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12880 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12884 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12886 if (spec->autocfg.dig_outs)
12887 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12889 if (spec->kctls.list)
12890 add_mixer(spec, spec->kctls.list);
12892 add_verb(spec, alc269_init_verbs);
12893 spec->num_mux_defs = 1;
12894 spec->input_mux = &spec->private_imux[0];
12895 /* set default input source */
12896 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12897 0, AC_VERB_SET_CONNECT_SEL,
12898 spec->input_mux->items[0].index);
12900 err = alc_auto_add_mic_boost(codec);
12904 if (!spec->cap_mixer && !spec->no_analog)
12905 set_capture_mixer(spec);
12907 store_pin_configs(codec);
12911 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12912 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12913 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12916 /* init callback for auto-configuration model -- overriding the default init */
12917 static void alc269_auto_init(struct hda_codec *codec)
12919 struct alc_spec *spec = codec->spec;
12920 alc269_auto_init_multi_out(codec);
12921 alc269_auto_init_hp_out(codec);
12922 alc269_auto_init_analog_input(codec);
12923 if (spec->unsol_event)
12924 alc_inithook(codec);
12928 * configuration and preset
12930 static const char *alc269_models[ALC269_MODEL_LAST] = {
12931 [ALC269_BASIC] = "basic",
12932 [ALC269_QUANTA_FL1] = "quanta",
12933 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12934 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12935 [ALC269_FUJITSU] = "fujitsu",
12936 [ALC269_LIFEBOOK] = "lifebook"
12939 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12940 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12941 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12942 ALC269_ASUS_EEEPC_P703),
12943 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12944 ALC269_ASUS_EEEPC_P901),
12945 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12946 ALC269_ASUS_EEEPC_P901),
12947 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12948 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12952 static struct alc_config_preset alc269_presets[] = {
12954 .mixers = { alc269_base_mixer },
12955 .init_verbs = { alc269_init_verbs },
12956 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12957 .dac_nids = alc269_dac_nids,
12959 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12960 .channel_mode = alc269_modes,
12961 .input_mux = &alc269_capture_source,
12963 [ALC269_QUANTA_FL1] = {
12964 .mixers = { alc269_quanta_fl1_mixer },
12965 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12966 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12967 .dac_nids = alc269_dac_nids,
12969 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12970 .channel_mode = alc269_modes,
12971 .input_mux = &alc269_capture_source,
12972 .unsol_event = alc269_quanta_fl1_unsol_event,
12973 .init_hook = alc269_quanta_fl1_init_hook,
12975 [ALC269_ASUS_EEEPC_P703] = {
12976 .mixers = { alc269_eeepc_mixer },
12977 .cap_mixer = alc269_epc_capture_mixer,
12978 .init_verbs = { alc269_init_verbs,
12979 alc269_eeepc_amic_init_verbs },
12980 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12981 .dac_nids = alc269_dac_nids,
12983 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12984 .channel_mode = alc269_modes,
12985 .input_mux = &alc269_eeepc_amic_capture_source,
12986 .unsol_event = alc269_eeepc_amic_unsol_event,
12987 .init_hook = alc269_eeepc_amic_inithook,
12989 [ALC269_ASUS_EEEPC_P901] = {
12990 .mixers = { alc269_eeepc_mixer },
12991 .cap_mixer = alc269_epc_capture_mixer,
12992 .init_verbs = { alc269_init_verbs,
12993 alc269_eeepc_dmic_init_verbs },
12994 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12995 .dac_nids = alc269_dac_nids,
12997 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12998 .channel_mode = alc269_modes,
12999 .input_mux = &alc269_eeepc_dmic_capture_source,
13000 .unsol_event = alc269_eeepc_dmic_unsol_event,
13001 .init_hook = alc269_eeepc_dmic_inithook,
13003 [ALC269_FUJITSU] = {
13004 .mixers = { alc269_fujitsu_mixer },
13005 .cap_mixer = alc269_epc_capture_mixer,
13006 .init_verbs = { alc269_init_verbs,
13007 alc269_eeepc_dmic_init_verbs },
13008 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13009 .dac_nids = alc269_dac_nids,
13011 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13012 .channel_mode = alc269_modes,
13013 .input_mux = &alc269_eeepc_dmic_capture_source,
13014 .unsol_event = alc269_eeepc_dmic_unsol_event,
13015 .init_hook = alc269_eeepc_dmic_inithook,
13017 [ALC269_LIFEBOOK] = {
13018 .mixers = { alc269_lifebook_mixer },
13019 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13020 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13021 .dac_nids = alc269_dac_nids,
13023 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13024 .channel_mode = alc269_modes,
13025 .input_mux = &alc269_capture_source,
13026 .unsol_event = alc269_lifebook_unsol_event,
13027 .init_hook = alc269_lifebook_init_hook,
13031 static int patch_alc269(struct hda_codec *codec)
13033 struct alc_spec *spec;
13037 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13041 codec->spec = spec;
13043 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13045 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13049 if (board_config < 0) {
13050 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
13051 "trying auto-probe from BIOS...\n");
13052 board_config = ALC269_AUTO;
13055 if (board_config == ALC269_AUTO) {
13056 /* automatic parse from the BIOS config */
13057 err = alc269_parse_auto_config(codec);
13063 "hda_codec: Cannot set up configuration "
13064 "from BIOS. Using base mode...\n");
13065 board_config = ALC269_BASIC;
13069 err = snd_hda_attach_beep_device(codec, 0x1);
13075 if (board_config != ALC269_AUTO)
13076 setup_preset(spec, &alc269_presets[board_config]);
13078 spec->stream_name_analog = "ALC269 Analog";
13079 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13080 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13082 spec->stream_name_digital = "ALC269 Digital";
13083 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13084 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13086 spec->adc_nids = alc269_adc_nids;
13087 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13088 spec->capsrc_nids = alc269_capsrc_nids;
13089 if (!spec->cap_mixer)
13090 set_capture_mixer(spec);
13091 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13093 codec->patch_ops = alc_patch_ops;
13094 if (board_config == ALC269_AUTO)
13095 spec->init_hook = alc269_auto_init;
13096 #ifdef CONFIG_SND_HDA_POWER_SAVE
13097 if (!spec->loopback.amplist)
13098 spec->loopback.amplist = alc269_loopbacks;
13100 codec->proc_widget_hook = print_realtek_coef;
13106 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13110 * set the path ways for 2 channel output
13111 * need to set the codec line out and mic 1 pin widgets to inputs
13113 static struct hda_verb alc861_threestack_ch2_init[] = {
13114 /* set pin widget 1Ah (line in) for input */
13115 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13116 /* set pin widget 18h (mic1/2) for input, for mic also enable
13119 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13121 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13123 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13124 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13130 * need to set the codec line out and mic 1 pin widgets to outputs
13132 static struct hda_verb alc861_threestack_ch6_init[] = {
13133 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13134 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13135 /* set pin widget 18h (mic1) for output (CLFE)*/
13136 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13138 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13139 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13141 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13143 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13144 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13149 static struct hda_channel_mode alc861_threestack_modes[2] = {
13150 { 2, alc861_threestack_ch2_init },
13151 { 6, alc861_threestack_ch6_init },
13153 /* Set mic1 as input and unmute the mixer */
13154 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13155 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13156 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13159 /* Set mic1 as output and mute mixer */
13160 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13161 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13162 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13166 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13167 { 2, alc861_uniwill_m31_ch2_init },
13168 { 4, alc861_uniwill_m31_ch4_init },
13171 /* Set mic1 and line-in as input and unmute the mixer */
13172 static struct hda_verb alc861_asus_ch2_init[] = {
13173 /* set pin widget 1Ah (line in) for input */
13174 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13175 /* set pin widget 18h (mic1/2) for input, for mic also enable
13178 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13180 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13182 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13183 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13187 /* Set mic1 nad line-in as output and mute mixer */
13188 static struct hda_verb alc861_asus_ch6_init[] = {
13189 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13190 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13191 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13192 /* set pin widget 18h (mic1) for output (CLFE)*/
13193 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13194 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13195 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13196 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13198 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13200 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13201 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13206 static struct hda_channel_mode alc861_asus_modes[2] = {
13207 { 2, alc861_asus_ch2_init },
13208 { 6, alc861_asus_ch6_init },
13213 static struct snd_kcontrol_new alc861_base_mixer[] = {
13214 /* output mixer control */
13215 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13216 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13217 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13218 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13219 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13221 /*Input mixer control */
13222 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13223 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13224 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13225 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13226 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13227 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13229 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13230 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13231 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13236 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13237 /* output mixer control */
13238 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13239 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13240 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13241 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13242 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13244 /* Input mixer control */
13245 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13246 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13247 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13248 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13249 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13250 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13252 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13253 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13257 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13258 .name = "Channel Mode",
13259 .info = alc_ch_mode_info,
13260 .get = alc_ch_mode_get,
13261 .put = alc_ch_mode_put,
13262 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13267 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13268 /* output mixer control */
13269 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13271 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13276 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13277 /* output mixer control */
13278 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13279 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13280 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13281 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13282 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13284 /* Input mixer control */
13285 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13286 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13287 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13288 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13289 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13290 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13291 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13292 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13293 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13294 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13297 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13298 .name = "Channel Mode",
13299 .info = alc_ch_mode_info,
13300 .get = alc_ch_mode_get,
13301 .put = alc_ch_mode_put,
13302 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13307 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13308 /* output mixer control */
13309 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13310 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13311 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13312 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13313 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13315 /* Input mixer control */
13316 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13317 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13318 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13319 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13320 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13321 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13323 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13324 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13325 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13328 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13329 .name = "Channel Mode",
13330 .info = alc_ch_mode_info,
13331 .get = alc_ch_mode_get,
13332 .put = alc_ch_mode_put,
13333 .private_value = ARRAY_SIZE(alc861_asus_modes),
13338 /* additional mixer */
13339 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13340 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13341 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13346 * generic initialization of ADC, input mixers and output mixers
13348 static struct hda_verb alc861_base_init_verbs[] = {
13350 * Unmute ADC0 and set the default input to mic-in
13352 /* port-A for surround (rear panel) */
13353 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13354 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13355 /* port-B for mic-in (rear panel) with vref */
13356 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13357 /* port-C for line-in (rear panel) */
13358 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13359 /* port-D for Front */
13360 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13361 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13362 /* port-E for HP out (front panel) */
13363 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13364 /* route front PCM to HP */
13365 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13366 /* port-F for mic-in (front panel) with vref */
13367 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13368 /* port-G for CLFE (rear panel) */
13369 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13370 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13371 /* port-H for side (rear panel) */
13372 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13373 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13375 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13376 /* route front mic to ADC1*/
13377 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13380 /* Unmute DAC0~3 & spdif out*/
13381 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13382 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13383 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13384 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13387 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13388 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13389 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13390 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13391 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13393 /* Unmute Stereo Mixer 15 */
13394 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13397 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13399 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13400 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13401 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13402 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13403 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13404 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13405 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13406 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13407 /* hp used DAC 3 (Front) */
13408 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13409 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13414 static struct hda_verb alc861_threestack_init_verbs[] = {
13416 * Unmute ADC0 and set the default input to mic-in
13418 /* port-A for surround (rear panel) */
13419 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13420 /* port-B for mic-in (rear panel) with vref */
13421 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13422 /* port-C for line-in (rear panel) */
13423 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13424 /* port-D for Front */
13425 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13426 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13427 /* port-E for HP out (front panel) */
13428 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13429 /* route front PCM to HP */
13430 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13431 /* port-F for mic-in (front panel) with vref */
13432 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13433 /* port-G for CLFE (rear panel) */
13434 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13435 /* port-H for side (rear panel) */
13436 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13438 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13439 /* route front mic to ADC1*/
13440 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13442 /* Unmute DAC0~3 & spdif out*/
13443 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13444 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13445 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13446 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13447 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13449 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13450 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13451 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13452 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13453 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13455 /* Unmute Stereo Mixer 15 */
13456 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13457 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13458 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13459 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13461 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13462 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13463 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13464 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13465 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13466 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13467 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13468 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13469 /* hp used DAC 3 (Front) */
13470 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13471 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13475 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13477 * Unmute ADC0 and set the default input to mic-in
13479 /* port-A for surround (rear panel) */
13480 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13481 /* port-B for mic-in (rear panel) with vref */
13482 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13483 /* port-C for line-in (rear panel) */
13484 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13485 /* port-D for Front */
13486 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13487 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13488 /* port-E for HP out (front panel) */
13489 /* this has to be set to VREF80 */
13490 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13491 /* route front PCM to HP */
13492 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13493 /* port-F for mic-in (front panel) with vref */
13494 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13495 /* port-G for CLFE (rear panel) */
13496 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13497 /* port-H for side (rear panel) */
13498 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13500 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13501 /* route front mic to ADC1*/
13502 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13504 /* Unmute DAC0~3 & spdif out*/
13505 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13506 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13507 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13508 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13511 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13512 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13513 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13514 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13515 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13517 /* Unmute Stereo Mixer 15 */
13518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13519 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13521 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13523 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13524 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13525 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13526 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13527 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13528 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13529 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13530 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13531 /* hp used DAC 3 (Front) */
13532 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13533 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13537 static struct hda_verb alc861_asus_init_verbs[] = {
13539 * Unmute ADC0 and set the default input to mic-in
13541 /* port-A for surround (rear panel)
13542 * according to codec#0 this is the HP jack
13544 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13545 /* route front PCM to HP */
13546 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13547 /* port-B for mic-in (rear panel) with vref */
13548 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13549 /* port-C for line-in (rear panel) */
13550 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13551 /* port-D for Front */
13552 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13553 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13554 /* port-E for HP out (front panel) */
13555 /* this has to be set to VREF80 */
13556 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13557 /* route front PCM to HP */
13558 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13559 /* port-F for mic-in (front panel) with vref */
13560 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13561 /* port-G for CLFE (rear panel) */
13562 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13563 /* port-H for side (rear panel) */
13564 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13566 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13567 /* route front mic to ADC1*/
13568 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13569 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13570 /* Unmute DAC0~3 & spdif out*/
13571 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13572 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13573 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13574 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13576 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13577 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13578 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13579 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13580 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13582 /* Unmute Stereo Mixer 15 */
13583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13584 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13585 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13586 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13588 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13589 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13590 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13591 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13592 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13593 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13594 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13595 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13596 /* hp used DAC 3 (Front) */
13597 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13598 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13602 /* additional init verbs for ASUS laptops */
13603 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13604 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13605 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13610 * generic initialization of ADC, input mixers and output mixers
13612 static struct hda_verb alc861_auto_init_verbs[] = {
13614 * Unmute ADC0 and set the default input to mic-in
13616 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13617 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13619 /* Unmute DAC0~3 & spdif out*/
13620 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13621 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13622 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13623 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13626 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13627 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13628 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13629 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13630 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13632 /* Unmute Stereo Mixer 15 */
13633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13634 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13638 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13639 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13640 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13641 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13642 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13644 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13645 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13648 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13649 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13650 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13651 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13652 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13653 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13654 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13656 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13661 static struct hda_verb alc861_toshiba_init_verbs[] = {
13662 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13667 /* toggle speaker-output according to the hp-jack state */
13668 static void alc861_toshiba_automute(struct hda_codec *codec)
13670 unsigned int present;
13672 present = snd_hda_codec_read(codec, 0x0f, 0,
13673 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13674 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13675 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13676 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13677 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13680 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13683 if ((res >> 26) == ALC880_HP_EVENT)
13684 alc861_toshiba_automute(codec);
13687 /* pcm configuration: identiacal with ALC880 */
13688 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13689 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13690 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13691 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13694 #define ALC861_DIGOUT_NID 0x07
13696 static struct hda_channel_mode alc861_8ch_modes[1] = {
13700 static hda_nid_t alc861_dac_nids[4] = {
13701 /* front, surround, clfe, side */
13702 0x03, 0x06, 0x05, 0x04
13705 static hda_nid_t alc660_dac_nids[3] = {
13706 /* front, clfe, surround */
13710 static hda_nid_t alc861_adc_nids[1] = {
13715 static struct hda_input_mux alc861_capture_source = {
13719 { "Front Mic", 0x3 },
13726 /* fill in the dac_nids table from the parsed pin configuration */
13727 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13728 const struct auto_pin_cfg *cfg)
13733 spec->multiout.dac_nids = spec->private_dac_nids;
13734 for (i = 0; i < cfg->line_outs; i++) {
13735 nid = cfg->line_out_pins[i];
13737 if (i >= ARRAY_SIZE(alc861_dac_nids))
13739 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13742 spec->multiout.num_dacs = cfg->line_outs;
13746 /* add playback controls from the parsed DAC table */
13747 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13748 const struct auto_pin_cfg *cfg)
13751 static const char *chname[4] = {
13752 "Front", "Surround", NULL /*CLFE*/, "Side"
13757 for (i = 0; i < cfg->line_outs; i++) {
13758 nid = spec->multiout.dac_nids[i];
13763 err = add_control(spec, ALC_CTL_BIND_MUTE,
13764 "Center Playback Switch",
13765 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13769 err = add_control(spec, ALC_CTL_BIND_MUTE,
13770 "LFE Playback Switch",
13771 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13776 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13778 if (nid == alc861_dac_nids[idx])
13780 sprintf(name, "%s Playback Switch", chname[idx]);
13781 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13782 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13791 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13799 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13801 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13802 "Headphone Playback Switch",
13803 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13806 spec->multiout.hp_nid = nid;
13811 /* create playback/capture controls for input pins */
13812 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13813 const struct auto_pin_cfg *cfg)
13815 struct hda_input_mux *imux = &spec->private_imux[0];
13816 int i, err, idx, idx1;
13818 for (i = 0; i < AUTO_PIN_LAST; i++) {
13819 switch (cfg->input_pins[i]) {
13822 idx = 2; /* Line In */
13826 idx = 2; /* Line In */
13830 idx = 1; /* Mic In */
13834 idx = 1; /* Mic In */
13844 err = new_analog_input(spec, cfg->input_pins[i],
13845 auto_pin_cfg_labels[i], idx, 0x15);
13849 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13850 imux->items[imux->num_items].index = idx1;
13856 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13858 int pin_type, int dac_idx)
13860 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13862 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13866 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13868 struct alc_spec *spec = codec->spec;
13871 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13872 for (i = 0; i < spec->autocfg.line_outs; i++) {
13873 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13874 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13876 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13877 spec->multiout.dac_nids[i]);
13881 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13883 struct alc_spec *spec = codec->spec;
13886 pin = spec->autocfg.hp_pins[0];
13887 if (pin) /* connect to front */
13888 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13889 spec->multiout.dac_nids[0]);
13890 pin = spec->autocfg.speaker_pins[0];
13892 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13895 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13897 struct alc_spec *spec = codec->spec;
13900 for (i = 0; i < AUTO_PIN_LAST; i++) {
13901 hda_nid_t nid = spec->autocfg.input_pins[i];
13902 if (nid >= 0x0c && nid <= 0x11) {
13903 snd_hda_codec_write(codec, nid, 0,
13904 AC_VERB_SET_PIN_WIDGET_CONTROL,
13905 i <= AUTO_PIN_FRONT_MIC ?
13906 PIN_VREF80 : PIN_IN);
13911 /* parse the BIOS configuration and set up the alc_spec */
13912 /* return 1 if successful, 0 if the proper config is not found,
13913 * or a negative error code
13915 static int alc861_parse_auto_config(struct hda_codec *codec)
13917 struct alc_spec *spec = codec->spec;
13919 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13921 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13925 if (!spec->autocfg.line_outs)
13926 return 0; /* can't find valid BIOS pin config */
13928 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13931 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13934 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13937 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13941 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13943 if (spec->autocfg.dig_outs)
13944 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13946 if (spec->kctls.list)
13947 add_mixer(spec, spec->kctls.list);
13949 add_verb(spec, alc861_auto_init_verbs);
13951 spec->num_mux_defs = 1;
13952 spec->input_mux = &spec->private_imux[0];
13954 spec->adc_nids = alc861_adc_nids;
13955 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13956 set_capture_mixer(spec);
13958 store_pin_configs(codec);
13962 /* additional initialization for auto-configuration model */
13963 static void alc861_auto_init(struct hda_codec *codec)
13965 struct alc_spec *spec = codec->spec;
13966 alc861_auto_init_multi_out(codec);
13967 alc861_auto_init_hp_out(codec);
13968 alc861_auto_init_analog_input(codec);
13969 if (spec->unsol_event)
13970 alc_inithook(codec);
13973 #ifdef CONFIG_SND_HDA_POWER_SAVE
13974 static struct hda_amp_list alc861_loopbacks[] = {
13975 { 0x15, HDA_INPUT, 0 },
13976 { 0x15, HDA_INPUT, 1 },
13977 { 0x15, HDA_INPUT, 2 },
13978 { 0x15, HDA_INPUT, 3 },
13985 * configuration and preset
13987 static const char *alc861_models[ALC861_MODEL_LAST] = {
13988 [ALC861_3ST] = "3stack",
13989 [ALC660_3ST] = "3stack-660",
13990 [ALC861_3ST_DIG] = "3stack-dig",
13991 [ALC861_6ST_DIG] = "6stack-dig",
13992 [ALC861_UNIWILL_M31] = "uniwill-m31",
13993 [ALC861_TOSHIBA] = "toshiba",
13994 [ALC861_ASUS] = "asus",
13995 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13996 [ALC861_AUTO] = "auto",
13999 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14000 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14001 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14002 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14003 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14004 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14005 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14006 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14007 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14008 * Any other models that need this preset?
14010 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14011 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14012 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14013 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14014 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14015 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14016 /* FIXME: the below seems conflict */
14017 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14018 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14019 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14023 static struct alc_config_preset alc861_presets[] = {
14025 .mixers = { alc861_3ST_mixer },
14026 .init_verbs = { alc861_threestack_init_verbs },
14027 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14028 .dac_nids = alc861_dac_nids,
14029 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14030 .channel_mode = alc861_threestack_modes,
14032 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14033 .adc_nids = alc861_adc_nids,
14034 .input_mux = &alc861_capture_source,
14036 [ALC861_3ST_DIG] = {
14037 .mixers = { alc861_base_mixer },
14038 .init_verbs = { alc861_threestack_init_verbs },
14039 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14040 .dac_nids = alc861_dac_nids,
14041 .dig_out_nid = ALC861_DIGOUT_NID,
14042 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14043 .channel_mode = alc861_threestack_modes,
14045 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14046 .adc_nids = alc861_adc_nids,
14047 .input_mux = &alc861_capture_source,
14049 [ALC861_6ST_DIG] = {
14050 .mixers = { alc861_base_mixer },
14051 .init_verbs = { alc861_base_init_verbs },
14052 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14053 .dac_nids = alc861_dac_nids,
14054 .dig_out_nid = ALC861_DIGOUT_NID,
14055 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14056 .channel_mode = alc861_8ch_modes,
14057 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14058 .adc_nids = alc861_adc_nids,
14059 .input_mux = &alc861_capture_source,
14062 .mixers = { alc861_3ST_mixer },
14063 .init_verbs = { alc861_threestack_init_verbs },
14064 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14065 .dac_nids = alc660_dac_nids,
14066 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14067 .channel_mode = alc861_threestack_modes,
14069 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14070 .adc_nids = alc861_adc_nids,
14071 .input_mux = &alc861_capture_source,
14073 [ALC861_UNIWILL_M31] = {
14074 .mixers = { alc861_uniwill_m31_mixer },
14075 .init_verbs = { alc861_uniwill_m31_init_verbs },
14076 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14077 .dac_nids = alc861_dac_nids,
14078 .dig_out_nid = ALC861_DIGOUT_NID,
14079 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14080 .channel_mode = alc861_uniwill_m31_modes,
14082 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14083 .adc_nids = alc861_adc_nids,
14084 .input_mux = &alc861_capture_source,
14086 [ALC861_TOSHIBA] = {
14087 .mixers = { alc861_toshiba_mixer },
14088 .init_verbs = { alc861_base_init_verbs,
14089 alc861_toshiba_init_verbs },
14090 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14091 .dac_nids = alc861_dac_nids,
14092 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14093 .channel_mode = alc883_3ST_2ch_modes,
14094 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14095 .adc_nids = alc861_adc_nids,
14096 .input_mux = &alc861_capture_source,
14097 .unsol_event = alc861_toshiba_unsol_event,
14098 .init_hook = alc861_toshiba_automute,
14101 .mixers = { alc861_asus_mixer },
14102 .init_verbs = { alc861_asus_init_verbs },
14103 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14104 .dac_nids = alc861_dac_nids,
14105 .dig_out_nid = ALC861_DIGOUT_NID,
14106 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14107 .channel_mode = alc861_asus_modes,
14110 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14111 .adc_nids = alc861_adc_nids,
14112 .input_mux = &alc861_capture_source,
14114 [ALC861_ASUS_LAPTOP] = {
14115 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14116 .init_verbs = { alc861_asus_init_verbs,
14117 alc861_asus_laptop_init_verbs },
14118 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14119 .dac_nids = alc861_dac_nids,
14120 .dig_out_nid = ALC861_DIGOUT_NID,
14121 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14122 .channel_mode = alc883_3ST_2ch_modes,
14124 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14125 .adc_nids = alc861_adc_nids,
14126 .input_mux = &alc861_capture_source,
14131 static int patch_alc861(struct hda_codec *codec)
14133 struct alc_spec *spec;
14137 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14141 codec->spec = spec;
14143 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14147 if (board_config < 0) {
14148 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14149 "trying auto-probe from BIOS...\n");
14150 board_config = ALC861_AUTO;
14153 if (board_config == ALC861_AUTO) {
14154 /* automatic parse from the BIOS config */
14155 err = alc861_parse_auto_config(codec);
14161 "hda_codec: Cannot set up configuration "
14162 "from BIOS. Using base mode...\n");
14163 board_config = ALC861_3ST_DIG;
14167 err = snd_hda_attach_beep_device(codec, 0x23);
14173 if (board_config != ALC861_AUTO)
14174 setup_preset(spec, &alc861_presets[board_config]);
14176 spec->stream_name_analog = "ALC861 Analog";
14177 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14178 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14180 spec->stream_name_digital = "ALC861 Digital";
14181 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14182 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14184 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14186 spec->vmaster_nid = 0x03;
14188 codec->patch_ops = alc_patch_ops;
14189 if (board_config == ALC861_AUTO)
14190 spec->init_hook = alc861_auto_init;
14191 #ifdef CONFIG_SND_HDA_POWER_SAVE
14192 if (!spec->loopback.amplist)
14193 spec->loopback.amplist = alc861_loopbacks;
14195 codec->proc_widget_hook = print_realtek_coef;
14201 * ALC861-VD support
14205 * In addition, an independent DAC
14207 #define ALC861VD_DIGOUT_NID 0x06
14209 static hda_nid_t alc861vd_dac_nids[4] = {
14210 /* front, surr, clfe, side surr */
14211 0x02, 0x03, 0x04, 0x05
14214 /* dac_nids for ALC660vd are in a different order - according to
14215 * Realtek's driver.
14216 * This should probably tesult in a different mixer for 6stack models
14217 * of ALC660vd codecs, but for now there is only 3stack mixer
14218 * - and it is the same as in 861vd.
14219 * adc_nids in ALC660vd are (is) the same as in 861vd
14221 static hda_nid_t alc660vd_dac_nids[3] = {
14222 /* front, rear, clfe, rear_surr */
14226 static hda_nid_t alc861vd_adc_nids[1] = {
14231 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14234 /* FIXME: should be a matrix-type input source selection */
14235 static struct hda_input_mux alc861vd_capture_source = {
14239 { "Front Mic", 0x1 },
14245 static struct hda_input_mux alc861vd_dallas_capture_source = {
14248 { "Ext Mic", 0x0 },
14249 { "Int Mic", 0x1 },
14253 static struct hda_input_mux alc861vd_hp_capture_source = {
14256 { "Front Mic", 0x0 },
14257 { "ATAPI Mic", 0x1 },
14264 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14271 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14272 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14273 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14274 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14275 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14282 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14283 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14284 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14285 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14286 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14290 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14291 { 6, alc861vd_6stack_ch6_init },
14292 { 8, alc861vd_6stack_ch8_init },
14295 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14297 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14298 .name = "Channel Mode",
14299 .info = alc_ch_mode_info,
14300 .get = alc_ch_mode_get,
14301 .put = alc_ch_mode_put,
14306 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14307 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14309 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14310 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14311 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14313 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14314 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14316 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14318 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14320 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14321 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14323 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14324 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14326 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14328 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14329 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14330 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14332 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14333 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14334 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14336 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14337 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14339 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14340 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14345 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14346 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14347 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14351 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14355 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14356 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14357 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14359 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14360 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14362 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14363 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14368 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14369 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14370 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14371 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14375 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14379 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14380 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14381 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14383 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14384 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14389 /* Pin assignment: Speaker=0x14, HP = 0x15,
14390 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14392 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14393 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14394 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14395 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14396 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14397 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14398 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14399 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14400 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14401 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14402 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14406 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14407 * Front Mic=0x18, ATAPI Mic = 0x19,
14409 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14410 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14411 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14412 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14413 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14414 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14415 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14416 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14417 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14423 * generic initialization of ADC, input mixers and output mixers
14425 static struct hda_verb alc861vd_volume_init_verbs[] = {
14427 * Unmute ADC0 and set the default input to mic-in
14429 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14430 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14432 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14433 * the analog-loopback mixer widget
14435 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14438 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14442 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14443 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14444 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14445 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14446 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14449 * Set up output mixers (0x02 - 0x05)
14451 /* set vol=0 to output mixers */
14452 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14453 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14454 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14455 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14457 /* set up input amps for analog loopback */
14458 /* Amp Indices: DAC = 0, mixer = 1 */
14459 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14461 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14463 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14472 * 3-stack pin configuration:
14473 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14475 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14477 * Set pin mode and muting
14479 /* set front pin widgets 0x14 for output */
14480 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14481 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14482 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14484 /* Mic (rear) pin: input vref at 80% */
14485 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14486 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14487 /* Front Mic pin: input vref at 80% */
14488 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14489 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14490 /* Line In pin: input */
14491 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14492 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14493 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14494 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14495 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14496 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14497 /* CD pin widget for input */
14498 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14504 * 6-stack pin configuration:
14506 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14508 * Set pin mode and muting
14510 /* set front pin widgets 0x14 for output */
14511 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14513 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14515 /* Rear Pin: output 1 (0x0d) */
14516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14519 /* CLFE Pin: output 2 (0x0e) */
14520 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14521 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14522 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14523 /* Side Pin: output 3 (0x0f) */
14524 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14525 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14526 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14528 /* Mic (rear) pin: input vref at 80% */
14529 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14530 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14531 /* Front Mic pin: input vref at 80% */
14532 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14533 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14534 /* Line In pin: input */
14535 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14536 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14537 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14538 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14539 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14540 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14541 /* CD pin widget for input */
14542 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14547 static struct hda_verb alc861vd_eapd_verbs[] = {
14548 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14552 static struct hda_verb alc660vd_eapd_verbs[] = {
14553 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14554 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14558 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14562 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14563 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14567 /* toggle speaker-output according to the hp-jack state */
14568 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14570 unsigned int present;
14571 unsigned char bits;
14573 present = snd_hda_codec_read(codec, 0x1b, 0,
14574 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14575 bits = present ? HDA_AMP_MUTE : 0;
14576 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14577 HDA_AMP_MUTE, bits);
14580 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14582 unsigned int present;
14583 unsigned char bits;
14585 present = snd_hda_codec_read(codec, 0x18, 0,
14586 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14587 bits = present ? HDA_AMP_MUTE : 0;
14588 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14589 HDA_AMP_MUTE, bits);
14592 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14594 alc861vd_lenovo_hp_automute(codec);
14595 alc861vd_lenovo_mic_automute(codec);
14598 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14601 switch (res >> 26) {
14602 case ALC880_HP_EVENT:
14603 alc861vd_lenovo_hp_automute(codec);
14605 case ALC880_MIC_EVENT:
14606 alc861vd_lenovo_mic_automute(codec);
14611 static struct hda_verb alc861vd_dallas_verbs[] = {
14612 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14613 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14614 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14615 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14623 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14624 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14626 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14627 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14630 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14631 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14632 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14633 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14635 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14636 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14637 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14639 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14640 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14641 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14642 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14645 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14650 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14651 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14656 /* toggle speaker-output according to the hp-jack state */
14657 static void alc861vd_dallas_automute(struct hda_codec *codec)
14659 unsigned int present;
14661 present = snd_hda_codec_read(codec, 0x15, 0,
14662 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14663 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14664 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14667 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14669 if ((res >> 26) == ALC880_HP_EVENT)
14670 alc861vd_dallas_automute(codec);
14673 #ifdef CONFIG_SND_HDA_POWER_SAVE
14674 #define alc861vd_loopbacks alc880_loopbacks
14677 /* pcm configuration: identiacal with ALC880 */
14678 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14679 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14680 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14681 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14684 * configuration and preset
14686 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14687 [ALC660VD_3ST] = "3stack-660",
14688 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14689 [ALC660VD_ASUS_V1S] = "asus-v1s",
14690 [ALC861VD_3ST] = "3stack",
14691 [ALC861VD_3ST_DIG] = "3stack-digout",
14692 [ALC861VD_6ST_DIG] = "6stack-digout",
14693 [ALC861VD_LENOVO] = "lenovo",
14694 [ALC861VD_DALLAS] = "dallas",
14695 [ALC861VD_HP] = "hp",
14696 [ALC861VD_AUTO] = "auto",
14699 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14700 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14701 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14702 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14703 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14704 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14705 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14706 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14707 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14708 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14709 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14710 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14711 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14712 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14713 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14714 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14718 static struct alc_config_preset alc861vd_presets[] = {
14720 .mixers = { alc861vd_3st_mixer },
14721 .init_verbs = { alc861vd_volume_init_verbs,
14722 alc861vd_3stack_init_verbs },
14723 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14724 .dac_nids = alc660vd_dac_nids,
14725 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14726 .channel_mode = alc861vd_3stack_2ch_modes,
14727 .input_mux = &alc861vd_capture_source,
14729 [ALC660VD_3ST_DIG] = {
14730 .mixers = { alc861vd_3st_mixer },
14731 .init_verbs = { alc861vd_volume_init_verbs,
14732 alc861vd_3stack_init_verbs },
14733 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14734 .dac_nids = alc660vd_dac_nids,
14735 .dig_out_nid = ALC861VD_DIGOUT_NID,
14736 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14737 .channel_mode = alc861vd_3stack_2ch_modes,
14738 .input_mux = &alc861vd_capture_source,
14741 .mixers = { alc861vd_3st_mixer },
14742 .init_verbs = { alc861vd_volume_init_verbs,
14743 alc861vd_3stack_init_verbs },
14744 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14745 .dac_nids = alc861vd_dac_nids,
14746 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14747 .channel_mode = alc861vd_3stack_2ch_modes,
14748 .input_mux = &alc861vd_capture_source,
14750 [ALC861VD_3ST_DIG] = {
14751 .mixers = { alc861vd_3st_mixer },
14752 .init_verbs = { alc861vd_volume_init_verbs,
14753 alc861vd_3stack_init_verbs },
14754 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14755 .dac_nids = alc861vd_dac_nids,
14756 .dig_out_nid = ALC861VD_DIGOUT_NID,
14757 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14758 .channel_mode = alc861vd_3stack_2ch_modes,
14759 .input_mux = &alc861vd_capture_source,
14761 [ALC861VD_6ST_DIG] = {
14762 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14763 .init_verbs = { alc861vd_volume_init_verbs,
14764 alc861vd_6stack_init_verbs },
14765 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14766 .dac_nids = alc861vd_dac_nids,
14767 .dig_out_nid = ALC861VD_DIGOUT_NID,
14768 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14769 .channel_mode = alc861vd_6stack_modes,
14770 .input_mux = &alc861vd_capture_source,
14772 [ALC861VD_LENOVO] = {
14773 .mixers = { alc861vd_lenovo_mixer },
14774 .init_verbs = { alc861vd_volume_init_verbs,
14775 alc861vd_3stack_init_verbs,
14776 alc861vd_eapd_verbs,
14777 alc861vd_lenovo_unsol_verbs },
14778 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14779 .dac_nids = alc660vd_dac_nids,
14780 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14781 .channel_mode = alc861vd_3stack_2ch_modes,
14782 .input_mux = &alc861vd_capture_source,
14783 .unsol_event = alc861vd_lenovo_unsol_event,
14784 .init_hook = alc861vd_lenovo_automute,
14786 [ALC861VD_DALLAS] = {
14787 .mixers = { alc861vd_dallas_mixer },
14788 .init_verbs = { alc861vd_dallas_verbs },
14789 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14790 .dac_nids = alc861vd_dac_nids,
14791 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14792 .channel_mode = alc861vd_3stack_2ch_modes,
14793 .input_mux = &alc861vd_dallas_capture_source,
14794 .unsol_event = alc861vd_dallas_unsol_event,
14795 .init_hook = alc861vd_dallas_automute,
14798 .mixers = { alc861vd_hp_mixer },
14799 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14800 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14801 .dac_nids = alc861vd_dac_nids,
14802 .dig_out_nid = ALC861VD_DIGOUT_NID,
14803 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14804 .channel_mode = alc861vd_3stack_2ch_modes,
14805 .input_mux = &alc861vd_hp_capture_source,
14806 .unsol_event = alc861vd_dallas_unsol_event,
14807 .init_hook = alc861vd_dallas_automute,
14809 [ALC660VD_ASUS_V1S] = {
14810 .mixers = { alc861vd_lenovo_mixer },
14811 .init_verbs = { alc861vd_volume_init_verbs,
14812 alc861vd_3stack_init_verbs,
14813 alc861vd_eapd_verbs,
14814 alc861vd_lenovo_unsol_verbs },
14815 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14816 .dac_nids = alc660vd_dac_nids,
14817 .dig_out_nid = ALC861VD_DIGOUT_NID,
14818 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14819 .channel_mode = alc861vd_3stack_2ch_modes,
14820 .input_mux = &alc861vd_capture_source,
14821 .unsol_event = alc861vd_lenovo_unsol_event,
14822 .init_hook = alc861vd_lenovo_automute,
14827 * BIOS auto configuration
14829 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14830 hda_nid_t nid, int pin_type, int dac_idx)
14832 alc_set_pin_output(codec, nid, pin_type);
14835 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14837 struct alc_spec *spec = codec->spec;
14840 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14841 for (i = 0; i <= HDA_SIDE; i++) {
14842 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14843 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14845 alc861vd_auto_set_output_and_unmute(codec, nid,
14851 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14853 struct alc_spec *spec = codec->spec;
14856 pin = spec->autocfg.hp_pins[0];
14857 if (pin) /* connect to front and use dac 0 */
14858 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14859 pin = spec->autocfg.speaker_pins[0];
14861 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14864 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14865 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14867 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14869 struct alc_spec *spec = codec->spec;
14872 for (i = 0; i < AUTO_PIN_LAST; i++) {
14873 hda_nid_t nid = spec->autocfg.input_pins[i];
14874 if (alc861vd_is_input_pin(nid)) {
14875 snd_hda_codec_write(codec, nid, 0,
14876 AC_VERB_SET_PIN_WIDGET_CONTROL,
14877 i <= AUTO_PIN_FRONT_MIC ?
14878 PIN_VREF80 : PIN_IN);
14879 if (nid != ALC861VD_PIN_CD_NID)
14880 snd_hda_codec_write(codec, nid, 0,
14881 AC_VERB_SET_AMP_GAIN_MUTE,
14887 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14889 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14890 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14892 /* add playback controls from the parsed DAC table */
14893 /* Based on ALC880 version. But ALC861VD has separate,
14894 * different NIDs for mute/unmute switch and volume control */
14895 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14896 const struct auto_pin_cfg *cfg)
14899 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14900 hda_nid_t nid_v, nid_s;
14903 for (i = 0; i < cfg->line_outs; i++) {
14904 if (!spec->multiout.dac_nids[i])
14906 nid_v = alc861vd_idx_to_mixer_vol(
14908 spec->multiout.dac_nids[i]));
14909 nid_s = alc861vd_idx_to_mixer_switch(
14911 spec->multiout.dac_nids[i]));
14915 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14916 "Center Playback Volume",
14917 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14921 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14922 "LFE Playback Volume",
14923 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14927 err = add_control(spec, ALC_CTL_BIND_MUTE,
14928 "Center Playback Switch",
14929 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14933 err = add_control(spec, ALC_CTL_BIND_MUTE,
14934 "LFE Playback Switch",
14935 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14940 sprintf(name, "%s Playback Volume", chname[i]);
14941 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14942 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14946 sprintf(name, "%s Playback Switch", chname[i]);
14947 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14948 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14957 /* add playback controls for speaker and HP outputs */
14958 /* Based on ALC880 version. But ALC861VD has separate,
14959 * different NIDs for mute/unmute switch and volume control */
14960 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14961 hda_nid_t pin, const char *pfx)
14963 hda_nid_t nid_v, nid_s;
14970 if (alc880_is_fixed_pin(pin)) {
14971 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14972 /* specify the DAC as the extra output */
14973 if (!spec->multiout.hp_nid)
14974 spec->multiout.hp_nid = nid_v;
14976 spec->multiout.extra_out_nid[0] = nid_v;
14977 /* control HP volume/switch on the output mixer amp */
14978 nid_v = alc861vd_idx_to_mixer_vol(
14979 alc880_fixed_pin_idx(pin));
14980 nid_s = alc861vd_idx_to_mixer_switch(
14981 alc880_fixed_pin_idx(pin));
14983 sprintf(name, "%s Playback Volume", pfx);
14984 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14985 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14988 sprintf(name, "%s Playback Switch", pfx);
14989 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14990 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14993 } else if (alc880_is_multi_pin(pin)) {
14994 /* set manual connection */
14995 /* we have only a switch on HP-out PIN */
14996 sprintf(name, "%s Playback Switch", pfx);
14997 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14998 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15005 /* parse the BIOS configuration and set up the alc_spec
15006 * return 1 if successful, 0 if the proper config is not found,
15007 * or a negative error code
15008 * Based on ALC880 version - had to change it to override
15009 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15010 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15012 struct alc_spec *spec = codec->spec;
15014 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15016 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15020 if (!spec->autocfg.line_outs)
15021 return 0; /* can't find valid BIOS pin config */
15023 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15026 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15029 err = alc861vd_auto_create_extra_out(spec,
15030 spec->autocfg.speaker_pins[0],
15034 err = alc861vd_auto_create_extra_out(spec,
15035 spec->autocfg.hp_pins[0],
15039 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15043 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15045 if (spec->autocfg.dig_outs)
15046 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15048 if (spec->kctls.list)
15049 add_mixer(spec, spec->kctls.list);
15051 add_verb(spec, alc861vd_volume_init_verbs);
15053 spec->num_mux_defs = 1;
15054 spec->input_mux = &spec->private_imux[0];
15056 err = alc_auto_add_mic_boost(codec);
15060 store_pin_configs(codec);
15064 /* additional initialization for auto-configuration model */
15065 static void alc861vd_auto_init(struct hda_codec *codec)
15067 struct alc_spec *spec = codec->spec;
15068 alc861vd_auto_init_multi_out(codec);
15069 alc861vd_auto_init_hp_out(codec);
15070 alc861vd_auto_init_analog_input(codec);
15071 alc861vd_auto_init_input_src(codec);
15072 if (spec->unsol_event)
15073 alc_inithook(codec);
15076 static int patch_alc861vd(struct hda_codec *codec)
15078 struct alc_spec *spec;
15079 int err, board_config;
15081 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15085 codec->spec = spec;
15087 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15091 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15092 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
15093 "ALC861VD, trying auto-probe from BIOS...\n");
15094 board_config = ALC861VD_AUTO;
15097 if (board_config == ALC861VD_AUTO) {
15098 /* automatic parse from the BIOS config */
15099 err = alc861vd_parse_auto_config(codec);
15105 "hda_codec: Cannot set up configuration "
15106 "from BIOS. Using base mode...\n");
15107 board_config = ALC861VD_3ST;
15111 err = snd_hda_attach_beep_device(codec, 0x23);
15117 if (board_config != ALC861VD_AUTO)
15118 setup_preset(spec, &alc861vd_presets[board_config]);
15120 if (codec->vendor_id == 0x10ec0660) {
15121 spec->stream_name_analog = "ALC660-VD Analog";
15122 spec->stream_name_digital = "ALC660-VD Digital";
15123 /* always turn on EAPD */
15124 add_verb(spec, alc660vd_eapd_verbs);
15126 spec->stream_name_analog = "ALC861VD Analog";
15127 spec->stream_name_digital = "ALC861VD Digital";
15130 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15131 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15133 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15134 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15136 spec->adc_nids = alc861vd_adc_nids;
15137 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15138 spec->capsrc_nids = alc861vd_capsrc_nids;
15139 spec->capture_style = CAPT_MIX;
15141 set_capture_mixer(spec);
15142 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15144 spec->vmaster_nid = 0x02;
15146 codec->patch_ops = alc_patch_ops;
15148 if (board_config == ALC861VD_AUTO)
15149 spec->init_hook = alc861vd_auto_init;
15150 #ifdef CONFIG_SND_HDA_POWER_SAVE
15151 if (!spec->loopback.amplist)
15152 spec->loopback.amplist = alc861vd_loopbacks;
15154 codec->proc_widget_hook = print_realtek_coef;
15162 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15163 * configuration. Each pin widget can choose any input DACs and a mixer.
15164 * Each ADC is connected from a mixer of all inputs. This makes possible
15165 * 6-channel independent captures.
15167 * In addition, an independent DAC for the multi-playback (not used in this
15170 #define ALC662_DIGOUT_NID 0x06
15171 #define ALC662_DIGIN_NID 0x0a
15173 static hda_nid_t alc662_dac_nids[4] = {
15174 /* front, rear, clfe, rear_surr */
15178 static hda_nid_t alc662_adc_nids[1] = {
15183 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15186 /* FIXME: should be a matrix-type input source selection */
15187 static struct hda_input_mux alc662_capture_source = {
15191 { "Front Mic", 0x1 },
15197 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15205 static struct hda_input_mux alc662_eeepc_capture_source = {
15213 static struct hda_input_mux alc663_capture_source = {
15217 { "Front Mic", 0x1 },
15222 static struct hda_input_mux alc663_m51va_capture_source = {
15225 { "Ext-Mic", 0x0 },
15233 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15240 static struct hda_verb alc662_3ST_ch2_init[] = {
15241 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15242 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15243 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15244 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15251 static struct hda_verb alc662_3ST_ch6_init[] = {
15252 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15253 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15254 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15255 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15256 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15257 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15261 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15262 { 2, alc662_3ST_ch2_init },
15263 { 6, alc662_3ST_ch6_init },
15269 static struct hda_verb alc662_sixstack_ch6_init[] = {
15270 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15271 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15272 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15279 static struct hda_verb alc662_sixstack_ch8_init[] = {
15280 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15281 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15282 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15286 static struct hda_channel_mode alc662_5stack_modes[2] = {
15287 { 2, alc662_sixstack_ch6_init },
15288 { 6, alc662_sixstack_ch8_init },
15291 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15292 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15295 static struct snd_kcontrol_new alc662_base_mixer[] = {
15296 /* output mixer control */
15297 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15298 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15299 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15300 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15301 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15302 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15303 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15304 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15305 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15307 /*Input mixer control */
15308 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15309 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15310 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15311 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15312 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15313 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15314 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15315 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15319 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15320 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15321 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15322 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15329 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15330 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15334 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15335 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15336 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15337 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15338 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15339 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15340 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15341 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15342 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15343 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15344 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15345 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15346 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15347 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15349 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15350 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15351 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15355 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15356 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15357 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15358 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15359 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15361 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15362 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15368 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15369 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15371 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15372 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15374 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15375 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15376 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15378 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15379 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15380 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15384 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15385 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15386 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15387 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15388 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15389 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15390 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15391 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15392 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15393 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15394 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15395 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15396 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15397 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15402 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15403 .ops = &snd_hda_bind_vol,
15405 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15406 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15411 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15412 .ops = &snd_hda_bind_sw,
15414 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15415 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15420 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15421 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15422 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15428 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15429 .ops = &snd_hda_bind_sw,
15431 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15432 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15433 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15438 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15439 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15440 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15441 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15442 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15443 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15444 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15449 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15450 .ops = &snd_hda_bind_sw,
15452 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15453 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15454 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15459 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15460 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15461 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15464 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15465 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15469 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15470 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15471 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15472 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15473 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15475 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15476 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15480 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15481 .ops = &snd_hda_bind_vol,
15483 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15484 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15489 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15490 .ops = &snd_hda_bind_sw,
15492 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15493 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15498 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15499 HDA_BIND_VOL("Master Playback Volume",
15500 &alc663_asus_two_bind_master_vol),
15501 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15502 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15503 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15505 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15509 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15510 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15511 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15512 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15513 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15519 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15520 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15521 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15522 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15523 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15524 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15526 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15527 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15528 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15529 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15533 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15534 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15535 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15540 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15541 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15542 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15543 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15547 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15550 .name = "Channel Mode",
15551 .info = alc_ch_mode_info,
15552 .get = alc_ch_mode_get,
15553 .put = alc_ch_mode_put,
15558 static struct hda_verb alc662_init_verbs[] = {
15559 /* ADC: mute amp left and right */
15560 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15561 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15562 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15564 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15565 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15573 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15574 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15575 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15577 /* Front Pin: output 0 (0x0c) */
15578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15579 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15581 /* Rear Pin: output 1 (0x0d) */
15582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15585 /* CLFE Pin: output 2 (0x0e) */
15586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15587 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15589 /* Mic (rear) pin: input vref at 80% */
15590 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15591 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15592 /* Front Mic pin: input vref at 80% */
15593 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15594 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15595 /* Line In pin: input */
15596 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15597 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15598 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15600 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15601 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15602 /* CD pin widget for input */
15603 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15605 /* FIXME: use matrix-type input source selection */
15606 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15611 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15618 /* always trun on EAPD */
15619 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15620 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15625 static struct hda_verb alc662_sue_init_verbs[] = {
15626 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15627 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15631 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15632 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15633 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15637 /* Set Unsolicited Event*/
15638 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15639 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15640 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15645 * generic initialization of ADC, input mixers and output mixers
15647 static struct hda_verb alc662_auto_init_verbs[] = {
15649 * Unmute ADC and set the default input to mic-in
15651 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15652 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15654 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15656 * Note: PASD motherboards uses the Line In 2 as the input for front
15657 * panel mic (mic 2)
15659 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15660 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15661 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15662 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15663 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15664 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15667 * Set up output mixers (0x0c - 0x0f)
15669 /* set vol=0 to output mixers */
15670 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15671 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15672 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15674 /* set up input amps for analog loopback */
15675 /* Amp Indices: DAC = 0, mixer = 1 */
15676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15678 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15679 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15680 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15681 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15684 /* FIXME: use matrix-type input source selection */
15685 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15687 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15688 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15692 /* additional verbs for ALC663 */
15693 static struct hda_verb alc663_auto_init_verbs[] = {
15694 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15695 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15699 static struct hda_verb alc663_m51va_init_verbs[] = {
15700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15701 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15702 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15703 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15704 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15705 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15706 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15707 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15708 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15712 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15713 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15714 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15715 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15718 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15719 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15723 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15724 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15725 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15726 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15727 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15730 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15731 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15735 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15737 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15738 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15741 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15742 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15746 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15747 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15748 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15749 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15750 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15753 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15754 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15755 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15756 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15757 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15758 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15762 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15763 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15764 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15765 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15766 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15769 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15772 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15773 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15774 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15778 static struct hda_verb alc663_g71v_init_verbs[] = {
15779 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15780 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15781 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15783 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15784 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15785 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15787 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15788 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15789 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15793 static struct hda_verb alc663_g50v_init_verbs[] = {
15794 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15795 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15796 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15798 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15799 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15803 static struct hda_verb alc662_ecs_init_verbs[] = {
15804 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15805 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15806 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15807 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15811 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15812 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15813 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15817 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15819 unsigned int present;
15820 unsigned char bits;
15822 present = snd_hda_codec_read(codec, 0x14, 0,
15823 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15824 bits = present ? HDA_AMP_MUTE : 0;
15825 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15826 HDA_AMP_MUTE, bits);
15829 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15831 unsigned int present;
15832 unsigned char bits;
15834 present = snd_hda_codec_read(codec, 0x1b, 0,
15835 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15836 bits = present ? HDA_AMP_MUTE : 0;
15837 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15838 HDA_AMP_MUTE, bits);
15839 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15840 HDA_AMP_MUTE, bits);
15843 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15846 if ((res >> 26) == ALC880_HP_EVENT)
15847 alc662_lenovo_101e_all_automute(codec);
15848 if ((res >> 26) == ALC880_FRONT_EVENT)
15849 alc662_lenovo_101e_ispeaker_automute(codec);
15852 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15854 unsigned int present;
15856 present = snd_hda_codec_read(codec, 0x18, 0,
15857 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15858 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15859 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15860 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15861 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15862 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15863 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15864 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15865 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15868 /* unsolicited event for HP jack sensing */
15869 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15872 if ((res >> 26) == ALC880_HP_EVENT)
15873 alc262_hippo1_automute( codec );
15875 if ((res >> 26) == ALC880_MIC_EVENT)
15876 alc662_eeepc_mic_automute(codec);
15879 static void alc662_eeepc_inithook(struct hda_codec *codec)
15881 alc262_hippo1_automute( codec );
15882 alc662_eeepc_mic_automute(codec);
15885 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15888 unsigned int present;
15890 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15891 present = snd_hda_codec_read(codec, 0x14, 0,
15892 AC_VERB_GET_PIN_SENSE, 0);
15893 present = (present & 0x80000000) != 0;
15895 /* mute internal speaker */
15896 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15897 HDA_AMP_MUTE, HDA_AMP_MUTE);
15899 /* unmute internal speaker if necessary */
15900 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15901 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15902 HDA_AMP_MUTE, mute);
15906 /* unsolicited event for HP jack sensing */
15907 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15910 if ((res >> 26) == ALC880_HP_EVENT)
15911 alc662_eeepc_ep20_automute(codec);
15914 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15916 alc662_eeepc_ep20_automute(codec);
15919 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15921 unsigned int present;
15922 unsigned char bits;
15924 present = snd_hda_codec_read(codec, 0x21, 0,
15925 AC_VERB_GET_PIN_SENSE, 0)
15926 & AC_PINSENSE_PRESENCE;
15927 bits = present ? HDA_AMP_MUTE : 0;
15928 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15929 AMP_IN_MUTE(0), bits);
15930 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15931 AMP_IN_MUTE(0), bits);
15934 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15936 unsigned int present;
15937 unsigned char bits;
15939 present = snd_hda_codec_read(codec, 0x21, 0,
15940 AC_VERB_GET_PIN_SENSE, 0)
15941 & AC_PINSENSE_PRESENCE;
15942 bits = present ? HDA_AMP_MUTE : 0;
15943 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15944 AMP_IN_MUTE(0), bits);
15945 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15946 AMP_IN_MUTE(0), bits);
15947 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15948 AMP_IN_MUTE(0), bits);
15949 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15950 AMP_IN_MUTE(0), bits);
15953 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15955 unsigned int present;
15956 unsigned char bits;
15958 present = snd_hda_codec_read(codec, 0x15, 0,
15959 AC_VERB_GET_PIN_SENSE, 0)
15960 & AC_PINSENSE_PRESENCE;
15961 bits = present ? HDA_AMP_MUTE : 0;
15962 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15963 AMP_IN_MUTE(0), bits);
15964 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15965 AMP_IN_MUTE(0), bits);
15966 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15967 AMP_IN_MUTE(0), bits);
15968 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15969 AMP_IN_MUTE(0), bits);
15972 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15974 unsigned int present;
15975 unsigned char bits;
15977 present = snd_hda_codec_read(codec, 0x1b, 0,
15978 AC_VERB_GET_PIN_SENSE, 0)
15979 & AC_PINSENSE_PRESENCE;
15980 bits = present ? 0 : PIN_OUT;
15981 snd_hda_codec_write(codec, 0x14, 0,
15982 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15985 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15987 unsigned int present1, present2;
15989 present1 = snd_hda_codec_read(codec, 0x21, 0,
15990 AC_VERB_GET_PIN_SENSE, 0)
15991 & AC_PINSENSE_PRESENCE;
15992 present2 = snd_hda_codec_read(codec, 0x15, 0,
15993 AC_VERB_GET_PIN_SENSE, 0)
15994 & AC_PINSENSE_PRESENCE;
15996 if (present1 || present2) {
15997 snd_hda_codec_write_cache(codec, 0x14, 0,
15998 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16000 snd_hda_codec_write_cache(codec, 0x14, 0,
16001 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16005 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16007 unsigned int present1, present2;
16009 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16010 AC_VERB_GET_PIN_SENSE, 0)
16011 & AC_PINSENSE_PRESENCE;
16012 present2 = snd_hda_codec_read(codec, 0x15, 0,
16013 AC_VERB_GET_PIN_SENSE, 0)
16014 & AC_PINSENSE_PRESENCE;
16016 if (present1 || present2) {
16017 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16018 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16019 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16020 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16022 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16023 AMP_IN_MUTE(0), 0);
16024 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16025 AMP_IN_MUTE(0), 0);
16029 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16031 unsigned int present;
16033 present = snd_hda_codec_read(codec, 0x18, 0,
16034 AC_VERB_GET_PIN_SENSE, 0)
16035 & AC_PINSENSE_PRESENCE;
16036 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16037 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16038 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16039 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16040 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16041 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16042 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16043 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16046 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16049 switch (res >> 26) {
16050 case ALC880_HP_EVENT:
16051 alc663_m51va_speaker_automute(codec);
16053 case ALC880_MIC_EVENT:
16054 alc663_m51va_mic_automute(codec);
16059 static void alc663_m51va_inithook(struct hda_codec *codec)
16061 alc663_m51va_speaker_automute(codec);
16062 alc663_m51va_mic_automute(codec);
16065 /* ***************** Mode1 ******************************/
16066 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16069 switch (res >> 26) {
16070 case ALC880_HP_EVENT:
16071 alc663_m51va_speaker_automute(codec);
16073 case ALC880_MIC_EVENT:
16074 alc662_eeepc_mic_automute(codec);
16079 static void alc663_mode1_inithook(struct hda_codec *codec)
16081 alc663_m51va_speaker_automute(codec);
16082 alc662_eeepc_mic_automute(codec);
16084 /* ***************** Mode2 ******************************/
16085 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16088 switch (res >> 26) {
16089 case ALC880_HP_EVENT:
16090 alc662_f5z_speaker_automute(codec);
16092 case ALC880_MIC_EVENT:
16093 alc662_eeepc_mic_automute(codec);
16098 static void alc662_mode2_inithook(struct hda_codec *codec)
16100 alc662_f5z_speaker_automute(codec);
16101 alc662_eeepc_mic_automute(codec);
16103 /* ***************** Mode3 ******************************/
16104 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16107 switch (res >> 26) {
16108 case ALC880_HP_EVENT:
16109 alc663_two_hp_m1_speaker_automute(codec);
16111 case ALC880_MIC_EVENT:
16112 alc662_eeepc_mic_automute(codec);
16117 static void alc663_mode3_inithook(struct hda_codec *codec)
16119 alc663_two_hp_m1_speaker_automute(codec);
16120 alc662_eeepc_mic_automute(codec);
16122 /* ***************** Mode4 ******************************/
16123 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16126 switch (res >> 26) {
16127 case ALC880_HP_EVENT:
16128 alc663_21jd_two_speaker_automute(codec);
16130 case ALC880_MIC_EVENT:
16131 alc662_eeepc_mic_automute(codec);
16136 static void alc663_mode4_inithook(struct hda_codec *codec)
16138 alc663_21jd_two_speaker_automute(codec);
16139 alc662_eeepc_mic_automute(codec);
16141 /* ***************** Mode5 ******************************/
16142 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16145 switch (res >> 26) {
16146 case ALC880_HP_EVENT:
16147 alc663_15jd_two_speaker_automute(codec);
16149 case ALC880_MIC_EVENT:
16150 alc662_eeepc_mic_automute(codec);
16155 static void alc663_mode5_inithook(struct hda_codec *codec)
16157 alc663_15jd_two_speaker_automute(codec);
16158 alc662_eeepc_mic_automute(codec);
16160 /* ***************** Mode6 ******************************/
16161 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16164 switch (res >> 26) {
16165 case ALC880_HP_EVENT:
16166 alc663_two_hp_m2_speaker_automute(codec);
16168 case ALC880_MIC_EVENT:
16169 alc662_eeepc_mic_automute(codec);
16174 static void alc663_mode6_inithook(struct hda_codec *codec)
16176 alc663_two_hp_m2_speaker_automute(codec);
16177 alc662_eeepc_mic_automute(codec);
16180 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16182 unsigned int present;
16183 unsigned char bits;
16185 present = snd_hda_codec_read(codec, 0x21, 0,
16186 AC_VERB_GET_PIN_SENSE, 0)
16187 & AC_PINSENSE_PRESENCE;
16188 bits = present ? HDA_AMP_MUTE : 0;
16189 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16190 HDA_AMP_MUTE, bits);
16191 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16192 HDA_AMP_MUTE, bits);
16195 static void alc663_g71v_front_automute(struct hda_codec *codec)
16197 unsigned int present;
16198 unsigned char bits;
16200 present = snd_hda_codec_read(codec, 0x15, 0,
16201 AC_VERB_GET_PIN_SENSE, 0)
16202 & AC_PINSENSE_PRESENCE;
16203 bits = present ? HDA_AMP_MUTE : 0;
16204 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16205 HDA_AMP_MUTE, bits);
16208 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16211 switch (res >> 26) {
16212 case ALC880_HP_EVENT:
16213 alc663_g71v_hp_automute(codec);
16215 case ALC880_FRONT_EVENT:
16216 alc663_g71v_front_automute(codec);
16218 case ALC880_MIC_EVENT:
16219 alc662_eeepc_mic_automute(codec);
16224 static void alc663_g71v_inithook(struct hda_codec *codec)
16226 alc663_g71v_front_automute(codec);
16227 alc663_g71v_hp_automute(codec);
16228 alc662_eeepc_mic_automute(codec);
16231 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16234 switch (res >> 26) {
16235 case ALC880_HP_EVENT:
16236 alc663_m51va_speaker_automute(codec);
16238 case ALC880_MIC_EVENT:
16239 alc662_eeepc_mic_automute(codec);
16244 static void alc663_g50v_inithook(struct hda_codec *codec)
16246 alc663_m51va_speaker_automute(codec);
16247 alc662_eeepc_mic_automute(codec);
16250 /* bind hp and internal speaker mute (with plug check) */
16251 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16252 struct snd_ctl_elem_value *ucontrol)
16254 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16255 long *valp = ucontrol->value.integer.value;
16258 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16260 valp[0] ? 0 : HDA_AMP_MUTE);
16261 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16263 valp[1] ? 0 : HDA_AMP_MUTE);
16265 alc262_hippo1_automute(codec);
16269 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16270 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16272 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16273 .name = "Master Playback Switch",
16274 .info = snd_hda_mixer_amp_switch_info,
16275 .get = snd_hda_mixer_amp_switch_get,
16276 .put = alc662_ecs_master_sw_put,
16277 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16280 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16281 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16282 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16284 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16285 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16286 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16290 #ifdef CONFIG_SND_HDA_POWER_SAVE
16291 #define alc662_loopbacks alc880_loopbacks
16295 /* pcm configuration: identiacal with ALC880 */
16296 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16297 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16298 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16299 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16302 * configuration and preset
16304 static const char *alc662_models[ALC662_MODEL_LAST] = {
16305 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16306 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16307 [ALC662_3ST_6ch] = "3stack-6ch",
16308 [ALC662_5ST_DIG] = "6stack-dig",
16309 [ALC662_LENOVO_101E] = "lenovo-101e",
16310 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16311 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16312 [ALC662_ECS] = "ecs",
16313 [ALC663_ASUS_M51VA] = "m51va",
16314 [ALC663_ASUS_G71V] = "g71v",
16315 [ALC663_ASUS_H13] = "h13",
16316 [ALC663_ASUS_G50V] = "g50v",
16317 [ALC663_ASUS_MODE1] = "asus-mode1",
16318 [ALC662_ASUS_MODE2] = "asus-mode2",
16319 [ALC663_ASUS_MODE3] = "asus-mode3",
16320 [ALC663_ASUS_MODE4] = "asus-mode4",
16321 [ALC663_ASUS_MODE5] = "asus-mode5",
16322 [ALC663_ASUS_MODE6] = "asus-mode6",
16323 [ALC662_AUTO] = "auto",
16326 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16327 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16328 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16329 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16330 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16331 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16332 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16333 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16334 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16335 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16336 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16337 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16338 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16339 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16340 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16341 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16342 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16343 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16344 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16345 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16346 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16347 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16348 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16349 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16350 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16351 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16352 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16353 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16354 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16355 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16356 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16357 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16358 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16359 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16360 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16361 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16362 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16363 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16364 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16365 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16366 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16367 ALC662_3ST_6ch_DIG),
16368 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16369 ALC662_3ST_6ch_DIG),
16370 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16371 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16372 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16373 ALC662_3ST_6ch_DIG),
16374 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16379 static struct alc_config_preset alc662_presets[] = {
16380 [ALC662_3ST_2ch_DIG] = {
16381 .mixers = { alc662_3ST_2ch_mixer },
16382 .init_verbs = { alc662_init_verbs },
16383 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16384 .dac_nids = alc662_dac_nids,
16385 .dig_out_nid = ALC662_DIGOUT_NID,
16386 .dig_in_nid = ALC662_DIGIN_NID,
16387 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16388 .channel_mode = alc662_3ST_2ch_modes,
16389 .input_mux = &alc662_capture_source,
16391 [ALC662_3ST_6ch_DIG] = {
16392 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16393 .init_verbs = { alc662_init_verbs },
16394 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16395 .dac_nids = alc662_dac_nids,
16396 .dig_out_nid = ALC662_DIGOUT_NID,
16397 .dig_in_nid = ALC662_DIGIN_NID,
16398 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16399 .channel_mode = alc662_3ST_6ch_modes,
16401 .input_mux = &alc662_capture_source,
16403 [ALC662_3ST_6ch] = {
16404 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16405 .init_verbs = { alc662_init_verbs },
16406 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16407 .dac_nids = alc662_dac_nids,
16408 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16409 .channel_mode = alc662_3ST_6ch_modes,
16411 .input_mux = &alc662_capture_source,
16413 [ALC662_5ST_DIG] = {
16414 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16415 .init_verbs = { alc662_init_verbs },
16416 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16417 .dac_nids = alc662_dac_nids,
16418 .dig_out_nid = ALC662_DIGOUT_NID,
16419 .dig_in_nid = ALC662_DIGIN_NID,
16420 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16421 .channel_mode = alc662_5stack_modes,
16422 .input_mux = &alc662_capture_source,
16424 [ALC662_LENOVO_101E] = {
16425 .mixers = { alc662_lenovo_101e_mixer },
16426 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16427 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16428 .dac_nids = alc662_dac_nids,
16429 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16430 .channel_mode = alc662_3ST_2ch_modes,
16431 .input_mux = &alc662_lenovo_101e_capture_source,
16432 .unsol_event = alc662_lenovo_101e_unsol_event,
16433 .init_hook = alc662_lenovo_101e_all_automute,
16435 [ALC662_ASUS_EEEPC_P701] = {
16436 .mixers = { alc662_eeepc_p701_mixer },
16437 .init_verbs = { alc662_init_verbs,
16438 alc662_eeepc_sue_init_verbs },
16439 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16440 .dac_nids = alc662_dac_nids,
16441 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16442 .channel_mode = alc662_3ST_2ch_modes,
16443 .input_mux = &alc662_eeepc_capture_source,
16444 .unsol_event = alc662_eeepc_unsol_event,
16445 .init_hook = alc662_eeepc_inithook,
16447 [ALC662_ASUS_EEEPC_EP20] = {
16448 .mixers = { alc662_eeepc_ep20_mixer,
16449 alc662_chmode_mixer },
16450 .init_verbs = { alc662_init_verbs,
16451 alc662_eeepc_ep20_sue_init_verbs },
16452 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16453 .dac_nids = alc662_dac_nids,
16454 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16455 .channel_mode = alc662_3ST_6ch_modes,
16456 .input_mux = &alc662_lenovo_101e_capture_source,
16457 .unsol_event = alc662_eeepc_ep20_unsol_event,
16458 .init_hook = alc662_eeepc_ep20_inithook,
16461 .mixers = { alc662_ecs_mixer },
16462 .init_verbs = { alc662_init_verbs,
16463 alc662_ecs_init_verbs },
16464 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16465 .dac_nids = alc662_dac_nids,
16466 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16467 .channel_mode = alc662_3ST_2ch_modes,
16468 .input_mux = &alc662_eeepc_capture_source,
16469 .unsol_event = alc662_eeepc_unsol_event,
16470 .init_hook = alc662_eeepc_inithook,
16472 [ALC663_ASUS_M51VA] = {
16473 .mixers = { alc663_m51va_mixer },
16474 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16475 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16476 .dac_nids = alc662_dac_nids,
16477 .dig_out_nid = ALC662_DIGOUT_NID,
16478 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16479 .channel_mode = alc662_3ST_2ch_modes,
16480 .input_mux = &alc663_m51va_capture_source,
16481 .unsol_event = alc663_m51va_unsol_event,
16482 .init_hook = alc663_m51va_inithook,
16484 [ALC663_ASUS_G71V] = {
16485 .mixers = { alc663_g71v_mixer },
16486 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16487 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16488 .dac_nids = alc662_dac_nids,
16489 .dig_out_nid = ALC662_DIGOUT_NID,
16490 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16491 .channel_mode = alc662_3ST_2ch_modes,
16492 .input_mux = &alc662_eeepc_capture_source,
16493 .unsol_event = alc663_g71v_unsol_event,
16494 .init_hook = alc663_g71v_inithook,
16496 [ALC663_ASUS_H13] = {
16497 .mixers = { alc663_m51va_mixer },
16498 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16499 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16500 .dac_nids = alc662_dac_nids,
16501 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16502 .channel_mode = alc662_3ST_2ch_modes,
16503 .input_mux = &alc663_m51va_capture_source,
16504 .unsol_event = alc663_m51va_unsol_event,
16505 .init_hook = alc663_m51va_inithook,
16507 [ALC663_ASUS_G50V] = {
16508 .mixers = { alc663_g50v_mixer },
16509 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16510 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16511 .dac_nids = alc662_dac_nids,
16512 .dig_out_nid = ALC662_DIGOUT_NID,
16513 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16514 .channel_mode = alc662_3ST_6ch_modes,
16515 .input_mux = &alc663_capture_source,
16516 .unsol_event = alc663_g50v_unsol_event,
16517 .init_hook = alc663_g50v_inithook,
16519 [ALC663_ASUS_MODE1] = {
16520 .mixers = { alc663_m51va_mixer },
16521 .cap_mixer = alc662_auto_capture_mixer,
16522 .init_verbs = { alc662_init_verbs,
16523 alc663_21jd_amic_init_verbs },
16524 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16526 .dac_nids = alc662_dac_nids,
16527 .dig_out_nid = ALC662_DIGOUT_NID,
16528 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16529 .channel_mode = alc662_3ST_2ch_modes,
16530 .input_mux = &alc662_eeepc_capture_source,
16531 .unsol_event = alc663_mode1_unsol_event,
16532 .init_hook = alc663_mode1_inithook,
16534 [ALC662_ASUS_MODE2] = {
16535 .mixers = { alc662_1bjd_mixer },
16536 .cap_mixer = alc662_auto_capture_mixer,
16537 .init_verbs = { alc662_init_verbs,
16538 alc662_1bjd_amic_init_verbs },
16539 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16540 .dac_nids = alc662_dac_nids,
16541 .dig_out_nid = ALC662_DIGOUT_NID,
16542 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16543 .channel_mode = alc662_3ST_2ch_modes,
16544 .input_mux = &alc662_eeepc_capture_source,
16545 .unsol_event = alc662_mode2_unsol_event,
16546 .init_hook = alc662_mode2_inithook,
16548 [ALC663_ASUS_MODE3] = {
16549 .mixers = { alc663_two_hp_m1_mixer },
16550 .cap_mixer = alc662_auto_capture_mixer,
16551 .init_verbs = { alc662_init_verbs,
16552 alc663_two_hp_amic_m1_init_verbs },
16553 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16555 .dac_nids = alc662_dac_nids,
16556 .dig_out_nid = ALC662_DIGOUT_NID,
16557 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16558 .channel_mode = alc662_3ST_2ch_modes,
16559 .input_mux = &alc662_eeepc_capture_source,
16560 .unsol_event = alc663_mode3_unsol_event,
16561 .init_hook = alc663_mode3_inithook,
16563 [ALC663_ASUS_MODE4] = {
16564 .mixers = { alc663_asus_21jd_clfe_mixer },
16565 .cap_mixer = alc662_auto_capture_mixer,
16566 .init_verbs = { alc662_init_verbs,
16567 alc663_21jd_amic_init_verbs},
16568 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16570 .dac_nids = alc662_dac_nids,
16571 .dig_out_nid = ALC662_DIGOUT_NID,
16572 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16573 .channel_mode = alc662_3ST_2ch_modes,
16574 .input_mux = &alc662_eeepc_capture_source,
16575 .unsol_event = alc663_mode4_unsol_event,
16576 .init_hook = alc663_mode4_inithook,
16578 [ALC663_ASUS_MODE5] = {
16579 .mixers = { alc663_asus_15jd_clfe_mixer },
16580 .cap_mixer = alc662_auto_capture_mixer,
16581 .init_verbs = { alc662_init_verbs,
16582 alc663_15jd_amic_init_verbs },
16583 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16585 .dac_nids = alc662_dac_nids,
16586 .dig_out_nid = ALC662_DIGOUT_NID,
16587 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16588 .channel_mode = alc662_3ST_2ch_modes,
16589 .input_mux = &alc662_eeepc_capture_source,
16590 .unsol_event = alc663_mode5_unsol_event,
16591 .init_hook = alc663_mode5_inithook,
16593 [ALC663_ASUS_MODE6] = {
16594 .mixers = { alc663_two_hp_m2_mixer },
16595 .cap_mixer = alc662_auto_capture_mixer,
16596 .init_verbs = { alc662_init_verbs,
16597 alc663_two_hp_amic_m2_init_verbs },
16598 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16600 .dac_nids = alc662_dac_nids,
16601 .dig_out_nid = ALC662_DIGOUT_NID,
16602 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16603 .channel_mode = alc662_3ST_2ch_modes,
16604 .input_mux = &alc662_eeepc_capture_source,
16605 .unsol_event = alc663_mode6_unsol_event,
16606 .init_hook = alc663_mode6_inithook,
16612 * BIOS auto configuration
16615 /* add playback controls from the parsed DAC table */
16616 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16617 const struct auto_pin_cfg *cfg)
16620 static const char *chname[4] = {
16621 "Front", "Surround", NULL /*CLFE*/, "Side"
16626 for (i = 0; i < cfg->line_outs; i++) {
16627 if (!spec->multiout.dac_nids[i])
16629 nid = alc880_idx_to_dac(i);
16632 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16633 "Center Playback Volume",
16634 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16638 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16639 "LFE Playback Volume",
16640 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16644 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16645 "Center Playback Switch",
16646 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16650 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16651 "LFE Playback Switch",
16652 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16657 sprintf(name, "%s Playback Volume", chname[i]);
16658 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16659 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16663 sprintf(name, "%s Playback Switch", chname[i]);
16664 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16665 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16674 /* add playback controls for speaker and HP outputs */
16675 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16686 /* ALC663 has a mono output pin on 0x17 */
16687 sprintf(name, "%s Playback Switch", pfx);
16688 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16689 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16693 if (alc880_is_fixed_pin(pin)) {
16694 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16695 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16696 /* specify the DAC as the extra output */
16697 if (!spec->multiout.hp_nid)
16698 spec->multiout.hp_nid = nid;
16700 spec->multiout.extra_out_nid[0] = nid;
16701 /* control HP volume/switch on the output mixer amp */
16702 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16703 sprintf(name, "%s Playback Volume", pfx);
16704 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16705 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16708 sprintf(name, "%s Playback Switch", pfx);
16709 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16710 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16713 } else if (alc880_is_multi_pin(pin)) {
16714 /* set manual connection */
16715 /* we have only a switch on HP-out PIN */
16716 sprintf(name, "%s Playback Switch", pfx);
16717 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16718 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16725 /* create playback/capture controls for input pins */
16726 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16727 const struct auto_pin_cfg *cfg)
16729 struct hda_input_mux *imux = &spec->private_imux[0];
16732 for (i = 0; i < AUTO_PIN_LAST; i++) {
16733 if (alc880_is_input_pin(cfg->input_pins[i])) {
16734 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16735 err = new_analog_input(spec, cfg->input_pins[i],
16736 auto_pin_cfg_labels[i],
16740 imux->items[imux->num_items].label =
16741 auto_pin_cfg_labels[i];
16742 imux->items[imux->num_items].index =
16743 alc880_input_pin_idx(cfg->input_pins[i]);
16750 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16751 hda_nid_t nid, int pin_type,
16754 alc_set_pin_output(codec, nid, pin_type);
16755 /* need the manual connection? */
16756 if (alc880_is_multi_pin(nid)) {
16757 struct alc_spec *spec = codec->spec;
16758 int idx = alc880_multi_pin_idx(nid);
16759 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16760 AC_VERB_SET_CONNECT_SEL,
16761 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16765 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16767 struct alc_spec *spec = codec->spec;
16770 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16771 for (i = 0; i <= HDA_SIDE; i++) {
16772 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16773 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16775 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16780 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16782 struct alc_spec *spec = codec->spec;
16785 pin = spec->autocfg.hp_pins[0];
16786 if (pin) /* connect to front */
16788 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16789 pin = spec->autocfg.speaker_pins[0];
16791 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16794 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16795 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16797 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16799 struct alc_spec *spec = codec->spec;
16802 for (i = 0; i < AUTO_PIN_LAST; i++) {
16803 hda_nid_t nid = spec->autocfg.input_pins[i];
16804 if (alc662_is_input_pin(nid)) {
16805 snd_hda_codec_write(codec, nid, 0,
16806 AC_VERB_SET_PIN_WIDGET_CONTROL,
16807 (i <= AUTO_PIN_FRONT_MIC ?
16808 PIN_VREF80 : PIN_IN));
16809 if (nid != ALC662_PIN_CD_NID)
16810 snd_hda_codec_write(codec, nid, 0,
16811 AC_VERB_SET_AMP_GAIN_MUTE,
16817 #define alc662_auto_init_input_src alc882_auto_init_input_src
16819 static int alc662_parse_auto_config(struct hda_codec *codec)
16821 struct alc_spec *spec = codec->spec;
16823 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16825 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16829 if (!spec->autocfg.line_outs)
16830 return 0; /* can't find valid BIOS pin config */
16832 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16835 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16838 err = alc662_auto_create_extra_out(spec,
16839 spec->autocfg.speaker_pins[0],
16843 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16847 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16851 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16853 if (spec->autocfg.dig_outs)
16854 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16856 if (spec->kctls.list)
16857 add_mixer(spec, spec->kctls.list);
16859 spec->num_mux_defs = 1;
16860 spec->input_mux = &spec->private_imux[0];
16862 add_verb(spec, alc662_auto_init_verbs);
16863 if (codec->vendor_id == 0x10ec0663)
16864 add_verb(spec, alc663_auto_init_verbs);
16866 err = alc_auto_add_mic_boost(codec);
16870 store_pin_configs(codec);
16874 /* additional initialization for auto-configuration model */
16875 static void alc662_auto_init(struct hda_codec *codec)
16877 struct alc_spec *spec = codec->spec;
16878 alc662_auto_init_multi_out(codec);
16879 alc662_auto_init_hp_out(codec);
16880 alc662_auto_init_analog_input(codec);
16881 alc662_auto_init_input_src(codec);
16882 if (spec->unsol_event)
16883 alc_inithook(codec);
16886 static int patch_alc662(struct hda_codec *codec)
16888 struct alc_spec *spec;
16889 int err, board_config;
16891 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16895 codec->spec = spec;
16897 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16899 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16902 if (board_config < 0) {
16903 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16904 "trying auto-probe from BIOS...\n");
16905 board_config = ALC662_AUTO;
16908 if (board_config == ALC662_AUTO) {
16909 /* automatic parse from the BIOS config */
16910 err = alc662_parse_auto_config(codec);
16916 "hda_codec: Cannot set up configuration "
16917 "from BIOS. Using base mode...\n");
16918 board_config = ALC662_3ST_2ch_DIG;
16922 err = snd_hda_attach_beep_device(codec, 0x1);
16928 if (board_config != ALC662_AUTO)
16929 setup_preset(spec, &alc662_presets[board_config]);
16931 if (codec->vendor_id == 0x10ec0663) {
16932 spec->stream_name_analog = "ALC663 Analog";
16933 spec->stream_name_digital = "ALC663 Digital";
16934 } else if (codec->vendor_id == 0x10ec0272) {
16935 spec->stream_name_analog = "ALC272 Analog";
16936 spec->stream_name_digital = "ALC272 Digital";
16938 spec->stream_name_analog = "ALC662 Analog";
16939 spec->stream_name_digital = "ALC662 Digital";
16942 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16943 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16945 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16946 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16948 spec->adc_nids = alc662_adc_nids;
16949 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16950 spec->capsrc_nids = alc662_capsrc_nids;
16951 spec->capture_style = CAPT_MIX;
16953 if (!spec->cap_mixer)
16954 set_capture_mixer(spec);
16955 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16957 spec->vmaster_nid = 0x02;
16959 codec->patch_ops = alc_patch_ops;
16960 if (board_config == ALC662_AUTO)
16961 spec->init_hook = alc662_auto_init;
16962 #ifdef CONFIG_SND_HDA_POWER_SAVE
16963 if (!spec->loopback.amplist)
16964 spec->loopback.amplist = alc662_loopbacks;
16966 codec->proc_widget_hook = print_realtek_coef;
16974 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16975 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16976 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16977 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16978 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16979 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16980 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16981 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16982 .patch = patch_alc861 },
16983 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16984 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16985 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16986 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16987 .patch = patch_alc883 },
16988 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16989 .patch = patch_alc662 },
16990 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16991 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16992 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16993 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16994 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16995 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16996 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16997 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16998 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16999 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17000 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17001 .patch = patch_alc883 },
17002 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17003 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17004 {} /* terminator */
17007 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17009 MODULE_LICENSE("GPL");
17010 MODULE_DESCRIPTION("Realtek HD-audio codec");
17012 static struct hda_codec_preset_list realtek_list = {
17013 .preset = snd_hda_preset_realtek,
17014 .owner = THIS_MODULE,
17017 static int __init patch_realtek_init(void)
17019 return snd_hda_add_codec_preset(&realtek_list);
17022 static void __exit patch_realtek_exit(void)
17024 snd_hda_delete_codec_preset(&realtek_list);
17027 module_init(patch_realtek_init)
17028 module_exit(patch_realtek_exit)