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"
34 #define ALC880_FRONT_EVENT 0x01
35 #define ALC880_DCVOL_EVENT 0x02
36 #define ALC880_HP_EVENT 0x04
37 #define ALC880_MIC_EVENT 0x08
39 /* ALC880 board config type */
63 #ifdef CONFIG_SND_DEBUG
67 ALC880_MODEL_LAST /* last tag */
80 #ifdef CONFIG_SND_DEBUG
84 ALC260_MODEL_LAST /* last tag */
94 ALC262_HP_BPC_D7000_WL,
95 ALC262_HP_BPC_D7000_WF,
107 ALC262_MODEL_LAST /* last tag */
117 ALC268_ACER_ASPIRE_ONE,
120 #ifdef CONFIG_SND_DEBUG
124 ALC268_MODEL_LAST /* last tag */
131 ALC269_ASUS_EEEPC_P703,
132 ALC269_ASUS_EEEPC_P901,
136 ALC269_MODEL_LAST /* last tag */
153 /* ALC861-VD models */
175 ALC662_ASUS_EEEPC_P701,
176 ALC662_ASUS_EEEPC_EP20,
215 ALC883_TARGA_2ch_DIG,
218 ALC888_ACER_ASPIRE_4930G,
222 ALC883_LENOVO_101E_2ch,
223 ALC883_LENOVO_NB0763,
224 ALC888_LENOVO_MS7195_DIG,
231 ALC883_FUJITSU_PI2515,
232 ALC888_FUJITSU_XA3530,
233 ALC883_3ST_6ch_INTEL,
242 #define GPIO_MASK 0x03
245 /* codec parameterization */
246 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
247 unsigned int num_mixers;
248 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
250 const struct hda_verb *init_verbs[5]; /* initialization verbs
254 unsigned int num_init_verbs;
256 char *stream_name_analog; /* analog PCM stream */
257 struct hda_pcm_stream *stream_analog_playback;
258 struct hda_pcm_stream *stream_analog_capture;
259 struct hda_pcm_stream *stream_analog_alt_playback;
260 struct hda_pcm_stream *stream_analog_alt_capture;
262 char *stream_name_digital; /* digital PCM stream */
263 struct hda_pcm_stream *stream_digital_playback;
264 struct hda_pcm_stream *stream_digital_capture;
267 struct hda_multi_out multiout; /* playback set-up
268 * max_channels, dacs must be set
269 * dig_out_nid and hp_nid are optional
271 hda_nid_t alt_dac_nid;
274 unsigned int num_adc_nids;
276 hda_nid_t *capsrc_nids;
277 hda_nid_t dig_in_nid; /* digital-in NID; optional */
278 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */
281 unsigned int num_mux_defs;
282 const struct hda_input_mux *input_mux;
283 unsigned int cur_mux[3];
286 const struct hda_channel_mode *channel_mode;
287 int num_channel_mode;
290 /* PCM information */
291 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
293 /* dynamic controls, init_verbs and input_mux */
294 struct auto_pin_cfg autocfg;
295 struct snd_array kctls;
296 struct hda_input_mux private_imux;
297 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
300 void (*init_hook)(struct hda_codec *codec);
301 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
303 /* for pin sensing */
304 unsigned int sense_updated: 1;
305 unsigned int jack_present: 1;
306 unsigned int master_sw: 1;
308 /* for virtual master */
309 hda_nid_t vmaster_nid;
310 #ifdef CONFIG_SND_HDA_POWER_SAVE
311 struct hda_loopback_check loopback;
316 unsigned int pll_coef_idx, pll_coef_bit;
318 #ifdef SND_HDA_NEEDS_RESUME
319 #define ALC_MAX_PINS 16
320 unsigned int num_pins;
321 hda_nid_t pin_nids[ALC_MAX_PINS];
322 unsigned int pin_cfgs[ALC_MAX_PINS];
327 * configuration template - to be copied to the spec instance
329 struct alc_config_preset {
330 struct snd_kcontrol_new *mixers[5]; /* should be identical size
333 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
334 const struct hda_verb *init_verbs[5];
335 unsigned int num_dacs;
337 hda_nid_t dig_out_nid; /* optional */
338 hda_nid_t hp_nid; /* optional */
339 unsigned int num_adc_nids;
341 hda_nid_t *capsrc_nids;
342 hda_nid_t dig_in_nid;
343 unsigned int num_channel_mode;
344 const struct hda_channel_mode *channel_mode;
346 unsigned int num_mux_defs;
347 const struct hda_input_mux *input_mux;
348 void (*unsol_event)(struct hda_codec *, unsigned int);
349 void (*init_hook)(struct hda_codec *);
350 #ifdef CONFIG_SND_HDA_POWER_SAVE
351 struct hda_amp_list *loopbacks;
359 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
360 struct snd_ctl_elem_info *uinfo)
362 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
363 struct alc_spec *spec = codec->spec;
364 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
365 if (mux_idx >= spec->num_mux_defs)
367 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
370 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
371 struct snd_ctl_elem_value *ucontrol)
373 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
374 struct alc_spec *spec = codec->spec;
375 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
377 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
381 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
382 struct snd_ctl_elem_value *ucontrol)
384 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
385 struct alc_spec *spec = codec->spec;
386 const struct hda_input_mux *imux;
387 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
388 unsigned int mux_idx;
389 hda_nid_t nid = spec->capsrc_nids ?
390 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
392 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
393 imux = &spec->input_mux[mux_idx];
395 if (spec->is_mix_capture) {
396 /* Matrix-mixer style (e.g. ALC882) */
397 unsigned int *cur_val = &spec->cur_mux[adc_idx];
400 idx = ucontrol->value.enumerated.item[0];
401 if (idx >= imux->num_items)
402 idx = imux->num_items - 1;
405 for (i = 0; i < imux->num_items; i++) {
406 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
407 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
408 imux->items[i].index,
414 /* MUX style (e.g. ALC880) */
415 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
416 &spec->cur_mux[adc_idx]);
421 * channel mode setting
423 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
424 struct snd_ctl_elem_info *uinfo)
426 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
427 struct alc_spec *spec = codec->spec;
428 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
429 spec->num_channel_mode);
432 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
433 struct snd_ctl_elem_value *ucontrol)
435 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
436 struct alc_spec *spec = codec->spec;
437 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
438 spec->num_channel_mode,
439 spec->multiout.max_channels);
442 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
443 struct snd_ctl_elem_value *ucontrol)
445 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
446 struct alc_spec *spec = codec->spec;
447 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
448 spec->num_channel_mode,
449 &spec->multiout.max_channels);
450 if (err >= 0 && spec->need_dac_fix)
451 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
456 * Control the mode of pin widget settings via the mixer. "pc" is used
457 * instead of "%" to avoid consequences of accidently treating the % as
458 * being part of a format specifier. Maximum allowed length of a value is
459 * 63 characters plus NULL terminator.
461 * Note: some retasking pin complexes seem to ignore requests for input
462 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
463 * are requested. Therefore order this list so that this behaviour will not
464 * cause problems when mixer clients move through the enum sequentially.
465 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
468 static char *alc_pin_mode_names[] = {
469 "Mic 50pc bias", "Mic 80pc bias",
470 "Line in", "Line out", "Headphone out",
472 static unsigned char alc_pin_mode_values[] = {
473 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
475 /* The control can present all 5 options, or it can limit the options based
476 * in the pin being assumed to be exclusively an input or an output pin. In
477 * addition, "input" pins may or may not process the mic bias option
478 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
479 * accept requests for bias as of chip versions up to March 2006) and/or
480 * wiring in the computer.
482 #define ALC_PIN_DIR_IN 0x00
483 #define ALC_PIN_DIR_OUT 0x01
484 #define ALC_PIN_DIR_INOUT 0x02
485 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
486 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
488 /* Info about the pin modes supported by the different pin direction modes.
489 * For each direction the minimum and maximum values are given.
491 static signed char alc_pin_mode_dir_info[5][2] = {
492 { 0, 2 }, /* ALC_PIN_DIR_IN */
493 { 3, 4 }, /* ALC_PIN_DIR_OUT */
494 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
495 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
496 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
498 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
499 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
500 #define alc_pin_mode_n_items(_dir) \
501 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
503 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
504 struct snd_ctl_elem_info *uinfo)
506 unsigned int item_num = uinfo->value.enumerated.item;
507 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
509 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
511 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
513 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
514 item_num = alc_pin_mode_min(dir);
515 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
519 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
520 struct snd_ctl_elem_value *ucontrol)
523 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
524 hda_nid_t nid = kcontrol->private_value & 0xffff;
525 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
526 long *valp = ucontrol->value.integer.value;
527 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
528 AC_VERB_GET_PIN_WIDGET_CONTROL,
531 /* Find enumerated value for current pinctl setting */
532 i = alc_pin_mode_min(dir);
533 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
535 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
539 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
540 struct snd_ctl_elem_value *ucontrol)
543 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
544 hda_nid_t nid = kcontrol->private_value & 0xffff;
545 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
546 long val = *ucontrol->value.integer.value;
547 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
548 AC_VERB_GET_PIN_WIDGET_CONTROL,
551 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
552 val = alc_pin_mode_min(dir);
554 change = pinctl != alc_pin_mode_values[val];
556 /* Set pin mode to that requested */
557 snd_hda_codec_write_cache(codec, nid, 0,
558 AC_VERB_SET_PIN_WIDGET_CONTROL,
559 alc_pin_mode_values[val]);
561 /* Also enable the retasking pin's input/output as required
562 * for the requested pin mode. Enum values of 2 or less are
565 * Dynamically switching the input/output buffers probably
566 * reduces noise slightly (particularly on input) so we'll
567 * do it. However, having both input and output buffers
568 * enabled simultaneously doesn't seem to be problematic if
569 * this turns out to be necessary in the future.
572 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
573 HDA_AMP_MUTE, HDA_AMP_MUTE);
574 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
577 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
578 HDA_AMP_MUTE, HDA_AMP_MUTE);
579 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
586 #define ALC_PIN_MODE(xname, nid, dir) \
587 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
588 .info = alc_pin_mode_info, \
589 .get = alc_pin_mode_get, \
590 .put = alc_pin_mode_put, \
591 .private_value = nid | (dir<<16) }
593 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
594 * together using a mask with more than one bit set. This control is
595 * currently used only by the ALC260 test model. At this stage they are not
596 * needed for any "production" models.
598 #ifdef CONFIG_SND_DEBUG
599 #define alc_gpio_data_info snd_ctl_boolean_mono_info
601 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
602 struct snd_ctl_elem_value *ucontrol)
604 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
605 hda_nid_t nid = kcontrol->private_value & 0xffff;
606 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
607 long *valp = ucontrol->value.integer.value;
608 unsigned int val = snd_hda_codec_read(codec, nid, 0,
609 AC_VERB_GET_GPIO_DATA, 0x00);
611 *valp = (val & mask) != 0;
614 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
615 struct snd_ctl_elem_value *ucontrol)
618 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
619 hda_nid_t nid = kcontrol->private_value & 0xffff;
620 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
621 long val = *ucontrol->value.integer.value;
622 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
623 AC_VERB_GET_GPIO_DATA,
626 /* Set/unset the masked GPIO bit(s) as needed */
627 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
632 snd_hda_codec_write_cache(codec, nid, 0,
633 AC_VERB_SET_GPIO_DATA, gpio_data);
637 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
638 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
639 .info = alc_gpio_data_info, \
640 .get = alc_gpio_data_get, \
641 .put = alc_gpio_data_put, \
642 .private_value = nid | (mask<<16) }
643 #endif /* CONFIG_SND_DEBUG */
645 /* A switch control to allow the enabling of the digital IO pins on the
646 * ALC260. This is incredibly simplistic; the intention of this control is
647 * to provide something in the test model allowing digital outputs to be
648 * identified if present. If models are found which can utilise these
649 * outputs a more complete mixer control can be devised for those models if
652 #ifdef CONFIG_SND_DEBUG
653 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
655 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
656 struct snd_ctl_elem_value *ucontrol)
658 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
659 hda_nid_t nid = kcontrol->private_value & 0xffff;
660 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
661 long *valp = ucontrol->value.integer.value;
662 unsigned int val = snd_hda_codec_read(codec, nid, 0,
663 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
665 *valp = (val & mask) != 0;
668 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
669 struct snd_ctl_elem_value *ucontrol)
672 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
673 hda_nid_t nid = kcontrol->private_value & 0xffff;
674 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
675 long val = *ucontrol->value.integer.value;
676 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
677 AC_VERB_GET_DIGI_CONVERT_1,
680 /* Set/unset the masked control bit(s) as needed */
681 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
686 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
691 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
692 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
693 .info = alc_spdif_ctrl_info, \
694 .get = alc_spdif_ctrl_get, \
695 .put = alc_spdif_ctrl_put, \
696 .private_value = nid | (mask<<16) }
697 #endif /* CONFIG_SND_DEBUG */
699 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
700 * Again, this is only used in the ALC26x test models to help identify when
701 * the EAPD line must be asserted for features to work.
703 #ifdef CONFIG_SND_DEBUG
704 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
706 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *ucontrol)
709 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
710 hda_nid_t nid = kcontrol->private_value & 0xffff;
711 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
712 long *valp = ucontrol->value.integer.value;
713 unsigned int val = snd_hda_codec_read(codec, nid, 0,
714 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
716 *valp = (val & mask) != 0;
720 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
721 struct snd_ctl_elem_value *ucontrol)
724 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
725 hda_nid_t nid = kcontrol->private_value & 0xffff;
726 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
727 long val = *ucontrol->value.integer.value;
728 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
729 AC_VERB_GET_EAPD_BTLENABLE,
732 /* Set/unset the masked control bit(s) as needed */
733 change = (!val ? 0 : mask) != (ctrl_data & mask);
738 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
744 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
745 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
746 .info = alc_eapd_ctrl_info, \
747 .get = alc_eapd_ctrl_get, \
748 .put = alc_eapd_ctrl_put, \
749 .private_value = nid | (mask<<16) }
750 #endif /* CONFIG_SND_DEBUG */
754 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
756 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
758 spec->mixers[spec->num_mixers++] = mix;
761 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
763 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
765 spec->init_verbs[spec->num_init_verbs++] = verb;
768 #ifdef CONFIG_PROC_FS
772 static void print_realtek_coef(struct snd_info_buffer *buffer,
773 struct hda_codec *codec, hda_nid_t nid)
779 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
780 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
781 coeff = snd_hda_codec_read(codec, nid, 0,
782 AC_VERB_GET_COEF_INDEX, 0);
783 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
786 #define print_realtek_coef NULL
790 * set up from the preset table
792 static void setup_preset(struct alc_spec *spec,
793 const struct alc_config_preset *preset)
797 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
798 add_mixer(spec, preset->mixers[i]);
799 spec->cap_mixer = preset->cap_mixer;
800 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
802 add_verb(spec, preset->init_verbs[i]);
804 spec->channel_mode = preset->channel_mode;
805 spec->num_channel_mode = preset->num_channel_mode;
806 spec->need_dac_fix = preset->need_dac_fix;
808 spec->multiout.max_channels = spec->channel_mode[0].channels;
810 spec->multiout.num_dacs = preset->num_dacs;
811 spec->multiout.dac_nids = preset->dac_nids;
812 spec->multiout.dig_out_nid = preset->dig_out_nid;
813 spec->multiout.hp_nid = preset->hp_nid;
815 spec->num_mux_defs = preset->num_mux_defs;
816 if (!spec->num_mux_defs)
817 spec->num_mux_defs = 1;
818 spec->input_mux = preset->input_mux;
820 spec->num_adc_nids = preset->num_adc_nids;
821 spec->adc_nids = preset->adc_nids;
822 spec->capsrc_nids = preset->capsrc_nids;
823 spec->dig_in_nid = preset->dig_in_nid;
825 spec->unsol_event = preset->unsol_event;
826 spec->init_hook = preset->init_hook;
827 #ifdef CONFIG_SND_HDA_POWER_SAVE
828 spec->loopback.amplist = preset->loopbacks;
832 /* Enable GPIO mask and set output */
833 static struct hda_verb alc_gpio1_init_verbs[] = {
834 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
835 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
836 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
840 static struct hda_verb alc_gpio2_init_verbs[] = {
841 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
842 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
843 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
847 static struct hda_verb alc_gpio3_init_verbs[] = {
848 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
849 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
850 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
855 * Fix hardware PLL issue
856 * On some codecs, the analog PLL gating control must be off while
857 * the default value is 1.
859 static void alc_fix_pll(struct hda_codec *codec)
861 struct alc_spec *spec = codec->spec;
866 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
868 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
869 AC_VERB_GET_PROC_COEF, 0);
870 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
872 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
873 val & ~(1 << spec->pll_coef_bit));
876 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
877 unsigned int coef_idx, unsigned int coef_bit)
879 struct alc_spec *spec = codec->spec;
881 spec->pll_coef_idx = coef_idx;
882 spec->pll_coef_bit = coef_bit;
886 static void alc_sku_automute(struct hda_codec *codec)
888 struct alc_spec *spec = codec->spec;
889 unsigned int present;
890 unsigned int hp_nid = spec->autocfg.hp_pins[0];
891 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
893 /* need to execute and sync at first */
894 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
895 present = snd_hda_codec_read(codec, hp_nid, 0,
896 AC_VERB_GET_PIN_SENSE, 0);
897 spec->jack_present = (present & 0x80000000) != 0;
898 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
899 spec->jack_present ? 0 : PIN_OUT);
902 #if 0 /* it's broken in some acses -- temporarily disabled */
903 static void alc_mic_automute(struct hda_codec *codec)
905 struct alc_spec *spec = codec->spec;
906 unsigned int present;
907 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
908 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
909 unsigned int mix_nid = spec->capsrc_nids[0];
910 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
912 capsrc_idx_mic = mic_nid - 0x18;
913 capsrc_idx_fmic = fmic_nid - 0x18;
914 present = snd_hda_codec_read(codec, mic_nid, 0,
915 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
916 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
917 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
918 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
919 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
920 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
921 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
924 #define alc_mic_automute(codec) /* NOP */
925 #endif /* disabled */
927 /* unsolicited event for HP jack sensing */
928 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
930 if (codec->vendor_id == 0x10ec0880)
934 if (res == ALC880_HP_EVENT)
935 alc_sku_automute(codec);
937 if (res == ALC880_MIC_EVENT)
938 alc_mic_automute(codec);
941 static void alc_inithook(struct hda_codec *codec)
943 alc_sku_automute(codec);
944 alc_mic_automute(codec);
947 /* additional initialization for ALC888 variants */
948 static void alc888_coef_init(struct hda_codec *codec)
952 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
953 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
954 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
955 if ((tmp & 0xf0) == 2)
957 snd_hda_codec_read(codec, 0x20, 0,
958 AC_VERB_SET_PROC_COEF, 0x830);
961 snd_hda_codec_read(codec, 0x20, 0,
962 AC_VERB_SET_PROC_COEF, 0x3030);
965 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
966 * 31 ~ 16 : Manufacture ID
968 * 7 ~ 0 : Assembly ID
969 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
971 static void alc_subsystem_id(struct hda_codec *codec,
972 unsigned int porta, unsigned int porte,
975 unsigned int ass, tmp, i;
977 struct alc_spec *spec = codec->spec;
979 ass = codec->subsystem_id & 0xffff;
980 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
984 * 31~30 : port conetcivity
987 * 19~16 : Check sum (15:1)
992 if (codec->vendor_id == 0x10ec0260)
994 ass = snd_hda_codec_read(codec, nid, 0,
995 AC_VERB_GET_CONFIG_DEFAULT, 0);
996 if (!(ass & 1) && !(ass & 0x100000))
998 if ((ass >> 30) != 1) /* no physical connection */
1003 for (i = 1; i < 16; i++) {
1007 if (((ass >> 16) & 0xf) != tmp)
1013 * 2 : 0 --> Desktop, 1 --> Laptop
1014 * 3~5 : External Amplifier control
1017 tmp = (ass & 0x38) >> 3; /* external Amp control */
1020 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1023 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1026 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1028 case 5: /* set EAPD output high */
1029 switch (codec->vendor_id) {
1031 snd_hda_codec_write(codec, 0x0f, 0,
1032 AC_VERB_SET_EAPD_BTLENABLE, 2);
1033 snd_hda_codec_write(codec, 0x10, 0,
1034 AC_VERB_SET_EAPD_BTLENABLE, 2);
1045 snd_hda_codec_write(codec, 0x14, 0,
1046 AC_VERB_SET_EAPD_BTLENABLE, 2);
1047 snd_hda_codec_write(codec, 0x15, 0,
1048 AC_VERB_SET_EAPD_BTLENABLE, 2);
1051 switch (codec->vendor_id) {
1053 snd_hda_codec_write(codec, 0x1a, 0,
1054 AC_VERB_SET_COEF_INDEX, 7);
1055 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1056 AC_VERB_GET_PROC_COEF, 0);
1057 snd_hda_codec_write(codec, 0x1a, 0,
1058 AC_VERB_SET_COEF_INDEX, 7);
1059 snd_hda_codec_write(codec, 0x1a, 0,
1060 AC_VERB_SET_PROC_COEF,
1069 snd_hda_codec_write(codec, 0x20, 0,
1070 AC_VERB_SET_COEF_INDEX, 7);
1071 tmp = snd_hda_codec_read(codec, 0x20, 0,
1072 AC_VERB_GET_PROC_COEF, 0);
1073 snd_hda_codec_write(codec, 0x20, 0,
1074 AC_VERB_SET_COEF_INDEX, 7);
1075 snd_hda_codec_write(codec, 0x20, 0,
1076 AC_VERB_SET_PROC_COEF,
1080 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1084 snd_hda_codec_write(codec, 0x20, 0,
1085 AC_VERB_SET_COEF_INDEX, 7);
1086 tmp = snd_hda_codec_read(codec, 0x20, 0,
1087 AC_VERB_GET_PROC_COEF, 0);
1088 snd_hda_codec_write(codec, 0x20, 0,
1089 AC_VERB_SET_COEF_INDEX, 7);
1090 snd_hda_codec_write(codec, 0x20, 0,
1091 AC_VERB_SET_PROC_COEF,
1099 /* is laptop or Desktop and enable the function "Mute internal speaker
1100 * when the external headphone out jack is plugged"
1102 if (!(ass & 0x8000))
1105 * 10~8 : Jack location
1106 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1108 * 15 : 1 --> enable the function "Mute internal speaker
1109 * when the external headphone out jack is plugged"
1111 if (!spec->autocfg.speaker_pins[0]) {
1112 if (spec->autocfg.line_out_pins[0])
1113 spec->autocfg.speaker_pins[0] =
1114 spec->autocfg.line_out_pins[0];
1119 if (!spec->autocfg.hp_pins[0]) {
1120 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1122 spec->autocfg.hp_pins[0] = porta;
1124 spec->autocfg.hp_pins[0] = porte;
1126 spec->autocfg.hp_pins[0] = portd;
1130 if (spec->autocfg.hp_pins[0])
1131 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1132 AC_VERB_SET_UNSOLICITED_ENABLE,
1133 AC_USRSP_EN | ALC880_HP_EVENT);
1135 #if 0 /* it's broken in some acses -- temporarily disabled */
1136 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1137 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1138 snd_hda_codec_write(codec,
1139 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1140 AC_VERB_SET_UNSOLICITED_ENABLE,
1141 AC_USRSP_EN | ALC880_MIC_EVENT);
1142 #endif /* disabled */
1144 spec->unsol_event = alc_sku_unsol_event;
1148 * Fix-up pin default configurations
1156 static void alc_fix_pincfg(struct hda_codec *codec,
1157 const struct snd_pci_quirk *quirk,
1158 const struct alc_pincfg **pinfix)
1160 const struct alc_pincfg *cfg;
1162 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1166 cfg = pinfix[quirk->value];
1167 for (; cfg->nid; cfg++) {
1170 for (i = 0; i < 4; i++) {
1171 snd_hda_codec_write(codec, cfg->nid, 0,
1172 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1186 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1187 /* Mic-in jack as mic in */
1188 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1189 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1190 /* Line-in jack as Line in */
1191 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1192 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1193 /* Line-Out as Front */
1194 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1201 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1202 /* Mic-in jack as mic in */
1203 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1204 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1205 /* Line-in jack as Surround */
1206 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1207 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1208 /* Line-Out as Front */
1209 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1216 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1217 /* Mic-in jack as CLFE */
1218 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1219 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1220 /* Line-in jack as Surround */
1221 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1222 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1223 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1224 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1231 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1232 /* Mic-in jack as CLFE */
1233 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1234 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1235 /* Line-in jack as Surround */
1236 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1237 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1238 /* Line-Out as Side */
1239 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1243 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1244 { 2, alc888_4ST_ch2_intel_init },
1245 { 4, alc888_4ST_ch4_intel_init },
1246 { 6, alc888_4ST_ch6_intel_init },
1247 { 8, alc888_4ST_ch8_intel_init },
1251 * ALC888 Fujitsu Siemens Amillo xa3530
1254 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1255 /* Front Mic: set to PIN_IN (empty by default) */
1256 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1257 /* Connect Internal HP to Front */
1258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1259 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1260 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1261 /* Connect Bass HP to Front */
1262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1263 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1264 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1265 /* Connect Line-Out side jack (SPDIF) to Side */
1266 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1267 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1268 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1269 /* Connect Mic jack to CLFE */
1270 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1271 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1272 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1273 /* Connect Line-in jack to Surround */
1274 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1275 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1276 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1277 /* Connect HP out jack to Front */
1278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1280 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1281 /* Enable unsolicited event for HP jack and Line-out jack */
1282 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1283 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1287 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1289 unsigned int present;
1291 /* Line out presence */
1292 present = snd_hda_codec_read(codec, 0x17, 0,
1293 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1294 /* HP out presence */
1295 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1296 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1297 bits = present ? HDA_AMP_MUTE : 0;
1298 /* Toggle internal speakers muting */
1299 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1300 HDA_AMP_MUTE, bits);
1301 /* Toggle internal bass muting */
1302 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1303 HDA_AMP_MUTE, bits);
1306 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1309 if (res >> 26 == ALC880_HP_EVENT)
1310 alc888_fujitsu_xa3530_automute(codec);
1315 * ALC888 Acer Aspire 4930G model
1318 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1319 /* Front Mic: set to PIN_IN (empty by default) */
1320 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1321 /* Unselect Front Mic by default in input mixer 3 */
1322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1323 /* Enable unsolicited event for HP jack */
1324 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1325 /* Connect Internal HP to front */
1326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1327 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1328 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1329 /* Connect HP out to front */
1330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1332 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1336 static struct hda_input_mux alc888_2_capture_sources[2] = {
1337 /* Front mic only available on one ADC */
1344 { "Front Mic", 0xb },
1357 static struct snd_kcontrol_new alc888_base_mixer[] = {
1358 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1359 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1360 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1361 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1362 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1364 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1365 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1366 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1367 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1368 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1369 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1370 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1372 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1374 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1376 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1377 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1381 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1383 unsigned int present;
1385 present = snd_hda_codec_read(codec, 0x15, 0,
1386 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1387 bits = present ? HDA_AMP_MUTE : 0;
1388 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1389 HDA_AMP_MUTE, bits);
1392 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1395 if (res >> 26 == ALC880_HP_EVENT)
1396 alc888_acer_aspire_4930g_automute(codec);
1400 * ALC880 3-stack model
1402 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1403 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1404 * F-Mic = 0x1b, HP = 0x19
1407 static hda_nid_t alc880_dac_nids[4] = {
1408 /* front, rear, clfe, rear_surr */
1409 0x02, 0x05, 0x04, 0x03
1412 static hda_nid_t alc880_adc_nids[3] = {
1417 /* The datasheet says the node 0x07 is connected from inputs,
1418 * but it shows zero connection in the real implementation on some devices.
1419 * Note: this is a 915GAV bug, fixed on 915GLV
1421 static hda_nid_t alc880_adc_nids_alt[2] = {
1426 #define ALC880_DIGOUT_NID 0x06
1427 #define ALC880_DIGIN_NID 0x0a
1429 static struct hda_input_mux alc880_capture_source = {
1433 { "Front Mic", 0x3 },
1439 /* channel source setting (2/6 channel selection for 3-stack) */
1441 static struct hda_verb alc880_threestack_ch2_init[] = {
1442 /* set line-in to input, mute it */
1443 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1444 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1445 /* set mic-in to input vref 80%, mute it */
1446 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1447 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1452 static struct hda_verb alc880_threestack_ch6_init[] = {
1453 /* set line-in to output, unmute it */
1454 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1455 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1456 /* set mic-in to output, unmute it */
1457 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1458 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1462 static struct hda_channel_mode alc880_threestack_modes[2] = {
1463 { 2, alc880_threestack_ch2_init },
1464 { 6, alc880_threestack_ch6_init },
1467 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1468 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1470 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1471 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1472 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1473 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1474 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1475 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1476 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1477 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1478 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1479 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1480 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1481 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1482 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1483 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1484 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1485 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1486 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1489 .name = "Channel Mode",
1490 .info = alc_ch_mode_info,
1491 .get = alc_ch_mode_get,
1492 .put = alc_ch_mode_put,
1497 /* capture mixer elements */
1498 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1499 struct snd_ctl_elem_info *uinfo)
1501 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1502 struct alc_spec *spec = codec->spec;
1505 mutex_lock(&codec->control_mutex);
1506 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1508 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1509 mutex_unlock(&codec->control_mutex);
1513 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1514 unsigned int size, unsigned int __user *tlv)
1516 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1517 struct alc_spec *spec = codec->spec;
1520 mutex_lock(&codec->control_mutex);
1521 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1523 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1524 mutex_unlock(&codec->control_mutex);
1528 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1529 struct snd_ctl_elem_value *ucontrol);
1531 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1532 struct snd_ctl_elem_value *ucontrol,
1535 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1536 struct alc_spec *spec = codec->spec;
1537 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1540 mutex_lock(&codec->control_mutex);
1541 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1543 err = func(kcontrol, ucontrol);
1544 mutex_unlock(&codec->control_mutex);
1548 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1549 struct snd_ctl_elem_value *ucontrol)
1551 return alc_cap_getput_caller(kcontrol, ucontrol,
1552 snd_hda_mixer_amp_volume_get);
1555 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1556 struct snd_ctl_elem_value *ucontrol)
1558 return alc_cap_getput_caller(kcontrol, ucontrol,
1559 snd_hda_mixer_amp_volume_put);
1562 /* capture mixer elements */
1563 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1565 static int alc_cap_sw_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_switch_get);
1572 static int alc_cap_sw_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_switch_put);
1579 #define DEFINE_CAPMIX(num) \
1580 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1582 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1583 .name = "Capture Switch", \
1584 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1586 .info = alc_cap_sw_info, \
1587 .get = alc_cap_sw_get, \
1588 .put = alc_cap_sw_put, \
1591 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1592 .name = "Capture Volume", \
1593 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1594 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1595 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1597 .info = alc_cap_vol_info, \
1598 .get = alc_cap_vol_get, \
1599 .put = alc_cap_vol_put, \
1600 .tlv = { .c = alc_cap_vol_tlv }, \
1603 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1604 /* .name = "Capture Source", */ \
1605 .name = "Input Source", \
1607 .info = alc_mux_enum_info, \
1608 .get = alc_mux_enum_get, \
1609 .put = alc_mux_enum_put, \
1614 /* up to three ADCs */
1621 * ALC880 5-stack model
1623 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1625 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1626 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1629 /* additional mixers to alc880_three_stack_mixer */
1630 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1631 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1632 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1636 /* channel source setting (6/8 channel selection for 5-stack) */
1638 static struct hda_verb alc880_fivestack_ch6_init[] = {
1639 /* set line-in to input, mute it */
1640 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1641 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1646 static struct hda_verb alc880_fivestack_ch8_init[] = {
1647 /* set line-in to output, unmute it */
1648 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1649 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1653 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1654 { 6, alc880_fivestack_ch6_init },
1655 { 8, alc880_fivestack_ch8_init },
1660 * ALC880 6-stack model
1662 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1663 * Side = 0x05 (0x0f)
1664 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1665 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1668 static hda_nid_t alc880_6st_dac_nids[4] = {
1669 /* front, rear, clfe, rear_surr */
1670 0x02, 0x03, 0x04, 0x05
1673 static struct hda_input_mux alc880_6stack_capture_source = {
1677 { "Front Mic", 0x1 },
1683 /* fixed 8-channels */
1684 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1688 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1689 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1690 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1691 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1692 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1693 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1694 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1695 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1696 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1697 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1698 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1699 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1700 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1701 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1702 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1704 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1705 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1706 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1707 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1708 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1710 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1711 .name = "Channel Mode",
1712 .info = alc_ch_mode_info,
1713 .get = alc_ch_mode_get,
1714 .put = alc_ch_mode_put,
1723 * W810 has rear IO for:
1726 * Center/LFE (DAC 04)
1729 * The system also has a pair of internal speakers, and a headphone jack.
1730 * These are both connected to Line2 on the codec, hence to DAC 02.
1732 * There is a variable resistor to control the speaker or headphone
1733 * volume. This is a hardware-only device without a software API.
1735 * Plugging headphones in will disable the internal speakers. This is
1736 * implemented in hardware, not via the driver using jack sense. In
1737 * a similar fashion, plugging into the rear socket marked "front" will
1738 * disable both the speakers and headphones.
1740 * For input, there's a microphone jack, and an "audio in" jack.
1741 * These may not do anything useful with this driver yet, because I
1742 * haven't setup any initialization verbs for these yet...
1745 static hda_nid_t alc880_w810_dac_nids[3] = {
1746 /* front, rear/surround, clfe */
1750 /* fixed 6 channels */
1751 static struct hda_channel_mode alc880_w810_modes[1] = {
1755 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1756 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1757 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1758 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1759 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1760 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1761 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1762 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1763 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1764 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1765 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1773 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1774 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1778 static hda_nid_t alc880_z71v_dac_nids[1] = {
1781 #define ALC880_Z71V_HP_DAC 0x03
1783 /* fixed 2 channels */
1784 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1788 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1789 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1790 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1791 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1792 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1793 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1794 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1802 * ALC880 F1734 model
1804 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1805 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1808 static hda_nid_t alc880_f1734_dac_nids[1] = {
1811 #define ALC880_F1734_HP_DAC 0x02
1813 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1814 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1815 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1816 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1817 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1818 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1819 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1825 static struct hda_input_mux alc880_f1734_capture_source = {
1837 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1838 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1839 * Mic = 0x18, Line = 0x1a
1842 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1843 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1845 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1846 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1847 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1848 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1849 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1850 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1851 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1852 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1853 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1854 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1855 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1856 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1857 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1859 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1861 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1862 .name = "Channel Mode",
1863 .info = alc_ch_mode_info,
1864 .get = alc_ch_mode_get,
1865 .put = alc_ch_mode_put,
1871 * ALC880 ASUS W1V model
1873 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1874 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1875 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1878 /* additional mixers to alc880_asus_mixer */
1879 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1880 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1881 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1885 /* additional mixers to alc880_asus_mixer */
1886 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1887 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1888 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1893 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1894 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1895 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1896 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1897 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1898 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1900 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1901 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1902 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1907 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1909 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1910 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1911 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1912 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1913 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1914 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1915 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1916 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1917 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1918 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1919 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1922 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1923 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1924 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1925 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1928 .name = "Channel Mode",
1929 .info = alc_ch_mode_info,
1930 .get = alc_ch_mode_get,
1931 .put = alc_ch_mode_put,
1936 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1937 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1938 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1939 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1940 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1941 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1942 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1943 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1944 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1945 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1946 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1950 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1951 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1952 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1953 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1954 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1961 * virtual master controls
1965 * slave controls for virtual master
1967 static const char *alc_slave_vols[] = {
1968 "Front Playback Volume",
1969 "Surround Playback Volume",
1970 "Center Playback Volume",
1971 "LFE Playback Volume",
1972 "Side Playback Volume",
1973 "Headphone Playback Volume",
1974 "Speaker Playback Volume",
1975 "Mono Playback Volume",
1976 "Line-Out Playback Volume",
1977 "PCM Playback Volume",
1981 static const char *alc_slave_sws[] = {
1982 "Front Playback Switch",
1983 "Surround Playback Switch",
1984 "Center Playback Switch",
1985 "LFE Playback Switch",
1986 "Side Playback Switch",
1987 "Headphone Playback Switch",
1988 "Speaker Playback Switch",
1989 "Mono Playback Switch",
1990 "IEC958 Playback Switch",
1995 * build control elements
1998 static void alc_free_kctls(struct hda_codec *codec);
2000 static int alc_build_controls(struct hda_codec *codec)
2002 struct alc_spec *spec = codec->spec;
2006 for (i = 0; i < spec->num_mixers; i++) {
2007 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2011 if (spec->cap_mixer) {
2012 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2016 if (spec->multiout.dig_out_nid) {
2017 err = snd_hda_create_spdif_out_ctls(codec,
2018 spec->multiout.dig_out_nid);
2021 err = snd_hda_create_spdif_share_sw(codec,
2025 spec->multiout.share_spdif = 1;
2027 if (spec->dig_in_nid) {
2028 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2033 /* if we have no master control, let's create it */
2034 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2035 unsigned int vmaster_tlv[4];
2036 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2037 HDA_OUTPUT, vmaster_tlv);
2038 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2039 vmaster_tlv, alc_slave_vols);
2043 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2044 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2045 NULL, alc_slave_sws);
2050 alc_free_kctls(codec); /* no longer needed */
2056 * initialize the codec volumes, etc
2060 * generic initialization of ADC, input mixers and output mixers
2062 static struct hda_verb alc880_volume_init_verbs[] = {
2064 * Unmute ADC0-2 and set the default input to mic-in
2066 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2068 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2070 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2071 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2073 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2075 * Note: PASD motherboards uses the Line In 2 as the input for front
2078 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2088 * Set up output mixers (0x0c - 0x0f)
2090 /* set vol=0 to output mixers */
2091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2092 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2093 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2094 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2095 /* set up input amps for analog loopback */
2096 /* Amp Indices: DAC = 0, mixer = 1 */
2097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2099 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2102 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2103 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2110 * 3-stack pin configuration:
2111 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2113 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2115 * preset connection lists of input pins
2116 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2118 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2119 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2120 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2123 * Set pin mode and muting
2125 /* set front pin widgets 0x14 for output */
2126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2127 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2128 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2129 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2130 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2131 /* Mic2 (as headphone out) for HP output */
2132 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2134 /* Line In pin widget for input */
2135 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2136 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2137 /* Line2 (as front mic) pin widget for input and vref at 80% */
2138 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2139 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2140 /* CD pin widget for input */
2141 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2147 * 5-stack pin configuration:
2148 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2149 * line-in/side = 0x1a, f-mic = 0x1b
2151 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2153 * preset connection lists of input pins
2154 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2156 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2157 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2160 * Set pin mode and muting
2162 /* set pin widgets 0x14-0x17 for output */
2163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2165 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2166 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2167 /* unmute pins for output (no gain on this amp) */
2168 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2169 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2170 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2171 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2173 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2174 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2175 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2176 /* Mic2 (as headphone out) for HP output */
2177 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2178 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2179 /* Line In pin widget for input */
2180 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2181 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2182 /* Line2 (as front mic) pin widget for input and vref at 80% */
2183 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2184 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2185 /* CD pin widget for input */
2186 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2192 * W810 pin configuration:
2193 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2195 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2196 /* hphone/speaker input selector: front DAC */
2197 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2199 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2200 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2203 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2204 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2206 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2207 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2213 * Z71V pin configuration:
2214 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2216 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2222 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2223 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2224 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2225 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2231 * 6-stack pin configuration:
2232 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2233 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2235 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2236 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2238 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2239 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2240 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2241 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2242 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2243 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2244 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2245 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2247 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2249 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2251 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2252 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2254 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2255 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2261 * Uniwill pin configuration:
2262 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2265 static struct hda_verb alc880_uniwill_init_verbs[] = {
2266 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2269 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2271 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2272 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2273 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2274 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2275 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2278 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2279 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2280 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2281 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2283 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2284 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2285 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2286 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2287 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2288 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2289 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2290 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2291 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2293 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2294 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2301 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2303 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2304 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2306 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2307 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2309 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2310 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2311 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2314 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2317 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2319 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2320 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2321 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2322 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2323 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2324 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2326 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2327 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2332 static struct hda_verb alc880_beep_init_verbs[] = {
2333 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2337 /* toggle speaker-output according to the hp-jack state */
2338 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2340 unsigned int present;
2343 present = snd_hda_codec_read(codec, 0x14, 0,
2344 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2345 bits = present ? HDA_AMP_MUTE : 0;
2346 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2347 HDA_AMP_MUTE, bits);
2348 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2349 HDA_AMP_MUTE, bits);
2352 /* auto-toggle front mic */
2353 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2355 unsigned int present;
2358 present = snd_hda_codec_read(codec, 0x18, 0,
2359 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2360 bits = present ? HDA_AMP_MUTE : 0;
2361 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2364 static void alc880_uniwill_automute(struct hda_codec *codec)
2366 alc880_uniwill_hp_automute(codec);
2367 alc880_uniwill_mic_automute(codec);
2370 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2373 /* Looks like the unsol event is incompatible with the standard
2374 * definition. 4bit tag is placed at 28 bit!
2376 switch (res >> 28) {
2377 case ALC880_HP_EVENT:
2378 alc880_uniwill_hp_automute(codec);
2380 case ALC880_MIC_EVENT:
2381 alc880_uniwill_mic_automute(codec);
2386 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2388 unsigned int present;
2391 present = snd_hda_codec_read(codec, 0x14, 0,
2392 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2393 bits = present ? HDA_AMP_MUTE : 0;
2394 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2397 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2399 unsigned int present;
2401 present = snd_hda_codec_read(codec, 0x21, 0,
2402 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2403 present &= HDA_AMP_VOLMASK;
2404 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2405 HDA_AMP_VOLMASK, present);
2406 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2407 HDA_AMP_VOLMASK, present);
2410 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2413 /* Looks like the unsol event is incompatible with the standard
2414 * definition. 4bit tag is placed at 28 bit!
2416 if ((res >> 28) == ALC880_HP_EVENT)
2417 alc880_uniwill_p53_hp_automute(codec);
2418 if ((res >> 28) == ALC880_DCVOL_EVENT)
2419 alc880_uniwill_p53_dcvol_automute(codec);
2423 * F1734 pin configuration:
2424 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2426 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2427 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2428 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2429 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2430 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2431 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2434 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2438 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2439 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2441 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2442 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2443 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2444 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2445 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2446 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2448 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2449 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2455 * ASUS pin configuration:
2456 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2458 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2459 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2460 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2461 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2462 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2467 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2468 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2469 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2470 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2473 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2474 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2478 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2481 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2486 /* Enable GPIO mask and set output */
2487 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2488 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2490 /* Clevo m520g init */
2491 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2492 /* headphone output */
2493 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2498 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2499 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2501 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2502 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2503 /* Mic1 (rear panel) */
2504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2506 /* Mic2 (front panel) */
2507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2510 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2511 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2512 /* change to EAPD mode */
2513 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2514 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2519 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2520 /* change to EAPD mode */
2521 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2522 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2524 /* Headphone output */
2525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2527 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2528 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2530 /* Line In pin widget for input */
2531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2532 /* CD pin widget for input */
2533 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2534 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2535 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2537 /* change to EAPD mode */
2538 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2539 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2545 * LG m1 express dual
2548 * Rear Line-In/Out (blue): 0x14
2549 * Build-in Mic-In: 0x15
2551 * HP-Out (green): 0x1b
2552 * Mic-In/Out (red): 0x19
2556 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2557 static hda_nid_t alc880_lg_dac_nids[3] = {
2561 /* seems analog CD is not working */
2562 static struct hda_input_mux alc880_lg_capture_source = {
2567 { "Internal Mic", 0x6 },
2571 /* 2,4,6 channel modes */
2572 static struct hda_verb alc880_lg_ch2_init[] = {
2573 /* set line-in and mic-in to input */
2574 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2575 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2579 static struct hda_verb alc880_lg_ch4_init[] = {
2580 /* set line-in to out and mic-in to input */
2581 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2582 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2586 static struct hda_verb alc880_lg_ch6_init[] = {
2587 /* set line-in and mic-in to output */
2588 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2589 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2593 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2594 { 2, alc880_lg_ch2_init },
2595 { 4, alc880_lg_ch4_init },
2596 { 6, alc880_lg_ch6_init },
2599 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2600 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2601 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2602 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2603 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2604 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2605 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2606 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2607 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2608 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2609 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2610 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2611 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2612 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2613 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2615 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2616 .name = "Channel Mode",
2617 .info = alc_ch_mode_info,
2618 .get = alc_ch_mode_get,
2619 .put = alc_ch_mode_put,
2624 static struct hda_verb alc880_lg_init_verbs[] = {
2625 /* set capture source to mic-in */
2626 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2627 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2628 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2629 /* mute all amp mixer inputs */
2630 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2633 /* line-in to input */
2634 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2640 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2641 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2642 /* mic-in to input */
2643 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2644 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2645 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2647 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2648 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2649 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2651 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2655 /* toggle speaker-output according to the hp-jack state */
2656 static void alc880_lg_automute(struct hda_codec *codec)
2658 unsigned int present;
2661 present = snd_hda_codec_read(codec, 0x1b, 0,
2662 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2663 bits = present ? HDA_AMP_MUTE : 0;
2664 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2665 HDA_AMP_MUTE, bits);
2668 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2670 /* Looks like the unsol event is incompatible with the standard
2671 * definition. 4bit tag is placed at 28 bit!
2673 if ((res >> 28) == 0x01)
2674 alc880_lg_automute(codec);
2683 * Built-in Mic-In: 0x19
2689 static struct hda_input_mux alc880_lg_lw_capture_source = {
2693 { "Internal Mic", 0x1 },
2698 #define alc880_lg_lw_modes alc880_threestack_modes
2700 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2701 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2702 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2703 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2704 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2705 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2706 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2707 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2708 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2709 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2710 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2712 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2713 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2714 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2717 .name = "Channel Mode",
2718 .info = alc_ch_mode_info,
2719 .get = alc_ch_mode_get,
2720 .put = alc_ch_mode_put,
2725 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2726 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2727 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2728 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2730 /* set capture source to mic-in */
2731 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2733 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2739 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2740 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2741 /* mic-in to input */
2742 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2743 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2745 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2746 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2748 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2752 /* toggle speaker-output according to the hp-jack state */
2753 static void alc880_lg_lw_automute(struct hda_codec *codec)
2755 unsigned int present;
2758 present = snd_hda_codec_read(codec, 0x1b, 0,
2759 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2760 bits = present ? HDA_AMP_MUTE : 0;
2761 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2762 HDA_AMP_MUTE, bits);
2765 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2767 /* Looks like the unsol event is incompatible with the standard
2768 * definition. 4bit tag is placed at 28 bit!
2770 if ((res >> 28) == 0x01)
2771 alc880_lg_lw_automute(codec);
2774 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2775 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2776 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2779 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2780 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2784 static struct hda_input_mux alc880_medion_rim_capture_source = {
2788 { "Internal Mic", 0x1 },
2792 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2793 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2796 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2798 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2799 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2800 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2801 /* Mic2 (as headphone out) for HP output */
2802 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2803 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2804 /* Internal Speaker */
2805 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2808 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2809 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2811 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2815 /* toggle speaker-output according to the hp-jack state */
2816 static void alc880_medion_rim_automute(struct hda_codec *codec)
2818 unsigned int present;
2821 present = snd_hda_codec_read(codec, 0x14, 0,
2822 AC_VERB_GET_PIN_SENSE, 0)
2823 & AC_PINSENSE_PRESENCE;
2824 bits = present ? HDA_AMP_MUTE : 0;
2825 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2826 HDA_AMP_MUTE, bits);
2828 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2830 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2833 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2836 /* Looks like the unsol event is incompatible with the standard
2837 * definition. 4bit tag is placed at 28 bit!
2839 if ((res >> 28) == ALC880_HP_EVENT)
2840 alc880_medion_rim_automute(codec);
2843 #ifdef CONFIG_SND_HDA_POWER_SAVE
2844 static struct hda_amp_list alc880_loopbacks[] = {
2845 { 0x0b, HDA_INPUT, 0 },
2846 { 0x0b, HDA_INPUT, 1 },
2847 { 0x0b, HDA_INPUT, 2 },
2848 { 0x0b, HDA_INPUT, 3 },
2849 { 0x0b, HDA_INPUT, 4 },
2853 static struct hda_amp_list alc880_lg_loopbacks[] = {
2854 { 0x0b, HDA_INPUT, 1 },
2855 { 0x0b, HDA_INPUT, 6 },
2856 { 0x0b, HDA_INPUT, 7 },
2865 static int alc_init(struct hda_codec *codec)
2867 struct alc_spec *spec = codec->spec;
2871 if (codec->vendor_id == 0x10ec0888)
2872 alc888_coef_init(codec);
2874 for (i = 0; i < spec->num_init_verbs; i++)
2875 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2877 if (spec->init_hook)
2878 spec->init_hook(codec);
2883 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2885 struct alc_spec *spec = codec->spec;
2887 if (spec->unsol_event)
2888 spec->unsol_event(codec, res);
2891 #ifdef CONFIG_SND_HDA_POWER_SAVE
2892 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2894 struct alc_spec *spec = codec->spec;
2895 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2900 * Analog playback callbacks
2902 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2903 struct hda_codec *codec,
2904 struct snd_pcm_substream *substream)
2906 struct alc_spec *spec = codec->spec;
2907 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2911 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2912 struct hda_codec *codec,
2913 unsigned int stream_tag,
2914 unsigned int format,
2915 struct snd_pcm_substream *substream)
2917 struct alc_spec *spec = codec->spec;
2918 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2919 stream_tag, format, substream);
2922 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2923 struct hda_codec *codec,
2924 struct snd_pcm_substream *substream)
2926 struct alc_spec *spec = codec->spec;
2927 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2933 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2934 struct hda_codec *codec,
2935 struct snd_pcm_substream *substream)
2937 struct alc_spec *spec = codec->spec;
2938 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2941 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2942 struct hda_codec *codec,
2943 unsigned int stream_tag,
2944 unsigned int format,
2945 struct snd_pcm_substream *substream)
2947 struct alc_spec *spec = codec->spec;
2948 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2949 stream_tag, format, substream);
2952 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2953 struct hda_codec *codec,
2954 struct snd_pcm_substream *substream)
2956 struct alc_spec *spec = codec->spec;
2957 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2963 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2964 struct hda_codec *codec,
2965 unsigned int stream_tag,
2966 unsigned int format,
2967 struct snd_pcm_substream *substream)
2969 struct alc_spec *spec = codec->spec;
2971 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2972 stream_tag, 0, format);
2976 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2977 struct hda_codec *codec,
2978 struct snd_pcm_substream *substream)
2980 struct alc_spec *spec = codec->spec;
2982 snd_hda_codec_cleanup_stream(codec,
2983 spec->adc_nids[substream->number + 1]);
2990 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2994 /* NID is set in alc_build_pcms */
2996 .open = alc880_playback_pcm_open,
2997 .prepare = alc880_playback_pcm_prepare,
2998 .cleanup = alc880_playback_pcm_cleanup
3002 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3006 /* NID is set in alc_build_pcms */
3009 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3013 /* NID is set in alc_build_pcms */
3016 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3017 .substreams = 2, /* can be overridden */
3020 /* NID is set in alc_build_pcms */
3022 .prepare = alc880_alt_capture_pcm_prepare,
3023 .cleanup = alc880_alt_capture_pcm_cleanup
3027 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3031 /* NID is set in alc_build_pcms */
3033 .open = alc880_dig_playback_pcm_open,
3034 .close = alc880_dig_playback_pcm_close,
3035 .prepare = alc880_dig_playback_pcm_prepare
3039 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3043 /* NID is set in alc_build_pcms */
3046 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3047 static struct hda_pcm_stream alc_pcm_null_stream = {
3053 static int alc_build_pcms(struct hda_codec *codec)
3055 struct alc_spec *spec = codec->spec;
3056 struct hda_pcm *info = spec->pcm_rec;
3059 codec->num_pcms = 1;
3060 codec->pcm_info = info;
3062 info->name = spec->stream_name_analog;
3063 if (spec->stream_analog_playback) {
3064 if (snd_BUG_ON(!spec->multiout.dac_nids))
3066 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3067 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3069 if (spec->stream_analog_capture) {
3070 if (snd_BUG_ON(!spec->adc_nids))
3072 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3073 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3076 if (spec->channel_mode) {
3077 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3078 for (i = 0; i < spec->num_channel_mode; i++) {
3079 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3080 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3085 /* SPDIF for stream index #1 */
3086 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3087 codec->num_pcms = 2;
3088 info = spec->pcm_rec + 1;
3089 info->name = spec->stream_name_digital;
3090 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3091 if (spec->multiout.dig_out_nid &&
3092 spec->stream_digital_playback) {
3093 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3094 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3096 if (spec->dig_in_nid &&
3097 spec->stream_digital_capture) {
3098 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3099 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3101 /* FIXME: do we need this for all Realtek codec models? */
3102 codec->spdif_status_reset = 1;
3105 /* If the use of more than one ADC is requested for the current
3106 * model, configure a second analog capture-only PCM.
3108 /* Additional Analaog capture for index #2 */
3109 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3110 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3111 codec->num_pcms = 3;
3112 info = spec->pcm_rec + 2;
3113 info->name = spec->stream_name_analog;
3114 if (spec->alt_dac_nid) {
3115 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3116 *spec->stream_analog_alt_playback;
3117 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3120 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3121 alc_pcm_null_stream;
3122 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3124 if (spec->num_adc_nids > 1) {
3125 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3126 *spec->stream_analog_alt_capture;
3127 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3129 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3130 spec->num_adc_nids - 1;
3132 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3133 alc_pcm_null_stream;
3134 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3141 static void alc_free_kctls(struct hda_codec *codec)
3143 struct alc_spec *spec = codec->spec;
3145 if (spec->kctls.list) {
3146 struct snd_kcontrol_new *kctl = spec->kctls.list;
3148 for (i = 0; i < spec->kctls.used; i++)
3149 kfree(kctl[i].name);
3151 snd_array_free(&spec->kctls);
3154 static void alc_free(struct hda_codec *codec)
3156 struct alc_spec *spec = codec->spec;
3161 alc_free_kctls(codec);
3163 codec->spec = NULL; /* to be sure */
3166 #ifdef SND_HDA_NEEDS_RESUME
3167 static void store_pin_configs(struct hda_codec *codec)
3169 struct alc_spec *spec = codec->spec;
3170 hda_nid_t nid, end_nid;
3172 end_nid = codec->start_nid + codec->num_nodes;
3173 for (nid = codec->start_nid; nid < end_nid; nid++) {
3174 unsigned int wid_caps = get_wcaps(codec, nid);
3175 unsigned int wid_type =
3176 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3177 if (wid_type != AC_WID_PIN)
3179 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3181 spec->pin_nids[spec->num_pins] = nid;
3182 spec->pin_cfgs[spec->num_pins] =
3183 snd_hda_codec_read(codec, nid, 0,
3184 AC_VERB_GET_CONFIG_DEFAULT, 0);
3189 static void resume_pin_configs(struct hda_codec *codec)
3191 struct alc_spec *spec = codec->spec;
3194 for (i = 0; i < spec->num_pins; i++) {
3195 hda_nid_t pin_nid = spec->pin_nids[i];
3196 unsigned int pin_config = spec->pin_cfgs[i];
3197 snd_hda_codec_write(codec, pin_nid, 0,
3198 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3199 pin_config & 0x000000ff);
3200 snd_hda_codec_write(codec, pin_nid, 0,
3201 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3202 (pin_config & 0x0000ff00) >> 8);
3203 snd_hda_codec_write(codec, pin_nid, 0,
3204 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3205 (pin_config & 0x00ff0000) >> 16);
3206 snd_hda_codec_write(codec, pin_nid, 0,
3207 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3212 static int alc_resume(struct hda_codec *codec)
3214 resume_pin_configs(codec);
3215 codec->patch_ops.init(codec);
3216 snd_hda_codec_resume_amp(codec);
3217 snd_hda_codec_resume_cache(codec);
3221 #define store_pin_configs(codec)
3226 static struct hda_codec_ops alc_patch_ops = {
3227 .build_controls = alc_build_controls,
3228 .build_pcms = alc_build_pcms,
3231 .unsol_event = alc_unsol_event,
3232 #ifdef SND_HDA_NEEDS_RESUME
3233 .resume = alc_resume,
3235 #ifdef CONFIG_SND_HDA_POWER_SAVE
3236 .check_power_status = alc_check_power_status,
3242 * Test configuration for debugging
3244 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3247 #ifdef CONFIG_SND_DEBUG
3248 static hda_nid_t alc880_test_dac_nids[4] = {
3249 0x02, 0x03, 0x04, 0x05
3252 static struct hda_input_mux alc880_test_capture_source = {
3261 { "Surround", 0x6 },
3265 static struct hda_channel_mode alc880_test_modes[4] = {
3272 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3273 struct snd_ctl_elem_info *uinfo)
3275 static char *texts[] = {
3276 "N/A", "Line Out", "HP Out",
3277 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3279 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3281 uinfo->value.enumerated.items = 8;
3282 if (uinfo->value.enumerated.item >= 8)
3283 uinfo->value.enumerated.item = 7;
3284 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3288 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3289 struct snd_ctl_elem_value *ucontrol)
3291 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3292 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3293 unsigned int pin_ctl, item = 0;
3295 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3296 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3297 if (pin_ctl & AC_PINCTL_OUT_EN) {
3298 if (pin_ctl & AC_PINCTL_HP_EN)
3302 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3303 switch (pin_ctl & AC_PINCTL_VREFEN) {
3304 case AC_PINCTL_VREF_HIZ: item = 3; break;
3305 case AC_PINCTL_VREF_50: item = 4; break;
3306 case AC_PINCTL_VREF_GRD: item = 5; break;
3307 case AC_PINCTL_VREF_80: item = 6; break;
3308 case AC_PINCTL_VREF_100: item = 7; break;
3311 ucontrol->value.enumerated.item[0] = item;
3315 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3316 struct snd_ctl_elem_value *ucontrol)
3318 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3319 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3320 static unsigned int ctls[] = {
3321 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3322 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3323 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3324 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3325 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3326 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3328 unsigned int old_ctl, new_ctl;
3330 old_ctl = snd_hda_codec_read(codec, nid, 0,
3331 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3332 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3333 if (old_ctl != new_ctl) {
3335 snd_hda_codec_write_cache(codec, nid, 0,
3336 AC_VERB_SET_PIN_WIDGET_CONTROL,
3338 val = ucontrol->value.enumerated.item[0] >= 3 ?
3340 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3347 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3348 struct snd_ctl_elem_info *uinfo)
3350 static char *texts[] = {
3351 "Front", "Surround", "CLFE", "Side"
3353 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3355 uinfo->value.enumerated.items = 4;
3356 if (uinfo->value.enumerated.item >= 4)
3357 uinfo->value.enumerated.item = 3;
3358 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3362 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3363 struct snd_ctl_elem_value *ucontrol)
3365 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3366 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3369 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3370 ucontrol->value.enumerated.item[0] = sel & 3;
3374 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3375 struct snd_ctl_elem_value *ucontrol)
3377 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3378 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3381 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3382 if (ucontrol->value.enumerated.item[0] != sel) {
3383 sel = ucontrol->value.enumerated.item[0] & 3;
3384 snd_hda_codec_write_cache(codec, nid, 0,
3385 AC_VERB_SET_CONNECT_SEL, sel);
3391 #define PIN_CTL_TEST(xname,nid) { \
3392 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3394 .info = alc_test_pin_ctl_info, \
3395 .get = alc_test_pin_ctl_get, \
3396 .put = alc_test_pin_ctl_put, \
3397 .private_value = nid \
3400 #define PIN_SRC_TEST(xname,nid) { \
3401 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3403 .info = alc_test_pin_src_info, \
3404 .get = alc_test_pin_src_get, \
3405 .put = alc_test_pin_src_put, \
3406 .private_value = nid \
3409 static struct snd_kcontrol_new alc880_test_mixer[] = {
3410 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3411 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3412 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3413 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3414 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3415 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3416 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3417 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3418 PIN_CTL_TEST("Front Pin Mode", 0x14),
3419 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3420 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3421 PIN_CTL_TEST("Side Pin Mode", 0x17),
3422 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3423 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3424 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3425 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3426 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3427 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3428 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3429 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3430 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3431 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3432 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3433 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3434 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3435 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3436 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3437 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3438 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3439 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3441 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3442 .name = "Channel Mode",
3443 .info = alc_ch_mode_info,
3444 .get = alc_ch_mode_get,
3445 .put = alc_ch_mode_put,
3450 static struct hda_verb alc880_test_init_verbs[] = {
3451 /* Unmute inputs of 0x0c - 0x0f */
3452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3454 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3455 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3456 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3457 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3458 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3459 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3460 /* Vol output for 0x0c-0x0f */
3461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3463 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3465 /* Set output pins 0x14-0x17 */
3466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3468 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3469 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3470 /* Unmute output pins 0x14-0x17 */
3471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3472 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3473 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3474 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3475 /* Set input pins 0x18-0x1c */
3476 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3477 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3478 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3480 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3481 /* Mute input pins 0x18-0x1b */
3482 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3484 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3485 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3488 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3490 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3492 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3493 /* Analog input/passthru */
3494 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3495 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3496 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3497 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3498 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3506 static const char *alc880_models[ALC880_MODEL_LAST] = {
3507 [ALC880_3ST] = "3stack",
3508 [ALC880_TCL_S700] = "tcl",
3509 [ALC880_3ST_DIG] = "3stack-digout",
3510 [ALC880_CLEVO] = "clevo",
3511 [ALC880_5ST] = "5stack",
3512 [ALC880_5ST_DIG] = "5stack-digout",
3513 [ALC880_W810] = "w810",
3514 [ALC880_Z71V] = "z71v",
3515 [ALC880_6ST] = "6stack",
3516 [ALC880_6ST_DIG] = "6stack-digout",
3517 [ALC880_ASUS] = "asus",
3518 [ALC880_ASUS_W1V] = "asus-w1v",
3519 [ALC880_ASUS_DIG] = "asus-dig",
3520 [ALC880_ASUS_DIG2] = "asus-dig2",
3521 [ALC880_UNIWILL_DIG] = "uniwill",
3522 [ALC880_UNIWILL_P53] = "uniwill-p53",
3523 [ALC880_FUJITSU] = "fujitsu",
3524 [ALC880_F1734] = "F1734",
3526 [ALC880_LG_LW] = "lg-lw",
3527 [ALC880_MEDION_RIM] = "medion",
3528 #ifdef CONFIG_SND_DEBUG
3529 [ALC880_TEST] = "test",
3531 [ALC880_AUTO] = "auto",
3534 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3535 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3536 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3537 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3538 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3539 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3540 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3541 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3542 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3543 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3544 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3545 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3546 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3547 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3548 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3549 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3550 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3551 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3552 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3553 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3554 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3555 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3556 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3557 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3558 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3559 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3560 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3561 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3562 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3563 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3564 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3565 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3566 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3567 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3568 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3569 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3570 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3571 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3572 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3573 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3574 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3575 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3576 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3577 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3578 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3579 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3580 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3581 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3582 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3583 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3584 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3585 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3586 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3587 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3588 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3589 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3590 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3591 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3592 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3593 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3594 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3595 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3596 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3597 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3598 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3599 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3600 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3601 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3602 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3603 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3604 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3605 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3610 * ALC880 codec presets
3612 static struct alc_config_preset alc880_presets[] = {
3614 .mixers = { alc880_three_stack_mixer },
3615 .init_verbs = { alc880_volume_init_verbs,
3616 alc880_pin_3stack_init_verbs },
3617 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3618 .dac_nids = alc880_dac_nids,
3619 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3620 .channel_mode = alc880_threestack_modes,
3622 .input_mux = &alc880_capture_source,
3624 [ALC880_3ST_DIG] = {
3625 .mixers = { alc880_three_stack_mixer },
3626 .init_verbs = { alc880_volume_init_verbs,
3627 alc880_pin_3stack_init_verbs },
3628 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3629 .dac_nids = alc880_dac_nids,
3630 .dig_out_nid = ALC880_DIGOUT_NID,
3631 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3632 .channel_mode = alc880_threestack_modes,
3634 .input_mux = &alc880_capture_source,
3636 [ALC880_TCL_S700] = {
3637 .mixers = { alc880_tcl_s700_mixer },
3638 .init_verbs = { alc880_volume_init_verbs,
3639 alc880_pin_tcl_S700_init_verbs,
3640 alc880_gpio2_init_verbs },
3641 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3642 .dac_nids = alc880_dac_nids,
3643 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3644 .num_adc_nids = 1, /* single ADC */
3646 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3647 .channel_mode = alc880_2_jack_modes,
3648 .input_mux = &alc880_capture_source,
3651 .mixers = { alc880_three_stack_mixer,
3652 alc880_five_stack_mixer},
3653 .init_verbs = { alc880_volume_init_verbs,
3654 alc880_pin_5stack_init_verbs },
3655 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3656 .dac_nids = alc880_dac_nids,
3657 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3658 .channel_mode = alc880_fivestack_modes,
3659 .input_mux = &alc880_capture_source,
3661 [ALC880_5ST_DIG] = {
3662 .mixers = { alc880_three_stack_mixer,
3663 alc880_five_stack_mixer },
3664 .init_verbs = { alc880_volume_init_verbs,
3665 alc880_pin_5stack_init_verbs },
3666 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3667 .dac_nids = alc880_dac_nids,
3668 .dig_out_nid = ALC880_DIGOUT_NID,
3669 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3670 .channel_mode = alc880_fivestack_modes,
3671 .input_mux = &alc880_capture_source,
3674 .mixers = { alc880_six_stack_mixer },
3675 .init_verbs = { alc880_volume_init_verbs,
3676 alc880_pin_6stack_init_verbs },
3677 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3678 .dac_nids = alc880_6st_dac_nids,
3679 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3680 .channel_mode = alc880_sixstack_modes,
3681 .input_mux = &alc880_6stack_capture_source,
3683 [ALC880_6ST_DIG] = {
3684 .mixers = { alc880_six_stack_mixer },
3685 .init_verbs = { alc880_volume_init_verbs,
3686 alc880_pin_6stack_init_verbs },
3687 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3688 .dac_nids = alc880_6st_dac_nids,
3689 .dig_out_nid = ALC880_DIGOUT_NID,
3690 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3691 .channel_mode = alc880_sixstack_modes,
3692 .input_mux = &alc880_6stack_capture_source,
3695 .mixers = { alc880_w810_base_mixer },
3696 .init_verbs = { alc880_volume_init_verbs,
3697 alc880_pin_w810_init_verbs,
3698 alc880_gpio2_init_verbs },
3699 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3700 .dac_nids = alc880_w810_dac_nids,
3701 .dig_out_nid = ALC880_DIGOUT_NID,
3702 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3703 .channel_mode = alc880_w810_modes,
3704 .input_mux = &alc880_capture_source,
3707 .mixers = { alc880_z71v_mixer },
3708 .init_verbs = { alc880_volume_init_verbs,
3709 alc880_pin_z71v_init_verbs },
3710 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3711 .dac_nids = alc880_z71v_dac_nids,
3712 .dig_out_nid = ALC880_DIGOUT_NID,
3714 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3715 .channel_mode = alc880_2_jack_modes,
3716 .input_mux = &alc880_capture_source,
3719 .mixers = { alc880_f1734_mixer },
3720 .init_verbs = { alc880_volume_init_verbs,
3721 alc880_pin_f1734_init_verbs },
3722 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3723 .dac_nids = alc880_f1734_dac_nids,
3725 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3726 .channel_mode = alc880_2_jack_modes,
3727 .input_mux = &alc880_f1734_capture_source,
3728 .unsol_event = alc880_uniwill_p53_unsol_event,
3729 .init_hook = alc880_uniwill_p53_hp_automute,
3732 .mixers = { alc880_asus_mixer },
3733 .init_verbs = { alc880_volume_init_verbs,
3734 alc880_pin_asus_init_verbs,
3735 alc880_gpio1_init_verbs },
3736 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3737 .dac_nids = alc880_asus_dac_nids,
3738 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3739 .channel_mode = alc880_asus_modes,
3741 .input_mux = &alc880_capture_source,
3743 [ALC880_ASUS_DIG] = {
3744 .mixers = { alc880_asus_mixer },
3745 .init_verbs = { alc880_volume_init_verbs,
3746 alc880_pin_asus_init_verbs,
3747 alc880_gpio1_init_verbs },
3748 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3749 .dac_nids = alc880_asus_dac_nids,
3750 .dig_out_nid = ALC880_DIGOUT_NID,
3751 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3752 .channel_mode = alc880_asus_modes,
3754 .input_mux = &alc880_capture_source,
3756 [ALC880_ASUS_DIG2] = {
3757 .mixers = { alc880_asus_mixer },
3758 .init_verbs = { alc880_volume_init_verbs,
3759 alc880_pin_asus_init_verbs,
3760 alc880_gpio2_init_verbs }, /* use GPIO2 */
3761 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3762 .dac_nids = alc880_asus_dac_nids,
3763 .dig_out_nid = ALC880_DIGOUT_NID,
3764 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3765 .channel_mode = alc880_asus_modes,
3767 .input_mux = &alc880_capture_source,
3769 [ALC880_ASUS_W1V] = {
3770 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3771 .init_verbs = { alc880_volume_init_verbs,
3772 alc880_pin_asus_init_verbs,
3773 alc880_gpio1_init_verbs },
3774 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3775 .dac_nids = alc880_asus_dac_nids,
3776 .dig_out_nid = ALC880_DIGOUT_NID,
3777 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3778 .channel_mode = alc880_asus_modes,
3780 .input_mux = &alc880_capture_source,
3782 [ALC880_UNIWILL_DIG] = {
3783 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3784 .init_verbs = { alc880_volume_init_verbs,
3785 alc880_pin_asus_init_verbs },
3786 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3787 .dac_nids = alc880_asus_dac_nids,
3788 .dig_out_nid = ALC880_DIGOUT_NID,
3789 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3790 .channel_mode = alc880_asus_modes,
3792 .input_mux = &alc880_capture_source,
3794 [ALC880_UNIWILL] = {
3795 .mixers = { alc880_uniwill_mixer },
3796 .init_verbs = { alc880_volume_init_verbs,
3797 alc880_uniwill_init_verbs },
3798 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3799 .dac_nids = alc880_asus_dac_nids,
3800 .dig_out_nid = ALC880_DIGOUT_NID,
3801 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3802 .channel_mode = alc880_threestack_modes,
3804 .input_mux = &alc880_capture_source,
3805 .unsol_event = alc880_uniwill_unsol_event,
3806 .init_hook = alc880_uniwill_automute,
3808 [ALC880_UNIWILL_P53] = {
3809 .mixers = { alc880_uniwill_p53_mixer },
3810 .init_verbs = { alc880_volume_init_verbs,
3811 alc880_uniwill_p53_init_verbs },
3812 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3813 .dac_nids = alc880_asus_dac_nids,
3814 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3815 .channel_mode = alc880_threestack_modes,
3816 .input_mux = &alc880_capture_source,
3817 .unsol_event = alc880_uniwill_p53_unsol_event,
3818 .init_hook = alc880_uniwill_p53_hp_automute,
3820 [ALC880_FUJITSU] = {
3821 .mixers = { alc880_fujitsu_mixer,
3822 alc880_pcbeep_mixer, },
3823 .init_verbs = { alc880_volume_init_verbs,
3824 alc880_uniwill_p53_init_verbs,
3825 alc880_beep_init_verbs },
3826 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3827 .dac_nids = alc880_dac_nids,
3828 .dig_out_nid = ALC880_DIGOUT_NID,
3829 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3830 .channel_mode = alc880_2_jack_modes,
3831 .input_mux = &alc880_capture_source,
3832 .unsol_event = alc880_uniwill_p53_unsol_event,
3833 .init_hook = alc880_uniwill_p53_hp_automute,
3836 .mixers = { alc880_three_stack_mixer },
3837 .init_verbs = { alc880_volume_init_verbs,
3838 alc880_pin_clevo_init_verbs },
3839 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3840 .dac_nids = alc880_dac_nids,
3842 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3843 .channel_mode = alc880_threestack_modes,
3845 .input_mux = &alc880_capture_source,
3848 .mixers = { alc880_lg_mixer },
3849 .init_verbs = { alc880_volume_init_verbs,
3850 alc880_lg_init_verbs },
3851 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3852 .dac_nids = alc880_lg_dac_nids,
3853 .dig_out_nid = ALC880_DIGOUT_NID,
3854 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3855 .channel_mode = alc880_lg_ch_modes,
3857 .input_mux = &alc880_lg_capture_source,
3858 .unsol_event = alc880_lg_unsol_event,
3859 .init_hook = alc880_lg_automute,
3860 #ifdef CONFIG_SND_HDA_POWER_SAVE
3861 .loopbacks = alc880_lg_loopbacks,
3865 .mixers = { alc880_lg_lw_mixer },
3866 .init_verbs = { alc880_volume_init_verbs,
3867 alc880_lg_lw_init_verbs },
3868 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3869 .dac_nids = alc880_dac_nids,
3870 .dig_out_nid = ALC880_DIGOUT_NID,
3871 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3872 .channel_mode = alc880_lg_lw_modes,
3873 .input_mux = &alc880_lg_lw_capture_source,
3874 .unsol_event = alc880_lg_lw_unsol_event,
3875 .init_hook = alc880_lg_lw_automute,
3877 [ALC880_MEDION_RIM] = {
3878 .mixers = { alc880_medion_rim_mixer },
3879 .init_verbs = { alc880_volume_init_verbs,
3880 alc880_medion_rim_init_verbs,
3881 alc_gpio2_init_verbs },
3882 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3883 .dac_nids = alc880_dac_nids,
3884 .dig_out_nid = ALC880_DIGOUT_NID,
3885 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3886 .channel_mode = alc880_2_jack_modes,
3887 .input_mux = &alc880_medion_rim_capture_source,
3888 .unsol_event = alc880_medion_rim_unsol_event,
3889 .init_hook = alc880_medion_rim_automute,
3891 #ifdef CONFIG_SND_DEBUG
3893 .mixers = { alc880_test_mixer },
3894 .init_verbs = { alc880_test_init_verbs },
3895 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3896 .dac_nids = alc880_test_dac_nids,
3897 .dig_out_nid = ALC880_DIGOUT_NID,
3898 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3899 .channel_mode = alc880_test_modes,
3900 .input_mux = &alc880_test_capture_source,
3906 * Automatic parse of I/O pins from the BIOS configuration
3911 ALC_CTL_WIDGET_MUTE,
3914 static struct snd_kcontrol_new alc880_control_templates[] = {
3915 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3916 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3917 HDA_BIND_MUTE(NULL, 0, 0, 0),
3920 /* add dynamic controls */
3921 static int add_control(struct alc_spec *spec, int type, const char *name,
3924 struct snd_kcontrol_new *knew;
3926 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3927 knew = snd_array_new(&spec->kctls);
3930 *knew = alc880_control_templates[type];
3931 knew->name = kstrdup(name, GFP_KERNEL);
3934 knew->private_value = val;
3938 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3939 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3940 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3941 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3942 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3943 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3944 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3945 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3946 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3947 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3948 #define ALC880_PIN_CD_NID 0x1c
3950 /* fill in the dac_nids table from the parsed pin configuration */
3951 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3952 const struct auto_pin_cfg *cfg)
3958 memset(assigned, 0, sizeof(assigned));
3959 spec->multiout.dac_nids = spec->private_dac_nids;
3961 /* check the pins hardwired to audio widget */
3962 for (i = 0; i < cfg->line_outs; i++) {
3963 nid = cfg->line_out_pins[i];
3964 if (alc880_is_fixed_pin(nid)) {
3965 int idx = alc880_fixed_pin_idx(nid);
3966 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3970 /* left pins can be connect to any audio widget */
3971 for (i = 0; i < cfg->line_outs; i++) {
3972 nid = cfg->line_out_pins[i];
3973 if (alc880_is_fixed_pin(nid))
3975 /* search for an empty channel */
3976 for (j = 0; j < cfg->line_outs; j++) {
3978 spec->multiout.dac_nids[i] =
3979 alc880_idx_to_dac(j);
3985 spec->multiout.num_dacs = cfg->line_outs;
3989 /* add playback controls from the parsed DAC table */
3990 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3991 const struct auto_pin_cfg *cfg)
3994 static const char *chname[4] = {
3995 "Front", "Surround", NULL /*CLFE*/, "Side"
4000 for (i = 0; i < cfg->line_outs; i++) {
4001 if (!spec->multiout.dac_nids[i])
4003 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4006 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4007 "Center Playback Volume",
4008 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4012 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4013 "LFE Playback Volume",
4014 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4018 err = add_control(spec, ALC_CTL_BIND_MUTE,
4019 "Center Playback Switch",
4020 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4024 err = add_control(spec, ALC_CTL_BIND_MUTE,
4025 "LFE Playback Switch",
4026 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4031 sprintf(name, "%s Playback Volume", chname[i]);
4032 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4033 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4037 sprintf(name, "%s Playback Switch", chname[i]);
4038 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4039 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4048 /* add playback controls for speaker and HP outputs */
4049 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4059 if (alc880_is_fixed_pin(pin)) {
4060 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4061 /* specify the DAC as the extra output */
4062 if (!spec->multiout.hp_nid)
4063 spec->multiout.hp_nid = nid;
4065 spec->multiout.extra_out_nid[0] = nid;
4066 /* control HP volume/switch on the output mixer amp */
4067 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4068 sprintf(name, "%s Playback Volume", pfx);
4069 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4070 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4073 sprintf(name, "%s Playback Switch", pfx);
4074 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4075 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4078 } else if (alc880_is_multi_pin(pin)) {
4079 /* set manual connection */
4080 /* we have only a switch on HP-out PIN */
4081 sprintf(name, "%s Playback Switch", pfx);
4082 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4083 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4090 /* create input playback/capture controls for the given pin */
4091 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4092 const char *ctlname,
4093 int idx, hda_nid_t mix_nid)
4098 sprintf(name, "%s Playback Volume", ctlname);
4099 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4100 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4103 sprintf(name, "%s Playback Switch", ctlname);
4104 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4105 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4111 /* create playback/capture controls for input pins */
4112 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4113 const struct auto_pin_cfg *cfg)
4115 struct hda_input_mux *imux = &spec->private_imux;
4118 for (i = 0; i < AUTO_PIN_LAST; i++) {
4119 if (alc880_is_input_pin(cfg->input_pins[i])) {
4120 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4121 err = new_analog_input(spec, cfg->input_pins[i],
4122 auto_pin_cfg_labels[i],
4126 imux->items[imux->num_items].label =
4127 auto_pin_cfg_labels[i];
4128 imux->items[imux->num_items].index =
4129 alc880_input_pin_idx(cfg->input_pins[i]);
4136 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4137 unsigned int pin_type)
4139 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4142 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4146 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4147 hda_nid_t nid, int pin_type,
4150 alc_set_pin_output(codec, nid, pin_type);
4151 /* need the manual connection? */
4152 if (alc880_is_multi_pin(nid)) {
4153 struct alc_spec *spec = codec->spec;
4154 int idx = alc880_multi_pin_idx(nid);
4155 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4156 AC_VERB_SET_CONNECT_SEL,
4157 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4161 static int get_pin_type(int line_out_type)
4163 if (line_out_type == AUTO_PIN_HP_OUT)
4169 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4171 struct alc_spec *spec = codec->spec;
4174 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4175 for (i = 0; i < spec->autocfg.line_outs; i++) {
4176 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4177 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4178 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4182 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4184 struct alc_spec *spec = codec->spec;
4187 pin = spec->autocfg.speaker_pins[0];
4188 if (pin) /* connect to front */
4189 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4190 pin = spec->autocfg.hp_pins[0];
4191 if (pin) /* connect to front */
4192 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4195 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4197 struct alc_spec *spec = codec->spec;
4200 for (i = 0; i < AUTO_PIN_LAST; i++) {
4201 hda_nid_t nid = spec->autocfg.input_pins[i];
4202 if (alc880_is_input_pin(nid)) {
4203 snd_hda_codec_write(codec, nid, 0,
4204 AC_VERB_SET_PIN_WIDGET_CONTROL,
4205 i <= AUTO_PIN_FRONT_MIC ?
4206 PIN_VREF80 : PIN_IN);
4207 if (nid != ALC880_PIN_CD_NID)
4208 snd_hda_codec_write(codec, nid, 0,
4209 AC_VERB_SET_AMP_GAIN_MUTE,
4215 /* parse the BIOS configuration and set up the alc_spec */
4216 /* return 1 if successful, 0 if the proper config is not found,
4217 * or a negative error code
4219 static int alc880_parse_auto_config(struct hda_codec *codec)
4221 struct alc_spec *spec = codec->spec;
4223 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4225 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4229 if (!spec->autocfg.line_outs)
4230 return 0; /* can't find valid BIOS pin config */
4232 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4235 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4238 err = alc880_auto_create_extra_out(spec,
4239 spec->autocfg.speaker_pins[0],
4243 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4247 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4251 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4253 if (spec->autocfg.dig_out_pin)
4254 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4255 if (spec->autocfg.dig_in_pin)
4256 spec->dig_in_nid = ALC880_DIGIN_NID;
4258 if (spec->kctls.list)
4259 add_mixer(spec, spec->kctls.list);
4261 add_verb(spec, alc880_volume_init_verbs);
4263 spec->num_mux_defs = 1;
4264 spec->input_mux = &spec->private_imux;
4266 store_pin_configs(codec);
4270 /* additional initialization for auto-configuration model */
4271 static void alc880_auto_init(struct hda_codec *codec)
4273 struct alc_spec *spec = codec->spec;
4274 alc880_auto_init_multi_out(codec);
4275 alc880_auto_init_extra_out(codec);
4276 alc880_auto_init_analog_input(codec);
4277 if (spec->unsol_event)
4278 alc_inithook(codec);
4282 * OK, here we have finally the patch for ALC880
4285 static void set_capture_mixer(struct alc_spec *spec)
4287 static struct snd_kcontrol_new *caps[3] = {
4292 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4293 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4296 static int patch_alc880(struct hda_codec *codec)
4298 struct alc_spec *spec;
4302 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4308 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4311 if (board_config < 0) {
4312 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4313 "trying auto-probe from BIOS...\n");
4314 board_config = ALC880_AUTO;
4317 if (board_config == ALC880_AUTO) {
4318 /* automatic parse from the BIOS config */
4319 err = alc880_parse_auto_config(codec);
4325 "hda_codec: Cannot set up configuration "
4326 "from BIOS. Using 3-stack mode...\n");
4327 board_config = ALC880_3ST;
4331 if (board_config != ALC880_AUTO)
4332 setup_preset(spec, &alc880_presets[board_config]);
4334 spec->stream_name_analog = "ALC880 Analog";
4335 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4336 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4337 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4339 spec->stream_name_digital = "ALC880 Digital";
4340 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4341 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4343 if (!spec->adc_nids && spec->input_mux) {
4344 /* check whether NID 0x07 is valid */
4345 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4347 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4348 if (wcap != AC_WID_AUD_IN) {
4349 spec->adc_nids = alc880_adc_nids_alt;
4350 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4352 spec->adc_nids = alc880_adc_nids;
4353 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4356 set_capture_mixer(spec);
4358 spec->vmaster_nid = 0x0c;
4360 codec->patch_ops = alc_patch_ops;
4361 if (board_config == ALC880_AUTO)
4362 spec->init_hook = alc880_auto_init;
4363 #ifdef CONFIG_SND_HDA_POWER_SAVE
4364 if (!spec->loopback.amplist)
4365 spec->loopback.amplist = alc880_loopbacks;
4367 codec->proc_widget_hook = print_realtek_coef;
4377 static hda_nid_t alc260_dac_nids[1] = {
4382 static hda_nid_t alc260_adc_nids[1] = {
4387 static hda_nid_t alc260_adc_nids_alt[1] = {
4392 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4393 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4395 static hda_nid_t alc260_dual_adc_nids[2] = {
4400 #define ALC260_DIGOUT_NID 0x03
4401 #define ALC260_DIGIN_NID 0x06
4403 static struct hda_input_mux alc260_capture_source = {
4407 { "Front Mic", 0x1 },
4413 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4414 * headphone jack and the internal CD lines since these are the only pins at
4415 * which audio can appear. For flexibility, also allow the option of
4416 * recording the mixer output on the second ADC (ADC0 doesn't have a
4417 * connection to the mixer output).
4419 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4423 { "Mic/Line", 0x0 },
4425 { "Headphone", 0x2 },
4431 { "Mic/Line", 0x0 },
4433 { "Headphone", 0x2 },
4440 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4441 * the Fujitsu S702x, but jacks are marked differently.
4443 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4450 { "Headphone", 0x5 },
4459 { "Headphone", 0x6 },
4465 * This is just place-holder, so there's something for alc_build_pcms to look
4466 * at when it calculates the maximum number of channels. ALC260 has no mixer
4467 * element which allows changing the channel mode, so the verb list is
4470 static struct hda_channel_mode alc260_modes[1] = {
4475 /* Mixer combinations
4477 * basic: base_output + input + pc_beep + capture
4478 * HP: base_output + input + capture_alt
4479 * HP_3013: hp_3013 + input + capture
4480 * fujitsu: fujitsu + capture
4481 * acer: acer + capture
4484 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4485 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4486 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4487 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4488 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4489 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4490 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4494 static struct snd_kcontrol_new alc260_input_mixer[] = {
4495 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4496 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4497 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4498 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4500 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4501 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4502 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4506 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4507 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4508 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4512 /* update HP, line and mono out pins according to the master switch */
4513 static void alc260_hp_master_update(struct hda_codec *codec,
4514 hda_nid_t hp, hda_nid_t line,
4517 struct alc_spec *spec = codec->spec;
4518 unsigned int val = spec->master_sw ? PIN_HP : 0;
4519 /* change HP and line-out pins */
4520 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4522 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4524 /* mono (speaker) depending on the HP jack sense */
4525 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4526 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4530 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4531 struct snd_ctl_elem_value *ucontrol)
4533 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4534 struct alc_spec *spec = codec->spec;
4535 *ucontrol->value.integer.value = spec->master_sw;
4539 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4540 struct snd_ctl_elem_value *ucontrol)
4542 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4543 struct alc_spec *spec = codec->spec;
4544 int val = !!*ucontrol->value.integer.value;
4545 hda_nid_t hp, line, mono;
4547 if (val == spec->master_sw)
4549 spec->master_sw = val;
4550 hp = (kcontrol->private_value >> 16) & 0xff;
4551 line = (kcontrol->private_value >> 8) & 0xff;
4552 mono = kcontrol->private_value & 0xff;
4553 alc260_hp_master_update(codec, hp, line, mono);
4557 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4559 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4560 .name = "Master Playback Switch",
4561 .info = snd_ctl_boolean_mono_info,
4562 .get = alc260_hp_master_sw_get,
4563 .put = alc260_hp_master_sw_put,
4564 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4566 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4567 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4568 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4569 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4570 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4572 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4576 static struct hda_verb alc260_hp_unsol_verbs[] = {
4577 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4581 static void alc260_hp_automute(struct hda_codec *codec)
4583 struct alc_spec *spec = codec->spec;
4584 unsigned int present;
4586 present = snd_hda_codec_read(codec, 0x10, 0,
4587 AC_VERB_GET_PIN_SENSE, 0);
4588 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4589 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4592 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4594 if ((res >> 26) == ALC880_HP_EVENT)
4595 alc260_hp_automute(codec);
4598 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4600 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4601 .name = "Master Playback Switch",
4602 .info = snd_ctl_boolean_mono_info,
4603 .get = alc260_hp_master_sw_get,
4604 .put = alc260_hp_master_sw_put,
4605 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4607 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4608 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4609 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4610 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4611 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4613 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4614 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4618 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4619 .ops = &snd_hda_bind_vol,
4621 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4622 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4623 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4628 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4629 .ops = &snd_hda_bind_sw,
4631 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4632 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4637 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4638 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4639 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4640 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4645 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4646 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4650 static void alc260_hp_3013_automute(struct hda_codec *codec)
4652 struct alc_spec *spec = codec->spec;
4653 unsigned int present;
4655 present = snd_hda_codec_read(codec, 0x15, 0,
4656 AC_VERB_GET_PIN_SENSE, 0);
4657 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4658 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4661 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4664 if ((res >> 26) == ALC880_HP_EVENT)
4665 alc260_hp_3013_automute(codec);
4668 static void alc260_hp_3012_automute(struct hda_codec *codec)
4670 unsigned int present, bits;
4672 present = snd_hda_codec_read(codec, 0x10, 0,
4673 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4675 bits = present ? 0 : PIN_OUT;
4676 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4678 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4680 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4684 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4687 if ((res >> 26) == ALC880_HP_EVENT)
4688 alc260_hp_3012_automute(codec);
4691 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4692 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4694 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4695 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4696 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4697 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4698 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4699 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4700 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4701 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4702 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4703 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4704 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4705 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4706 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4710 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4711 * versions of the ALC260 don't act on requests to enable mic bias from NID
4712 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4713 * datasheet doesn't mention this restriction. At this stage it's not clear
4714 * whether this behaviour is intentional or is a hardware bug in chip
4715 * revisions available in early 2006. Therefore for now allow the
4716 * "Headphone Jack Mode" control to span all choices, but if it turns out
4717 * that the lack of mic bias for this NID is intentional we could change the
4718 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4720 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4721 * don't appear to make the mic bias available from the "line" jack, even
4722 * though the NID used for this jack (0x14) can supply it. The theory is
4723 * that perhaps Acer have included blocking capacitors between the ALC260
4724 * and the output jack. If this turns out to be the case for all such
4725 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4726 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4728 * The C20x Tablet series have a mono internal speaker which is controlled
4729 * via the chip's Mono sum widget and pin complex, so include the necessary
4730 * controls for such models. On models without a "mono speaker" the control
4731 * won't do anything.
4733 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4734 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4735 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4736 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4737 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4739 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4741 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4742 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4744 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4745 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4746 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4747 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4748 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4749 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4750 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4754 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4755 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4757 static struct snd_kcontrol_new alc260_will_mixer[] = {
4758 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4759 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4761 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4762 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4763 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4764 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4765 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4766 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4767 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4768 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4769 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4773 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4774 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4776 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4777 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4778 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4780 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4781 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4782 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4783 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4784 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4785 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4786 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4791 * initialization verbs
4793 static struct hda_verb alc260_init_verbs[] = {
4794 /* Line In pin widget for input */
4795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4796 /* CD pin widget for input */
4797 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4798 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4799 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4800 /* Mic2 (front panel) pin widget for input and vref at 80% */
4801 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4802 /* LINE-2 is used for line-out in rear */
4803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4804 /* select line-out */
4805 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4807 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4809 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4811 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4812 /* mute capture amp left and right */
4813 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4814 /* set connection select to line in (default select for this ADC) */
4815 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4816 /* mute capture amp left and right */
4817 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4818 /* set connection select to line in (default select for this ADC) */
4819 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4820 /* set vol=0 Line-Out mixer amp left and right */
4821 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4822 /* unmute pin widget amp left and right (no gain on this amp) */
4823 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4824 /* set vol=0 HP mixer amp left and right */
4825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4826 /* unmute pin widget amp left and right (no gain on this amp) */
4827 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4828 /* set vol=0 Mono mixer amp left and right */
4829 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4830 /* unmute pin widget amp left and right (no gain on this amp) */
4831 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4832 /* unmute LINE-2 out pin */
4833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4834 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4837 /* mute analog inputs */
4838 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4839 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4840 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4843 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4844 /* mute Front out path */
4845 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4846 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4847 /* mute Headphone out path */
4848 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4849 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4850 /* mute Mono out path */
4851 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4852 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4856 #if 0 /* should be identical with alc260_init_verbs? */
4857 static struct hda_verb alc260_hp_init_verbs[] = {
4858 /* Headphone and output */
4859 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4861 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4862 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4863 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4864 /* Mic2 (front panel) pin widget for input and vref at 80% */
4865 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4866 /* Line In pin widget for input */
4867 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4868 /* Line-2 pin widget for output */
4869 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4870 /* CD pin widget for input */
4871 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4872 /* unmute amp left and right */
4873 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4874 /* set connection select to line in (default select for this ADC) */
4875 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4876 /* unmute Line-Out mixer amp left and right (volume = 0) */
4877 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4878 /* mute pin widget amp left and right (no gain on this amp) */
4879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4880 /* unmute HP mixer amp left and right (volume = 0) */
4881 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4882 /* mute pin widget amp left and right (no gain on this amp) */
4883 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4884 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4887 /* mute analog inputs */
4888 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4890 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4891 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4893 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4894 /* Unmute Front out path */
4895 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4896 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4897 /* Unmute Headphone out path */
4898 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4900 /* Unmute Mono out path */
4901 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4902 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4907 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4908 /* Line out and output */
4909 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4911 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4912 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4913 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4914 /* Mic2 (front panel) pin widget for input and vref at 80% */
4915 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4916 /* Line In pin widget for input */
4917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4918 /* Headphone pin widget for output */
4919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4920 /* CD pin widget for input */
4921 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4922 /* unmute amp left and right */
4923 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4924 /* set connection select to line in (default select for this ADC) */
4925 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4926 /* unmute Line-Out mixer amp left and right (volume = 0) */
4927 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4928 /* mute pin widget amp left and right (no gain on this amp) */
4929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4930 /* unmute HP mixer amp left and right (volume = 0) */
4931 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4932 /* mute pin widget amp left and right (no gain on this amp) */
4933 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4934 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4937 /* mute analog inputs */
4938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4943 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4944 /* Unmute Front out path */
4945 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4946 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4947 /* Unmute Headphone out path */
4948 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4949 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4950 /* Unmute Mono out path */
4951 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4952 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4956 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4957 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4958 * audio = 0x16, internal speaker = 0x10.
4960 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4961 /* Disable all GPIOs */
4962 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4963 /* Internal speaker is connected to headphone pin */
4964 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4965 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4967 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4968 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4969 /* Ensure all other unused pins are disabled and muted. */
4970 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4971 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4972 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4973 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4974 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4975 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4977 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4979 /* Disable digital (SPDIF) pins */
4980 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4981 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4983 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4984 * when acting as an output.
4986 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4988 /* Start with output sum widgets muted and their output gains at min */
4989 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4991 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4992 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4993 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4995 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4996 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4997 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4999 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5000 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5001 /* Unmute Line1 pin widget output buffer since it starts as an output.
5002 * If the pin mode is changed by the user the pin mode control will
5003 * take care of enabling the pin's input/output buffers as needed.
5004 * Therefore there's no need to enable the input buffer at this
5007 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5008 /* Unmute input buffer of pin widget used for Line-in (no equiv
5011 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5013 /* Mute capture amp left and right */
5014 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5015 /* Set ADC connection select to match default mixer setting - line
5018 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5020 /* Do the same for the second ADC: mute capture input amp and
5021 * set ADC connection to line in (on mic1 pin)
5023 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5024 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5026 /* Mute all inputs to mixer widget (even unconnected ones) */
5027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5034 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5039 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5040 * similar laptops (adapted from Fujitsu init verbs).
5042 static struct hda_verb alc260_acer_init_verbs[] = {
5043 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5044 * the headphone jack. Turn this on and rely on the standard mute
5045 * methods whenever the user wants to turn these outputs off.
5047 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5048 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5049 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5050 /* Internal speaker/Headphone jack is connected to Line-out pin */
5051 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5052 /* Internal microphone/Mic jack is connected to Mic1 pin */
5053 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5054 /* Line In jack is connected to Line1 pin */
5055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5056 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5057 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5058 /* Ensure all other unused pins are disabled and muted. */
5059 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5060 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5061 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5062 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5063 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5065 /* Disable digital (SPDIF) pins */
5066 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5067 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5069 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5070 * bus when acting as outputs.
5072 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5073 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5075 /* Start with output sum widgets muted and their output gains at min */
5076 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5078 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5080 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5081 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5082 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5083 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5084 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5086 /* Unmute Line-out pin widget amp left and right
5087 * (no equiv mixer ctrl)
5089 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5090 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5091 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5092 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5093 * inputs. If the pin mode is changed by the user the pin mode control
5094 * will take care of enabling the pin's input/output buffers as needed.
5095 * Therefore there's no need to enable the input buffer at this
5098 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5099 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5101 /* Mute capture amp left and right */
5102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5103 /* Set ADC connection select to match default mixer setting - mic
5106 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5108 /* Do similar with the second ADC: mute capture input amp and
5109 * set ADC connection to mic to match ALSA's default state.
5111 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5112 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5114 /* Mute all inputs to mixer widget (even unconnected ones) */
5115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5127 static struct hda_verb alc260_will_verbs[] = {
5128 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5129 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5130 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5131 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5132 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5133 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5137 static struct hda_verb alc260_replacer_672v_verbs[] = {
5138 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5139 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5140 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5142 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5143 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5144 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5146 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5150 /* toggle speaker-output according to the hp-jack state */
5151 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5153 unsigned int present;
5155 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5156 present = snd_hda_codec_read(codec, 0x0f, 0,
5157 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5159 snd_hda_codec_write_cache(codec, 0x01, 0,
5160 AC_VERB_SET_GPIO_DATA, 1);
5161 snd_hda_codec_write_cache(codec, 0x0f, 0,
5162 AC_VERB_SET_PIN_WIDGET_CONTROL,
5165 snd_hda_codec_write_cache(codec, 0x01, 0,
5166 AC_VERB_SET_GPIO_DATA, 0);
5167 snd_hda_codec_write_cache(codec, 0x0f, 0,
5168 AC_VERB_SET_PIN_WIDGET_CONTROL,
5173 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5176 if ((res >> 26) == ALC880_HP_EVENT)
5177 alc260_replacer_672v_automute(codec);
5180 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5181 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5182 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5183 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5184 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5185 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5186 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5187 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5188 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5189 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5190 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5194 /* Test configuration for debugging, modelled after the ALC880 test
5197 #ifdef CONFIG_SND_DEBUG
5198 static hda_nid_t alc260_test_dac_nids[1] = {
5201 static hda_nid_t alc260_test_adc_nids[2] = {
5204 /* For testing the ALC260, each input MUX needs its own definition since
5205 * the signal assignments are different. This assumes that the first ADC
5208 static struct hda_input_mux alc260_test_capture_sources[2] = {
5212 { "MIC1 pin", 0x0 },
5213 { "MIC2 pin", 0x1 },
5214 { "LINE1 pin", 0x2 },
5215 { "LINE2 pin", 0x3 },
5217 { "LINE-OUT pin", 0x5 },
5218 { "HP-OUT pin", 0x6 },
5224 { "MIC1 pin", 0x0 },
5225 { "MIC2 pin", 0x1 },
5226 { "LINE1 pin", 0x2 },
5227 { "LINE2 pin", 0x3 },
5230 { "LINE-OUT pin", 0x6 },
5231 { "HP-OUT pin", 0x7 },
5235 static struct snd_kcontrol_new alc260_test_mixer[] = {
5236 /* Output driver widgets */
5237 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5238 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5239 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5240 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5241 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5242 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5244 /* Modes for retasking pin widgets
5245 * Note: the ALC260 doesn't seem to act on requests to enable mic
5246 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5247 * mention this restriction. At this stage it's not clear whether
5248 * this behaviour is intentional or is a hardware bug in chip
5249 * revisions available at least up until early 2006. Therefore for
5250 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5251 * choices, but if it turns out that the lack of mic bias for these
5252 * NIDs is intentional we could change their modes from
5253 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5255 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5256 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5257 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5258 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5259 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5260 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5262 /* Loopback mixer controls */
5263 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5264 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5265 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5266 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5267 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5268 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5269 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5270 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5271 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5272 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5273 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5274 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5275 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5276 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5277 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5278 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5280 /* Controls for GPIO pins, assuming they are configured as outputs */
5281 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5282 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5283 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5284 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5286 /* Switches to allow the digital IO pins to be enabled. The datasheet
5287 * is ambigious as to which NID is which; testing on laptops which
5288 * make this output available should provide clarification.
5290 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5291 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5293 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5294 * this output to turn on an external amplifier.
5296 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5297 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5301 static struct hda_verb alc260_test_init_verbs[] = {
5302 /* Enable all GPIOs as outputs with an initial value of 0 */
5303 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5304 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5305 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5307 /* Enable retasking pins as output, initially without power amp */
5308 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5309 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5312 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5313 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5315 /* Disable digital (SPDIF) pins initially, but users can enable
5316 * them via a mixer switch. In the case of SPDIF-out, this initverb
5317 * payload also sets the generation to 0, output to be in "consumer"
5318 * PCM format, copyright asserted, no pre-emphasis and no validity
5321 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5322 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5324 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5325 * OUT1 sum bus when acting as an output.
5327 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5328 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5329 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5330 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5332 /* Start with output sum widgets muted and their output gains at min */
5333 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5336 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5337 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5339 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5340 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5341 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5343 /* Unmute retasking pin widget output buffers since the default
5344 * state appears to be output. As the pin mode is changed by the
5345 * user the pin mode control will take care of enabling the pin's
5346 * input/output buffers as needed.
5348 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5349 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5351 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5352 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5353 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5354 /* Also unmute the mono-out pin widget */
5355 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5357 /* Mute capture amp left and right */
5358 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5359 /* Set ADC connection select to match default mixer setting (mic1
5362 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5364 /* Do the same for the second ADC: mute capture input amp and
5365 * set ADC connection to mic1 pin
5367 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5368 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5370 /* Mute all inputs to mixer widget (even unconnected ones) */
5371 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5384 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5385 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5387 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5388 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5391 * for BIOS auto-configuration
5394 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5395 const char *pfx, int *vol_bits)
5398 unsigned long vol_val, sw_val;
5402 if (nid >= 0x0f && nid < 0x11) {
5403 nid_vol = nid - 0x7;
5404 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5405 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5406 } else if (nid == 0x11) {
5407 nid_vol = nid - 0x7;
5408 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5409 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5410 } else if (nid >= 0x12 && nid <= 0x15) {
5412 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5413 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5417 if (!(*vol_bits & (1 << nid_vol))) {
5418 /* first control for the volume widget */
5419 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5420 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5423 *vol_bits |= (1 << nid_vol);
5425 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5426 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5432 /* add playback controls from the parsed DAC table */
5433 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5434 const struct auto_pin_cfg *cfg)
5440 spec->multiout.num_dacs = 1;
5441 spec->multiout.dac_nids = spec->private_dac_nids;
5442 spec->multiout.dac_nids[0] = 0x02;
5444 nid = cfg->line_out_pins[0];
5446 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5451 nid = cfg->speaker_pins[0];
5453 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5458 nid = cfg->hp_pins[0];
5460 err = alc260_add_playback_controls(spec, nid, "Headphone",
5468 /* create playback/capture controls for input pins */
5469 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5470 const struct auto_pin_cfg *cfg)
5472 struct hda_input_mux *imux = &spec->private_imux;
5475 for (i = 0; i < AUTO_PIN_LAST; i++) {
5476 if (cfg->input_pins[i] >= 0x12) {
5477 idx = cfg->input_pins[i] - 0x12;
5478 err = new_analog_input(spec, cfg->input_pins[i],
5479 auto_pin_cfg_labels[i], idx,
5483 imux->items[imux->num_items].label =
5484 auto_pin_cfg_labels[i];
5485 imux->items[imux->num_items].index = idx;
5488 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5489 idx = cfg->input_pins[i] - 0x09;
5490 err = new_analog_input(spec, cfg->input_pins[i],
5491 auto_pin_cfg_labels[i], idx,
5495 imux->items[imux->num_items].label =
5496 auto_pin_cfg_labels[i];
5497 imux->items[imux->num_items].index = idx;
5504 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5505 hda_nid_t nid, int pin_type,
5508 alc_set_pin_output(codec, nid, pin_type);
5509 /* need the manual connection? */
5511 int idx = nid - 0x12;
5512 snd_hda_codec_write(codec, idx + 0x0b, 0,
5513 AC_VERB_SET_CONNECT_SEL, sel_idx);
5517 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5519 struct alc_spec *spec = codec->spec;
5522 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5523 nid = spec->autocfg.line_out_pins[0];
5525 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5526 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5529 nid = spec->autocfg.speaker_pins[0];
5531 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5533 nid = spec->autocfg.hp_pins[0];
5535 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5538 #define ALC260_PIN_CD_NID 0x16
5539 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5541 struct alc_spec *spec = codec->spec;
5544 for (i = 0; i < AUTO_PIN_LAST; i++) {
5545 hda_nid_t nid = spec->autocfg.input_pins[i];
5547 snd_hda_codec_write(codec, nid, 0,
5548 AC_VERB_SET_PIN_WIDGET_CONTROL,
5549 i <= AUTO_PIN_FRONT_MIC ?
5550 PIN_VREF80 : PIN_IN);
5551 if (nid != ALC260_PIN_CD_NID)
5552 snd_hda_codec_write(codec, nid, 0,
5553 AC_VERB_SET_AMP_GAIN_MUTE,
5560 * generic initialization of ADC, input mixers and output mixers
5562 static struct hda_verb alc260_volume_init_verbs[] = {
5564 * Unmute ADC0-1 and set the default input to mic-in
5566 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5567 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5568 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5569 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5571 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5573 * Note: PASD motherboards uses the Line In 2 as the input for
5574 * front panel mic (mic 2)
5576 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5577 /* mute analog inputs */
5578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5585 * Set up output mixers (0x08 - 0x0a)
5587 /* set vol=0 to output mixers */
5588 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5589 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5590 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5591 /* set up input amps for analog loopback */
5592 /* Amp Indices: DAC = 0, mixer = 1 */
5593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5595 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5597 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5598 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5603 static int alc260_parse_auto_config(struct hda_codec *codec)
5605 struct alc_spec *spec = codec->spec;
5607 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5609 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5613 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5616 if (!spec->kctls.list)
5617 return 0; /* can't find valid BIOS pin config */
5618 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5622 spec->multiout.max_channels = 2;
5624 if (spec->autocfg.dig_out_pin)
5625 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5626 if (spec->kctls.list)
5627 add_mixer(spec, spec->kctls.list);
5629 add_verb(spec, alc260_volume_init_verbs);
5631 spec->num_mux_defs = 1;
5632 spec->input_mux = &spec->private_imux;
5634 store_pin_configs(codec);
5638 /* additional initialization for auto-configuration model */
5639 static void alc260_auto_init(struct hda_codec *codec)
5641 struct alc_spec *spec = codec->spec;
5642 alc260_auto_init_multi_out(codec);
5643 alc260_auto_init_analog_input(codec);
5644 if (spec->unsol_event)
5645 alc_inithook(codec);
5648 #ifdef CONFIG_SND_HDA_POWER_SAVE
5649 static struct hda_amp_list alc260_loopbacks[] = {
5650 { 0x07, HDA_INPUT, 0 },
5651 { 0x07, HDA_INPUT, 1 },
5652 { 0x07, HDA_INPUT, 2 },
5653 { 0x07, HDA_INPUT, 3 },
5654 { 0x07, HDA_INPUT, 4 },
5660 * ALC260 configurations
5662 static const char *alc260_models[ALC260_MODEL_LAST] = {
5663 [ALC260_BASIC] = "basic",
5665 [ALC260_HP_3013] = "hp-3013",
5666 [ALC260_HP_DC7600] = "hp-dc7600",
5667 [ALC260_FUJITSU_S702X] = "fujitsu",
5668 [ALC260_ACER] = "acer",
5669 [ALC260_WILL] = "will",
5670 [ALC260_REPLACER_672V] = "replacer",
5671 #ifdef CONFIG_SND_DEBUG
5672 [ALC260_TEST] = "test",
5674 [ALC260_AUTO] = "auto",
5677 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5678 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5679 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5680 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5681 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5682 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5683 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5684 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5685 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5686 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5687 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5688 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5689 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5690 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5691 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5692 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5693 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5694 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5695 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5699 static struct alc_config_preset alc260_presets[] = {
5701 .mixers = { alc260_base_output_mixer,
5703 alc260_pc_beep_mixer },
5704 .init_verbs = { alc260_init_verbs },
5705 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5706 .dac_nids = alc260_dac_nids,
5707 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5708 .adc_nids = alc260_adc_nids,
5709 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5710 .channel_mode = alc260_modes,
5711 .input_mux = &alc260_capture_source,
5714 .mixers = { alc260_hp_output_mixer,
5715 alc260_input_mixer },
5716 .init_verbs = { alc260_init_verbs,
5717 alc260_hp_unsol_verbs },
5718 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5719 .dac_nids = alc260_dac_nids,
5720 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5721 .adc_nids = alc260_adc_nids_alt,
5722 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5723 .channel_mode = alc260_modes,
5724 .input_mux = &alc260_capture_source,
5725 .unsol_event = alc260_hp_unsol_event,
5726 .init_hook = alc260_hp_automute,
5728 [ALC260_HP_DC7600] = {
5729 .mixers = { alc260_hp_dc7600_mixer,
5730 alc260_input_mixer },
5731 .init_verbs = { alc260_init_verbs,
5732 alc260_hp_dc7600_verbs },
5733 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5734 .dac_nids = alc260_dac_nids,
5735 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5736 .adc_nids = alc260_adc_nids_alt,
5737 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5738 .channel_mode = alc260_modes,
5739 .input_mux = &alc260_capture_source,
5740 .unsol_event = alc260_hp_3012_unsol_event,
5741 .init_hook = alc260_hp_3012_automute,
5743 [ALC260_HP_3013] = {
5744 .mixers = { alc260_hp_3013_mixer,
5745 alc260_input_mixer },
5746 .init_verbs = { alc260_hp_3013_init_verbs,
5747 alc260_hp_3013_unsol_verbs },
5748 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5749 .dac_nids = alc260_dac_nids,
5750 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5751 .adc_nids = alc260_adc_nids_alt,
5752 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5753 .channel_mode = alc260_modes,
5754 .input_mux = &alc260_capture_source,
5755 .unsol_event = alc260_hp_3013_unsol_event,
5756 .init_hook = alc260_hp_3013_automute,
5758 [ALC260_FUJITSU_S702X] = {
5759 .mixers = { alc260_fujitsu_mixer },
5760 .init_verbs = { alc260_fujitsu_init_verbs },
5761 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5762 .dac_nids = alc260_dac_nids,
5763 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5764 .adc_nids = alc260_dual_adc_nids,
5765 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5766 .channel_mode = alc260_modes,
5767 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5768 .input_mux = alc260_fujitsu_capture_sources,
5771 .mixers = { alc260_acer_mixer },
5772 .init_verbs = { alc260_acer_init_verbs },
5773 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5774 .dac_nids = alc260_dac_nids,
5775 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5776 .adc_nids = alc260_dual_adc_nids,
5777 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5778 .channel_mode = alc260_modes,
5779 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5780 .input_mux = alc260_acer_capture_sources,
5783 .mixers = { alc260_will_mixer },
5784 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5785 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5786 .dac_nids = alc260_dac_nids,
5787 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5788 .adc_nids = alc260_adc_nids,
5789 .dig_out_nid = ALC260_DIGOUT_NID,
5790 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5791 .channel_mode = alc260_modes,
5792 .input_mux = &alc260_capture_source,
5794 [ALC260_REPLACER_672V] = {
5795 .mixers = { alc260_replacer_672v_mixer },
5796 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5797 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5798 .dac_nids = alc260_dac_nids,
5799 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5800 .adc_nids = alc260_adc_nids,
5801 .dig_out_nid = ALC260_DIGOUT_NID,
5802 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5803 .channel_mode = alc260_modes,
5804 .input_mux = &alc260_capture_source,
5805 .unsol_event = alc260_replacer_672v_unsol_event,
5806 .init_hook = alc260_replacer_672v_automute,
5808 #ifdef CONFIG_SND_DEBUG
5810 .mixers = { alc260_test_mixer },
5811 .init_verbs = { alc260_test_init_verbs },
5812 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5813 .dac_nids = alc260_test_dac_nids,
5814 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5815 .adc_nids = alc260_test_adc_nids,
5816 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5817 .channel_mode = alc260_modes,
5818 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5819 .input_mux = alc260_test_capture_sources,
5824 static int patch_alc260(struct hda_codec *codec)
5826 struct alc_spec *spec;
5827 int err, board_config;
5829 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5835 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5838 if (board_config < 0) {
5839 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5840 "trying auto-probe from BIOS...\n");
5841 board_config = ALC260_AUTO;
5844 if (board_config == ALC260_AUTO) {
5845 /* automatic parse from the BIOS config */
5846 err = alc260_parse_auto_config(codec);
5852 "hda_codec: Cannot set up configuration "
5853 "from BIOS. Using base mode...\n");
5854 board_config = ALC260_BASIC;
5858 if (board_config != ALC260_AUTO)
5859 setup_preset(spec, &alc260_presets[board_config]);
5861 spec->stream_name_analog = "ALC260 Analog";
5862 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5863 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5865 spec->stream_name_digital = "ALC260 Digital";
5866 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5867 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5869 if (!spec->adc_nids && spec->input_mux) {
5870 /* check whether NID 0x04 is valid */
5871 unsigned int wcap = get_wcaps(codec, 0x04);
5872 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5874 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5875 spec->adc_nids = alc260_adc_nids_alt;
5876 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5878 spec->adc_nids = alc260_adc_nids;
5879 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5882 set_capture_mixer(spec);
5884 spec->vmaster_nid = 0x08;
5886 codec->patch_ops = alc_patch_ops;
5887 if (board_config == ALC260_AUTO)
5888 spec->init_hook = alc260_auto_init;
5889 #ifdef CONFIG_SND_HDA_POWER_SAVE
5890 if (!spec->loopback.amplist)
5891 spec->loopback.amplist = alc260_loopbacks;
5893 codec->proc_widget_hook = print_realtek_coef;
5902 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5903 * configuration. Each pin widget can choose any input DACs and a mixer.
5904 * Each ADC is connected from a mixer of all inputs. This makes possible
5905 * 6-channel independent captures.
5907 * In addition, an independent DAC for the multi-playback (not used in this
5910 #define ALC882_DIGOUT_NID 0x06
5911 #define ALC882_DIGIN_NID 0x0a
5913 static struct hda_channel_mode alc882_ch_modes[1] = {
5917 static hda_nid_t alc882_dac_nids[4] = {
5918 /* front, rear, clfe, rear_surr */
5919 0x02, 0x03, 0x04, 0x05
5922 /* identical with ALC880 */
5923 #define alc882_adc_nids alc880_adc_nids
5924 #define alc882_adc_nids_alt alc880_adc_nids_alt
5926 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5927 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5930 /* FIXME: should be a matrix-type input source selection */
5932 static struct hda_input_mux alc882_capture_source = {
5936 { "Front Mic", 0x1 },
5944 static struct hda_verb alc882_3ST_ch2_init[] = {
5945 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5946 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5947 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5948 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5955 static struct hda_verb alc882_3ST_ch6_init[] = {
5956 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5957 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5958 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5959 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5960 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5961 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5965 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5966 { 2, alc882_3ST_ch2_init },
5967 { 6, alc882_3ST_ch6_init },
5973 static struct hda_verb alc882_sixstack_ch6_init[] = {
5974 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5975 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5976 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5977 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5984 static struct hda_verb alc882_sixstack_ch8_init[] = {
5985 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5986 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5987 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5988 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5992 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5993 { 6, alc882_sixstack_ch6_init },
5994 { 8, alc882_sixstack_ch8_init },
5998 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6004 static struct hda_verb alc885_mbp_ch2_init[] = {
6005 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6006 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6007 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6014 static struct hda_verb alc885_mbp_ch6_init[] = {
6015 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6016 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6017 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6018 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6019 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6023 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6024 { 2, alc885_mbp_ch2_init },
6025 { 6, alc885_mbp_ch6_init },
6029 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6030 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6032 static struct snd_kcontrol_new alc882_base_mixer[] = {
6033 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6034 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6035 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6036 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6037 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6038 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6039 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6040 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6041 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6042 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6043 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6044 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6045 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6051 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6052 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6053 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6054 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6055 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6059 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6060 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6061 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6062 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6063 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6064 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6065 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6067 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6068 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6069 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6072 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6073 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6074 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6075 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6076 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6077 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6078 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6080 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6082 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6083 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6087 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6091 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6092 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6093 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6094 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6095 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6096 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6097 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6098 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6099 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6100 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6104 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6105 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6107 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6108 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6109 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6110 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6111 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6112 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6113 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6115 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6116 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6117 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6120 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6124 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6125 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6126 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6128 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6129 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6133 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6135 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6136 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6140 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6142 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6143 .name = "Channel Mode",
6144 .info = alc_ch_mode_info,
6145 .get = alc_ch_mode_get,
6146 .put = alc_ch_mode_put,
6151 static struct hda_verb alc882_init_verbs[] = {
6152 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6153 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6157 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6158 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6159 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6161 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6162 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6163 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6165 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6166 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6167 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6169 /* Front Pin: output 0 (0x0c) */
6170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6171 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6172 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6173 /* Rear Pin: output 1 (0x0d) */
6174 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6176 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6177 /* CLFE Pin: output 2 (0x0e) */
6178 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6179 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6180 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6181 /* Side Pin: output 3 (0x0f) */
6182 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6184 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6185 /* Mic (rear) pin: input vref at 80% */
6186 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6187 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6188 /* Front Mic pin: input vref at 80% */
6189 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6190 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6191 /* Line In pin: input */
6192 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6193 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6194 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6195 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6196 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6197 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6198 /* CD pin widget for input */
6199 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6201 /* FIXME: use matrix-type input source selection */
6202 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6203 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6204 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6218 /* ADC1: mute amp left and right */
6219 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6220 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6221 /* ADC2: mute amp left and right */
6222 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6223 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6224 /* ADC3: mute amp left and right */
6225 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6226 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6231 static struct hda_verb alc882_eapd_verbs[] = {
6232 /* change to EAPD mode */
6233 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6234 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6239 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6240 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6241 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6243 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6244 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6245 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6246 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6250 static struct hda_verb alc882_macpro_init_verbs[] = {
6251 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6255 /* Front Pin: output 0 (0x0c) */
6256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6258 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6259 /* Front Mic pin: input vref at 80% */
6260 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6261 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6262 /* Speaker: output */
6263 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6264 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6265 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6266 /* Headphone output (output 0 - 0x0c) */
6267 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6268 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6269 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6271 /* FIXME: use matrix-type input source selection */
6272 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6273 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6288 /* ADC1: mute amp left and right */
6289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6290 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6291 /* ADC2: mute amp left and right */
6292 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6293 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6294 /* ADC3: mute amp left and right */
6295 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6296 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6301 /* Macbook Pro rev3 */
6302 static struct hda_verb alc885_mbp3_init_verbs[] = {
6303 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6308 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6311 /* Front Pin: output 0 (0x0c) */
6312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6313 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6314 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6315 /* HP Pin: output 0 (0x0d) */
6316 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6317 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6318 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6320 /* Mic (rear) pin: input vref at 80% */
6321 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6323 /* Front Mic pin: input vref at 80% */
6324 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6325 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6326 /* Line In pin: use output 1 when in LineOut mode */
6327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6328 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6329 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6331 /* FIXME: use matrix-type input source selection */
6332 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6333 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6341 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6342 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6348 /* ADC1: mute amp left and right */
6349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6350 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6351 /* ADC2: mute amp left and right */
6352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6353 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6354 /* ADC3: mute amp left and right */
6355 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6356 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6361 /* iMac 24 mixer. */
6362 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6363 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6364 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6368 /* iMac 24 init verbs. */
6369 static struct hda_verb alc885_imac24_init_verbs[] = {
6370 /* Internal speakers: output 0 (0x0c) */
6371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6373 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6374 /* Internal speakers: output 0 (0x0c) */
6375 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6377 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6378 /* Headphone: output 0 (0x0c) */
6379 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6380 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6381 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6382 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6383 /* Front Mic: input vref at 80% */
6384 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6385 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6389 /* Toggle speaker-output according to the hp-jack state */
6390 static void alc885_imac24_automute(struct hda_codec *codec)
6392 unsigned int present;
6394 present = snd_hda_codec_read(codec, 0x14, 0,
6395 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6396 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6397 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6398 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6399 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6402 /* Processes unsolicited events. */
6403 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6406 /* Headphone insertion or removal. */
6407 if ((res >> 26) == ALC880_HP_EVENT)
6408 alc885_imac24_automute(codec);
6411 static void alc885_mbp3_automute(struct hda_codec *codec)
6413 unsigned int present;
6415 present = snd_hda_codec_read(codec, 0x15, 0,
6416 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6417 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6418 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6419 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6420 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6423 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6426 /* Headphone insertion or removal. */
6427 if ((res >> 26) == ALC880_HP_EVENT)
6428 alc885_mbp3_automute(codec);
6432 static struct hda_verb alc882_targa_verbs[] = {
6433 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6437 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6439 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6440 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6441 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6443 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6444 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6445 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6446 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6450 /* toggle speaker-output according to the hp-jack state */
6451 static void alc882_targa_automute(struct hda_codec *codec)
6453 unsigned int present;
6455 present = snd_hda_codec_read(codec, 0x14, 0,
6456 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6457 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6458 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6459 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6463 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6465 /* Looks like the unsol event is incompatible with the standard
6466 * definition. 4bit tag is placed at 26 bit!
6468 if (((res >> 26) == ALC880_HP_EVENT)) {
6469 alc882_targa_automute(codec);
6473 static struct hda_verb alc882_asus_a7j_verbs[] = {
6474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6477 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6479 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6481 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6482 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6483 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6485 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6486 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6487 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6491 static struct hda_verb alc882_asus_a7m_verbs[] = {
6492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6497 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6499 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6500 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6501 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6503 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6504 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6505 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6509 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6511 unsigned int gpiostate, gpiomask, gpiodir;
6513 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6514 AC_VERB_GET_GPIO_DATA, 0);
6517 gpiostate |= (1 << pin);
6519 gpiostate &= ~(1 << pin);
6521 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6522 AC_VERB_GET_GPIO_MASK, 0);
6523 gpiomask |= (1 << pin);
6525 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6526 AC_VERB_GET_GPIO_DIRECTION, 0);
6527 gpiodir |= (1 << pin);
6530 snd_hda_codec_write(codec, codec->afg, 0,
6531 AC_VERB_SET_GPIO_MASK, gpiomask);
6532 snd_hda_codec_write(codec, codec->afg, 0,
6533 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6537 snd_hda_codec_write(codec, codec->afg, 0,
6538 AC_VERB_SET_GPIO_DATA, gpiostate);
6541 /* set up GPIO at initialization */
6542 static void alc885_macpro_init_hook(struct hda_codec *codec)
6544 alc882_gpio_mute(codec, 0, 0);
6545 alc882_gpio_mute(codec, 1, 0);
6548 /* set up GPIO and update auto-muting at initialization */
6549 static void alc885_imac24_init_hook(struct hda_codec *codec)
6551 alc885_macpro_init_hook(codec);
6552 alc885_imac24_automute(codec);
6556 * generic initialization of ADC, input mixers and output mixers
6558 static struct hda_verb alc882_auto_init_verbs[] = {
6560 * Unmute ADC0-2 and set the default input to mic-in
6562 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6563 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6564 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6565 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6566 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6567 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6569 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6571 * Note: PASD motherboards uses the Line In 2 as the input for
6572 * front panel mic (mic 2)
6574 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6578 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6582 * Set up output mixers (0x0c - 0x0f)
6584 /* set vol=0 to output mixers */
6585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6589 /* set up input amps for analog loopback */
6590 /* Amp Indices: DAC = 0, mixer = 1 */
6591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6593 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6594 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6595 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6596 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6599 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6600 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6602 /* FIXME: use matrix-type input source selection */
6603 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6604 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6606 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6607 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6611 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6623 #ifdef CONFIG_SND_HDA_POWER_SAVE
6624 #define alc882_loopbacks alc880_loopbacks
6627 /* pcm configuration: identiacal with ALC880 */
6628 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6629 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6630 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6631 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6634 * configuration and preset
6636 static const char *alc882_models[ALC882_MODEL_LAST] = {
6637 [ALC882_3ST_DIG] = "3stack-dig",
6638 [ALC882_6ST_DIG] = "6stack-dig",
6639 [ALC882_ARIMA] = "arima",
6640 [ALC882_W2JC] = "w2jc",
6641 [ALC882_TARGA] = "targa",
6642 [ALC882_ASUS_A7J] = "asus-a7j",
6643 [ALC882_ASUS_A7M] = "asus-a7m",
6644 [ALC885_MACPRO] = "macpro",
6645 [ALC885_MBP3] = "mbp3",
6646 [ALC885_IMAC24] = "imac24",
6647 [ALC882_AUTO] = "auto",
6650 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6651 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6652 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6653 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6654 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6655 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6656 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6657 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6658 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6659 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6660 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6661 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6662 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6666 static struct alc_config_preset alc882_presets[] = {
6667 [ALC882_3ST_DIG] = {
6668 .mixers = { alc882_base_mixer },
6669 .init_verbs = { alc882_init_verbs },
6670 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6671 .dac_nids = alc882_dac_nids,
6672 .dig_out_nid = ALC882_DIGOUT_NID,
6673 .dig_in_nid = ALC882_DIGIN_NID,
6674 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6675 .channel_mode = alc882_ch_modes,
6677 .input_mux = &alc882_capture_source,
6679 [ALC882_6ST_DIG] = {
6680 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6681 .init_verbs = { alc882_init_verbs },
6682 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6683 .dac_nids = alc882_dac_nids,
6684 .dig_out_nid = ALC882_DIGOUT_NID,
6685 .dig_in_nid = ALC882_DIGIN_NID,
6686 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6687 .channel_mode = alc882_sixstack_modes,
6688 .input_mux = &alc882_capture_source,
6691 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6692 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6693 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6694 .dac_nids = alc882_dac_nids,
6695 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6696 .channel_mode = alc882_sixstack_modes,
6697 .input_mux = &alc882_capture_source,
6700 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6701 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6702 alc880_gpio1_init_verbs },
6703 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6704 .dac_nids = alc882_dac_nids,
6705 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6706 .channel_mode = alc880_threestack_modes,
6708 .input_mux = &alc882_capture_source,
6709 .dig_out_nid = ALC882_DIGOUT_NID,
6712 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6713 .init_verbs = { alc885_mbp3_init_verbs,
6714 alc880_gpio1_init_verbs },
6715 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6716 .dac_nids = alc882_dac_nids,
6717 .channel_mode = alc885_mbp_6ch_modes,
6718 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6719 .input_mux = &alc882_capture_source,
6720 .dig_out_nid = ALC882_DIGOUT_NID,
6721 .dig_in_nid = ALC882_DIGIN_NID,
6722 .unsol_event = alc885_mbp3_unsol_event,
6723 .init_hook = alc885_mbp3_automute,
6726 .mixers = { alc882_macpro_mixer },
6727 .init_verbs = { alc882_macpro_init_verbs },
6728 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6729 .dac_nids = alc882_dac_nids,
6730 .dig_out_nid = ALC882_DIGOUT_NID,
6731 .dig_in_nid = ALC882_DIGIN_NID,
6732 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6733 .channel_mode = alc882_ch_modes,
6734 .input_mux = &alc882_capture_source,
6735 .init_hook = alc885_macpro_init_hook,
6738 .mixers = { alc885_imac24_mixer },
6739 .init_verbs = { alc885_imac24_init_verbs },
6740 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6741 .dac_nids = alc882_dac_nids,
6742 .dig_out_nid = ALC882_DIGOUT_NID,
6743 .dig_in_nid = ALC882_DIGIN_NID,
6744 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6745 .channel_mode = alc882_ch_modes,
6746 .input_mux = &alc882_capture_source,
6747 .unsol_event = alc885_imac24_unsol_event,
6748 .init_hook = alc885_imac24_init_hook,
6751 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6752 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6753 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6754 .dac_nids = alc882_dac_nids,
6755 .dig_out_nid = ALC882_DIGOUT_NID,
6756 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6757 .adc_nids = alc882_adc_nids,
6758 .capsrc_nids = alc882_capsrc_nids,
6759 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6760 .channel_mode = alc882_3ST_6ch_modes,
6762 .input_mux = &alc882_capture_source,
6763 .unsol_event = alc882_targa_unsol_event,
6764 .init_hook = alc882_targa_automute,
6766 [ALC882_ASUS_A7J] = {
6767 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6768 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6769 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6770 .dac_nids = alc882_dac_nids,
6771 .dig_out_nid = ALC882_DIGOUT_NID,
6772 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6773 .adc_nids = alc882_adc_nids,
6774 .capsrc_nids = alc882_capsrc_nids,
6775 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6776 .channel_mode = alc882_3ST_6ch_modes,
6778 .input_mux = &alc882_capture_source,
6780 [ALC882_ASUS_A7M] = {
6781 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6782 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6783 alc880_gpio1_init_verbs,
6784 alc882_asus_a7m_verbs },
6785 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6786 .dac_nids = alc882_dac_nids,
6787 .dig_out_nid = ALC882_DIGOUT_NID,
6788 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6789 .channel_mode = alc880_threestack_modes,
6791 .input_mux = &alc882_capture_source,
6800 PINFIX_ABIT_AW9D_MAX
6803 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6804 { 0x15, 0x01080104 }, /* side */
6805 { 0x16, 0x01011012 }, /* rear */
6806 { 0x17, 0x01016011 }, /* clfe */
6810 static const struct alc_pincfg *alc882_pin_fixes[] = {
6811 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6814 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6815 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6820 * BIOS auto configuration
6822 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6823 hda_nid_t nid, int pin_type,
6827 struct alc_spec *spec = codec->spec;
6830 alc_set_pin_output(codec, nid, pin_type);
6831 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6834 idx = spec->multiout.dac_nids[dac_idx] - 2;
6835 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6839 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6841 struct alc_spec *spec = codec->spec;
6844 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6845 for (i = 0; i <= HDA_SIDE; i++) {
6846 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6847 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6849 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6854 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6856 struct alc_spec *spec = codec->spec;
6859 pin = spec->autocfg.hp_pins[0];
6860 if (pin) /* connect to front */
6862 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6863 pin = spec->autocfg.speaker_pins[0];
6865 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6868 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6869 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6871 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6873 struct alc_spec *spec = codec->spec;
6876 for (i = 0; i < AUTO_PIN_LAST; i++) {
6877 hda_nid_t nid = spec->autocfg.input_pins[i];
6882 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6883 unsigned int pincap;
6884 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6885 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6889 snd_hda_codec_write(codec, nid, 0,
6890 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6891 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6892 snd_hda_codec_write(codec, nid, 0,
6893 AC_VERB_SET_AMP_GAIN_MUTE,
6898 static void alc882_auto_init_input_src(struct hda_codec *codec)
6900 struct alc_spec *spec = codec->spec;
6901 const struct hda_input_mux *imux = spec->input_mux;
6904 for (c = 0; c < spec->num_adc_nids; c++) {
6905 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6906 hda_nid_t nid = spec->capsrc_nids[c];
6907 int conns, mute, idx, item;
6909 conns = snd_hda_get_connections(codec, nid, conn_list,
6910 ARRAY_SIZE(conn_list));
6913 for (idx = 0; idx < conns; idx++) {
6914 /* if the current connection is the selected one,
6915 * unmute it as default - otherwise mute it
6917 mute = AMP_IN_MUTE(idx);
6918 for (item = 0; item < imux->num_items; item++) {
6919 if (imux->items[item].index == idx) {
6920 if (spec->cur_mux[c] == item)
6921 mute = AMP_IN_UNMUTE(idx);
6925 snd_hda_codec_write(codec, nid, 0,
6926 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6931 /* add mic boosts if needed */
6932 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6934 struct alc_spec *spec = codec->spec;
6938 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6939 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6940 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6942 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6946 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6947 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6948 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6950 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6957 /* almost identical with ALC880 parser... */
6958 static int alc882_parse_auto_config(struct hda_codec *codec)
6960 struct alc_spec *spec = codec->spec;
6961 int err = alc880_parse_auto_config(codec);
6966 return 0; /* no config found */
6968 err = alc_auto_add_mic_boost(codec);
6972 /* hack - override the init verbs */
6973 spec->init_verbs[0] = alc882_auto_init_verbs;
6975 return 1; /* config found */
6978 /* additional initialization for auto-configuration model */
6979 static void alc882_auto_init(struct hda_codec *codec)
6981 struct alc_spec *spec = codec->spec;
6982 alc882_auto_init_multi_out(codec);
6983 alc882_auto_init_hp_out(codec);
6984 alc882_auto_init_analog_input(codec);
6985 alc882_auto_init_input_src(codec);
6986 if (spec->unsol_event)
6987 alc_inithook(codec);
6990 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6992 static int patch_alc882(struct hda_codec *codec)
6994 struct alc_spec *spec;
6995 int err, board_config;
6997 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7003 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7007 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7008 /* Pick up systems that don't supply PCI SSID */
7009 switch (codec->subsystem_id) {
7010 case 0x106b0c00: /* Mac Pro */
7011 board_config = ALC885_MACPRO;
7013 case 0x106b1000: /* iMac 24 */
7014 case 0x106b2800: /* AppleTV */
7015 board_config = ALC885_IMAC24;
7017 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7018 case 0x106b00a4: /* MacbookPro4,1 */
7019 case 0x106b2c00: /* Macbook Pro rev3 */
7020 case 0x106b3600: /* Macbook 3.1 */
7021 board_config = ALC885_MBP3;
7024 /* ALC889A is handled better as ALC888-compatible */
7025 if (codec->revision_id == 0x100101 ||
7026 codec->revision_id == 0x100103) {
7028 return patch_alc883(codec);
7030 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7031 "trying auto-probe from BIOS...\n");
7032 board_config = ALC882_AUTO;
7036 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7038 if (board_config == ALC882_AUTO) {
7039 /* automatic parse from the BIOS config */
7040 err = alc882_parse_auto_config(codec);
7046 "hda_codec: Cannot set up configuration "
7047 "from BIOS. Using base mode...\n");
7048 board_config = ALC882_3ST_DIG;
7052 if (board_config != ALC882_AUTO)
7053 setup_preset(spec, &alc882_presets[board_config]);
7055 if (codec->vendor_id == 0x10ec0885) {
7056 spec->stream_name_analog = "ALC885 Analog";
7057 spec->stream_name_digital = "ALC885 Digital";
7059 spec->stream_name_analog = "ALC882 Analog";
7060 spec->stream_name_digital = "ALC882 Digital";
7063 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7064 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7065 /* FIXME: setup DAC5 */
7066 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7067 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7069 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7070 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7072 spec->is_mix_capture = 1; /* matrix-style capture */
7073 if (!spec->adc_nids && spec->input_mux) {
7074 /* check whether NID 0x07 is valid */
7075 unsigned int wcap = get_wcaps(codec, 0x07);
7077 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7078 if (wcap != AC_WID_AUD_IN) {
7079 spec->adc_nids = alc882_adc_nids_alt;
7080 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7081 spec->capsrc_nids = alc882_capsrc_nids_alt;
7083 spec->adc_nids = alc882_adc_nids;
7084 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7085 spec->capsrc_nids = alc882_capsrc_nids;
7088 set_capture_mixer(spec);
7090 spec->vmaster_nid = 0x0c;
7092 codec->patch_ops = alc_patch_ops;
7093 if (board_config == ALC882_AUTO)
7094 spec->init_hook = alc882_auto_init;
7095 #ifdef CONFIG_SND_HDA_POWER_SAVE
7096 if (!spec->loopback.amplist)
7097 spec->loopback.amplist = alc882_loopbacks;
7099 codec->proc_widget_hook = print_realtek_coef;
7107 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7108 * configuration. Each pin widget can choose any input DACs and a mixer.
7109 * Each ADC is connected from a mixer of all inputs. This makes possible
7110 * 6-channel independent captures.
7112 * In addition, an independent DAC for the multi-playback (not used in this
7115 #define ALC883_DIGOUT_NID 0x06
7116 #define ALC883_DIGIN_NID 0x0a
7118 #define ALC1200_DIGOUT_NID 0x10
7120 static hda_nid_t alc883_dac_nids[4] = {
7121 /* front, rear, clfe, rear_surr */
7122 0x02, 0x03, 0x04, 0x05
7125 static hda_nid_t alc883_adc_nids[2] = {
7130 static hda_nid_t alc883_adc_nids_alt[1] = {
7135 static hda_nid_t alc883_adc_nids_rev[2] = {
7140 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7142 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7145 /* FIXME: should be a matrix-type input source selection */
7147 static struct hda_input_mux alc883_capture_source = {
7151 { "Front Mic", 0x1 },
7157 static struct hda_input_mux alc883_3stack_6ch_intel = {
7161 { "Front Mic", 0x0 },
7167 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7175 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7185 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7193 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7197 { "Front Mic", 0x1 },
7202 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7213 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7220 static struct hda_verb alc883_3ST_ch2_init[] = {
7221 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7222 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7223 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7224 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7231 static struct hda_verb alc883_3ST_ch4_init[] = {
7232 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7233 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7234 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7235 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7236 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7243 static struct hda_verb alc883_3ST_ch6_init[] = {
7244 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7245 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7246 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7247 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7248 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7249 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7253 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7254 { 2, alc883_3ST_ch2_init },
7255 { 4, alc883_3ST_ch4_init },
7256 { 6, alc883_3ST_ch6_init },
7262 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7263 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7264 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7265 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7266 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7273 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7274 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7275 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7276 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7277 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7278 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7285 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7286 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7287 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7288 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7289 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7290 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7291 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7295 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7296 { 2, alc883_3ST_ch2_intel_init },
7297 { 4, alc883_3ST_ch4_intel_init },
7298 { 6, alc883_3ST_ch6_intel_init },
7304 static struct hda_verb alc883_sixstack_ch6_init[] = {
7305 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7306 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7307 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7308 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7315 static struct hda_verb alc883_sixstack_ch8_init[] = {
7316 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7317 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7318 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7319 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7323 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7324 { 6, alc883_sixstack_ch6_init },
7325 { 8, alc883_sixstack_ch8_init },
7328 static struct hda_verb alc883_medion_eapd_verbs[] = {
7329 /* eanable EAPD on medion laptop */
7330 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7331 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7335 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7336 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7339 static struct snd_kcontrol_new alc883_base_mixer[] = {
7340 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7341 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7342 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7343 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7344 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7345 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7346 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7347 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7348 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7349 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7351 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7352 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7353 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7354 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7356 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7358 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7359 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7360 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7361 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7362 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7366 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7367 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7368 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7369 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7370 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7371 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7372 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7375 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7376 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7377 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7378 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7379 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7383 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7384 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7385 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7386 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7387 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7388 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7389 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7391 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7392 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7393 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7397 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7398 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7399 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7400 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7401 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7402 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7403 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7404 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7405 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7406 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7407 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7411 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7413 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7414 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7415 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7416 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7417 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7418 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7424 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7425 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7426 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7430 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7431 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7432 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7434 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7435 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7436 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7437 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7438 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7440 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7441 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7442 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7443 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7444 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7445 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7446 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7449 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7450 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7451 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7455 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7456 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7457 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7458 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7459 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7460 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7462 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7463 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7464 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7467 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7471 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7473 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7475 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7476 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7477 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7481 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7482 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7483 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7484 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7485 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7486 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7487 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7488 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7489 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7490 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7491 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7492 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7494 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7496 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7497 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7498 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7499 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7500 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7501 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7502 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7506 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7507 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7509 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7510 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7511 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7512 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7513 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7514 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7515 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7516 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7517 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7518 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7519 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7521 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7522 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7526 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7527 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7529 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7530 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7531 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7533 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7535 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7537 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7541 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7542 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7543 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7545 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7548 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7549 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7553 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7554 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7555 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7556 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7557 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7558 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7560 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7561 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7562 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7566 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7567 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7568 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7569 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7570 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7571 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7574 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7575 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7579 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7580 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7581 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7582 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7583 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7584 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7586 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7587 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7591 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7592 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7593 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7594 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7595 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7596 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7597 0x0d, 1, 0x0, HDA_OUTPUT),
7598 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7599 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7600 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7601 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7602 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7603 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7604 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7605 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7606 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7607 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7608 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7609 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7610 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7611 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7612 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7613 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7614 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7618 static struct hda_bind_ctls alc883_bind_cap_vol = {
7619 .ops = &snd_hda_bind_vol,
7621 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7622 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7627 static struct hda_bind_ctls alc883_bind_cap_switch = {
7628 .ops = &snd_hda_bind_sw,
7630 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7631 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7636 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7637 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7638 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7640 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7648 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7649 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7650 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7652 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7653 /* .name = "Capture Source", */
7654 .name = "Input Source",
7656 .info = alc_mux_enum_info,
7657 .get = alc_mux_enum_get,
7658 .put = alc_mux_enum_put,
7663 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7665 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7666 .name = "Channel Mode",
7667 .info = alc_ch_mode_info,
7668 .get = alc_ch_mode_get,
7669 .put = alc_ch_mode_put,
7674 static struct hda_verb alc883_init_verbs[] = {
7675 /* ADC1: mute amp left and right */
7676 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7677 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7678 /* ADC2: mute amp left and right */
7679 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7680 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7681 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7682 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7683 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7686 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7687 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7688 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7690 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7691 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7692 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7694 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7695 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7696 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7698 /* mute analog input loopbacks */
7699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7705 /* Front Pin: output 0 (0x0c) */
7706 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7707 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7708 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7709 /* Rear Pin: output 1 (0x0d) */
7710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7711 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7712 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7713 /* CLFE Pin: output 2 (0x0e) */
7714 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7715 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7716 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7717 /* Side Pin: output 3 (0x0f) */
7718 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7719 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7720 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7721 /* Mic (rear) pin: input vref at 80% */
7722 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7723 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7724 /* Front Mic pin: input vref at 80% */
7725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7726 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7727 /* Line In pin: input */
7728 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7729 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7730 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7731 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7732 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7733 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7734 /* CD pin widget for input */
7735 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7737 /* FIXME: use matrix-type input source selection */
7738 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7740 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7741 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7742 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7745 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7747 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7752 /* toggle speaker-output according to the hp-jack state */
7753 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7755 unsigned int present;
7757 present = snd_hda_codec_read(codec, 0x15, 0,
7758 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7759 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7760 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7761 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7762 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7765 /* auto-toggle front mic */
7767 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7769 unsigned int present;
7772 present = snd_hda_codec_read(codec, 0x18, 0,
7773 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7774 bits = present ? HDA_AMP_MUTE : 0;
7775 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7779 static void alc883_mitac_automute(struct hda_codec *codec)
7781 alc883_mitac_hp_automute(codec);
7782 /* alc883_mitac_mic_automute(codec); */
7785 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7788 switch (res >> 26) {
7789 case ALC880_HP_EVENT:
7790 alc883_mitac_hp_automute(codec);
7792 case ALC880_MIC_EVENT:
7793 /* alc883_mitac_mic_automute(codec); */
7798 static struct hda_verb alc883_mitac_verbs[] = {
7800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7803 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7804 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7806 /* enable unsolicited event */
7807 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7808 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7813 static struct hda_verb alc883_clevo_m720_verbs[] = {
7815 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7818 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7819 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7821 /* enable unsolicited event */
7822 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7823 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7828 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7830 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7833 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7836 /* enable unsolicited event */
7837 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7842 static struct hda_verb alc883_tagra_verbs[] = {
7843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7847 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7849 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7850 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7851 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7853 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7854 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7855 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7856 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7861 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7862 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7863 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7864 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7868 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7869 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7871 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7872 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7876 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7877 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7878 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7879 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7880 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7881 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7885 static struct hda_verb alc883_haier_w66_verbs[] = {
7886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7889 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7891 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7892 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7893 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7894 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7898 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7899 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7901 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7902 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7903 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7904 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7905 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7906 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7910 static struct hda_verb alc888_3st_hp_verbs[] = {
7911 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7912 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7913 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7917 static struct hda_verb alc888_6st_dell_verbs[] = {
7918 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7922 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7923 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7924 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7925 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7926 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7930 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7931 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7932 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7933 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7934 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7938 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7939 { 2, alc888_3st_hp_2ch_init },
7940 { 6, alc888_3st_hp_6ch_init },
7943 /* toggle front-jack and RCA according to the hp-jack state */
7944 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7946 unsigned int present;
7948 present = snd_hda_codec_read(codec, 0x1b, 0,
7949 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7950 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7951 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7952 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7953 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7956 /* toggle RCA according to the front-jack state */
7957 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7959 unsigned int present;
7961 present = snd_hda_codec_read(codec, 0x14, 0,
7962 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7963 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7964 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7967 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7970 if ((res >> 26) == ALC880_HP_EVENT)
7971 alc888_lenovo_ms7195_front_automute(codec);
7972 if ((res >> 26) == ALC880_FRONT_EVENT)
7973 alc888_lenovo_ms7195_rca_automute(codec);
7976 static struct hda_verb alc883_medion_md2_verbs[] = {
7977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7982 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7986 /* toggle speaker-output according to the hp-jack state */
7987 static void alc883_medion_md2_automute(struct hda_codec *codec)
7989 unsigned int present;
7991 present = snd_hda_codec_read(codec, 0x14, 0,
7992 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7993 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7994 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7997 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8000 if ((res >> 26) == ALC880_HP_EVENT)
8001 alc883_medion_md2_automute(codec);
8004 /* toggle speaker-output according to the hp-jack state */
8005 static void alc883_tagra_automute(struct hda_codec *codec)
8007 unsigned int present;
8010 present = snd_hda_codec_read(codec, 0x14, 0,
8011 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8012 bits = present ? HDA_AMP_MUTE : 0;
8013 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8014 HDA_AMP_MUTE, bits);
8015 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8019 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8021 if ((res >> 26) == ALC880_HP_EVENT)
8022 alc883_tagra_automute(codec);
8025 /* toggle speaker-output according to the hp-jack state */
8026 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8028 unsigned int present;
8031 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8032 & AC_PINSENSE_PRESENCE;
8033 bits = present ? HDA_AMP_MUTE : 0;
8034 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8035 HDA_AMP_MUTE, bits);
8038 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8040 unsigned int present;
8042 present = snd_hda_codec_read(codec, 0x18, 0,
8043 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8044 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8045 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8048 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8050 alc883_clevo_m720_hp_automute(codec);
8051 alc883_clevo_m720_mic_automute(codec);
8054 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8057 switch (res >> 26) {
8058 case ALC880_HP_EVENT:
8059 alc883_clevo_m720_hp_automute(codec);
8061 case ALC880_MIC_EVENT:
8062 alc883_clevo_m720_mic_automute(codec);
8067 /* toggle speaker-output according to the hp-jack state */
8068 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8070 unsigned int present;
8073 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8074 & AC_PINSENSE_PRESENCE;
8075 bits = present ? HDA_AMP_MUTE : 0;
8076 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8077 HDA_AMP_MUTE, bits);
8080 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8083 if ((res >> 26) == ALC880_HP_EVENT)
8084 alc883_2ch_fujitsu_pi2515_automute(codec);
8087 static void alc883_haier_w66_automute(struct hda_codec *codec)
8089 unsigned int present;
8092 present = snd_hda_codec_read(codec, 0x1b, 0,
8093 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8094 bits = present ? 0x80 : 0;
8095 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8099 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8102 if ((res >> 26) == ALC880_HP_EVENT)
8103 alc883_haier_w66_automute(codec);
8106 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8108 unsigned int present;
8111 present = snd_hda_codec_read(codec, 0x14, 0,
8112 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8113 bits = present ? HDA_AMP_MUTE : 0;
8114 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8115 HDA_AMP_MUTE, bits);
8118 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8120 unsigned int present;
8123 present = snd_hda_codec_read(codec, 0x1b, 0,
8124 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8125 bits = present ? HDA_AMP_MUTE : 0;
8126 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8127 HDA_AMP_MUTE, bits);
8128 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8129 HDA_AMP_MUTE, bits);
8132 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8135 if ((res >> 26) == ALC880_HP_EVENT)
8136 alc883_lenovo_101e_all_automute(codec);
8137 if ((res >> 26) == ALC880_FRONT_EVENT)
8138 alc883_lenovo_101e_ispeaker_automute(codec);
8141 /* toggle speaker-output according to the hp-jack state */
8142 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8144 unsigned int present;
8146 present = snd_hda_codec_read(codec, 0x14, 0,
8147 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8148 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8149 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8150 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8151 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8154 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8157 if ((res >> 26) == ALC880_HP_EVENT)
8158 alc883_acer_aspire_automute(codec);
8161 static struct hda_verb alc883_acer_eapd_verbs[] = {
8162 /* HP Pin: output 0 (0x0c) */
8163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8164 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8165 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8166 /* Front Pin: output 0 (0x0c) */
8167 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8170 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8171 /* eanable EAPD on medion laptop */
8172 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8173 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8174 /* enable unsolicited event */
8175 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8179 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8181 unsigned int present;
8183 present = snd_hda_codec_read(codec, 0x1b, 0,
8184 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8185 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8186 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8187 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8188 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8189 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8190 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8191 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8192 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8195 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8198 switch (res >> 26) {
8199 case ALC880_HP_EVENT:
8200 printk("hp_event\n");
8201 alc888_6st_dell_front_automute(codec);
8206 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8209 unsigned int present;
8211 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8212 present = snd_hda_codec_read(codec, 0x1b, 0,
8213 AC_VERB_GET_PIN_SENSE, 0);
8214 present = (present & 0x80000000) != 0;
8216 /* mute internal speaker */
8217 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8218 HDA_AMP_MUTE, HDA_AMP_MUTE);
8219 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8220 HDA_AMP_MUTE, HDA_AMP_MUTE);
8221 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8222 HDA_AMP_MUTE, HDA_AMP_MUTE);
8223 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8224 HDA_AMP_MUTE, HDA_AMP_MUTE);
8225 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8226 HDA_AMP_MUTE, HDA_AMP_MUTE);
8228 /* unmute internal speaker if necessary */
8229 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8230 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8231 HDA_AMP_MUTE, mute);
8232 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8233 HDA_AMP_MUTE, mute);
8234 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8235 HDA_AMP_MUTE, mute);
8236 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8237 HDA_AMP_MUTE, mute);
8238 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8239 HDA_AMP_MUTE, mute);
8243 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8246 if ((res >> 26) == ALC880_HP_EVENT)
8247 alc888_lenovo_sky_front_automute(codec);
8251 * generic initialization of ADC, input mixers and output mixers
8253 static struct hda_verb alc883_auto_init_verbs[] = {
8255 * Unmute ADC0-2 and set the default input to mic-in
8257 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8258 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8259 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8260 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8262 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8264 * Note: PASD motherboards uses the Line In 2 as the input for
8265 * front panel mic (mic 2)
8267 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8275 * Set up output mixers (0x0c - 0x0f)
8277 /* set vol=0 to output mixers */
8278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8279 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8280 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8281 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8282 /* set up input amps for analog loopback */
8283 /* Amp Indices: DAC = 0, mixer = 1 */
8284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8285 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8286 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8291 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8292 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8293 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8295 /* FIXME: use matrix-type input source selection */
8296 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8301 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8307 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8313 static struct hda_verb alc888_asus_m90v_verbs[] = {
8314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8315 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8317 /* enable unsolicited event */
8318 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8319 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8323 static void alc883_nb_mic_automute(struct hda_codec *codec)
8325 unsigned int present;
8327 present = snd_hda_codec_read(codec, 0x18, 0,
8328 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8329 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8330 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8331 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8332 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8335 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8337 unsigned int present;
8340 present = snd_hda_codec_read(codec, 0x1b, 0,
8341 AC_VERB_GET_PIN_SENSE, 0)
8342 & AC_PINSENSE_PRESENCE;
8343 bits = present ? 0 : PIN_OUT;
8344 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8346 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8348 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8352 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8355 switch (res >> 26) {
8356 case ALC880_HP_EVENT:
8357 alc883_M90V_speaker_automute(codec);
8359 case ALC880_MIC_EVENT:
8360 alc883_nb_mic_automute(codec);
8365 static void alc883_mode2_inithook(struct hda_codec *codec)
8367 alc883_M90V_speaker_automute(codec);
8368 alc883_nb_mic_automute(codec);
8371 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8373 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8377 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8378 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8379 /* enable unsolicited event */
8380 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8384 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8386 unsigned int present;
8389 present = snd_hda_codec_read(codec, 0x14, 0,
8390 AC_VERB_GET_PIN_SENSE, 0)
8391 & AC_PINSENSE_PRESENCE;
8392 bits = present ? 0 : PIN_OUT;
8393 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8397 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8400 switch (res >> 26) {
8401 case ALC880_HP_EVENT:
8402 alc883_eee1601_speaker_automute(codec);
8407 static void alc883_eee1601_inithook(struct hda_codec *codec)
8409 alc883_eee1601_speaker_automute(codec);
8412 #ifdef CONFIG_SND_HDA_POWER_SAVE
8413 #define alc883_loopbacks alc880_loopbacks
8416 /* pcm configuration: identiacal with ALC880 */
8417 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8418 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8419 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8420 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8421 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8424 * configuration and preset
8426 static const char *alc883_models[ALC883_MODEL_LAST] = {
8427 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8428 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8429 [ALC883_3ST_6ch] = "3stack-6ch",
8430 [ALC883_6ST_DIG] = "6stack-dig",
8431 [ALC883_TARGA_DIG] = "targa-dig",
8432 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8433 [ALC883_ACER] = "acer",
8434 [ALC883_ACER_ASPIRE] = "acer-aspire",
8435 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8436 [ALC883_MEDION] = "medion",
8437 [ALC883_MEDION_MD2] = "medion-md2",
8438 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8439 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8440 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8441 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8442 [ALC888_LENOVO_SKY] = "lenovo-sky",
8443 [ALC883_HAIER_W66] = "haier-w66",
8444 [ALC888_3ST_HP] = "3stack-hp",
8445 [ALC888_6ST_DELL] = "6stack-dell",
8446 [ALC883_MITAC] = "mitac",
8447 [ALC883_CLEVO_M720] = "clevo-m720",
8448 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8449 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8450 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8451 [ALC1200_ASUS_P5Q] = "asus-p5q",
8452 [ALC883_AUTO] = "auto",
8455 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8456 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8457 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8458 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8459 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8460 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8461 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8462 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8463 ALC888_ACER_ASPIRE_4930G),
8464 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8465 ALC888_ACER_ASPIRE_4930G),
8466 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8467 ALC888_ACER_ASPIRE_4930G),
8468 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8469 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8470 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8471 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8472 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8473 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8474 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8475 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8476 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8477 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8478 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8479 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8480 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8481 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8482 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8483 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8484 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8485 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8486 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8487 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8488 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8489 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8490 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8491 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8492 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8493 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8494 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8495 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8496 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8497 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8498 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8499 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8500 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8501 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8502 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8503 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8504 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8505 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8506 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8507 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8508 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8509 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8510 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8511 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8512 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8513 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8514 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8515 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8516 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8517 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8518 ALC888_FUJITSU_XA3530),
8519 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8520 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8521 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8522 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8523 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8524 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8525 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8526 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8527 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8528 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8529 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8530 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8531 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8532 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8536 static struct alc_config_preset alc883_presets[] = {
8537 [ALC883_3ST_2ch_DIG] = {
8538 .mixers = { alc883_3ST_2ch_mixer },
8539 .init_verbs = { alc883_init_verbs },
8540 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8541 .dac_nids = alc883_dac_nids,
8542 .dig_out_nid = ALC883_DIGOUT_NID,
8543 .dig_in_nid = ALC883_DIGIN_NID,
8544 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8545 .channel_mode = alc883_3ST_2ch_modes,
8546 .input_mux = &alc883_capture_source,
8548 [ALC883_3ST_6ch_DIG] = {
8549 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8550 .init_verbs = { alc883_init_verbs },
8551 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8552 .dac_nids = alc883_dac_nids,
8553 .dig_out_nid = ALC883_DIGOUT_NID,
8554 .dig_in_nid = ALC883_DIGIN_NID,
8555 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8556 .channel_mode = alc883_3ST_6ch_modes,
8558 .input_mux = &alc883_capture_source,
8560 [ALC883_3ST_6ch] = {
8561 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8562 .init_verbs = { alc883_init_verbs },
8563 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8564 .dac_nids = alc883_dac_nids,
8565 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8566 .channel_mode = alc883_3ST_6ch_modes,
8568 .input_mux = &alc883_capture_source,
8570 [ALC883_3ST_6ch_INTEL] = {
8571 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8572 .init_verbs = { alc883_init_verbs },
8573 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8574 .dac_nids = alc883_dac_nids,
8575 .dig_out_nid = ALC883_DIGOUT_NID,
8576 .dig_in_nid = ALC883_DIGIN_NID,
8577 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8578 .channel_mode = alc883_3ST_6ch_intel_modes,
8580 .input_mux = &alc883_3stack_6ch_intel,
8582 [ALC883_6ST_DIG] = {
8583 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8584 .init_verbs = { alc883_init_verbs },
8585 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8586 .dac_nids = alc883_dac_nids,
8587 .dig_out_nid = ALC883_DIGOUT_NID,
8588 .dig_in_nid = ALC883_DIGIN_NID,
8589 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8590 .channel_mode = alc883_sixstack_modes,
8591 .input_mux = &alc883_capture_source,
8593 [ALC883_TARGA_DIG] = {
8594 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8595 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8596 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8597 .dac_nids = alc883_dac_nids,
8598 .dig_out_nid = ALC883_DIGOUT_NID,
8599 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8600 .channel_mode = alc883_3ST_6ch_modes,
8602 .input_mux = &alc883_capture_source,
8603 .unsol_event = alc883_tagra_unsol_event,
8604 .init_hook = alc883_tagra_automute,
8606 [ALC883_TARGA_2ch_DIG] = {
8607 .mixers = { alc883_tagra_2ch_mixer},
8608 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8609 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8610 .dac_nids = alc883_dac_nids,
8611 .adc_nids = alc883_adc_nids_alt,
8612 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8613 .dig_out_nid = ALC883_DIGOUT_NID,
8614 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8615 .channel_mode = alc883_3ST_2ch_modes,
8616 .input_mux = &alc883_capture_source,
8617 .unsol_event = alc883_tagra_unsol_event,
8618 .init_hook = alc883_tagra_automute,
8621 .mixers = { alc883_base_mixer },
8622 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8623 * and the headphone jack. Turn this on and rely on the
8624 * standard mute methods whenever the user wants to turn
8625 * these outputs off.
8627 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8628 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8629 .dac_nids = alc883_dac_nids,
8630 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8631 .channel_mode = alc883_3ST_2ch_modes,
8632 .input_mux = &alc883_capture_source,
8634 [ALC883_ACER_ASPIRE] = {
8635 .mixers = { alc883_acer_aspire_mixer },
8636 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8637 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8638 .dac_nids = alc883_dac_nids,
8639 .dig_out_nid = ALC883_DIGOUT_NID,
8640 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8641 .channel_mode = alc883_3ST_2ch_modes,
8642 .input_mux = &alc883_capture_source,
8643 .unsol_event = alc883_acer_aspire_unsol_event,
8644 .init_hook = alc883_acer_aspire_automute,
8646 [ALC888_ACER_ASPIRE_4930G] = {
8647 .mixers = { alc888_base_mixer,
8648 alc883_chmode_mixer },
8649 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8650 alc888_acer_aspire_4930g_verbs },
8651 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8652 .dac_nids = alc883_dac_nids,
8653 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8654 .adc_nids = alc883_adc_nids_rev,
8655 .capsrc_nids = alc883_capsrc_nids_rev,
8656 .dig_out_nid = ALC883_DIGOUT_NID,
8657 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8658 .channel_mode = alc883_3ST_6ch_modes,
8661 ARRAY_SIZE(alc888_2_capture_sources),
8662 .input_mux = alc888_2_capture_sources,
8663 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8664 .init_hook = alc888_acer_aspire_4930g_automute,
8667 .mixers = { alc883_fivestack_mixer,
8668 alc883_chmode_mixer },
8669 .init_verbs = { alc883_init_verbs,
8670 alc883_medion_eapd_verbs },
8671 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8672 .dac_nids = alc883_dac_nids,
8673 .adc_nids = alc883_adc_nids_alt,
8674 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8675 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8676 .channel_mode = alc883_sixstack_modes,
8677 .input_mux = &alc883_capture_source,
8679 [ALC883_MEDION_MD2] = {
8680 .mixers = { alc883_medion_md2_mixer},
8681 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8682 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8683 .dac_nids = alc883_dac_nids,
8684 .dig_out_nid = ALC883_DIGOUT_NID,
8685 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8686 .channel_mode = alc883_3ST_2ch_modes,
8687 .input_mux = &alc883_capture_source,
8688 .unsol_event = alc883_medion_md2_unsol_event,
8689 .init_hook = alc883_medion_md2_automute,
8691 [ALC883_LAPTOP_EAPD] = {
8692 .mixers = { alc883_base_mixer },
8693 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8694 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8695 .dac_nids = alc883_dac_nids,
8696 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8697 .channel_mode = alc883_3ST_2ch_modes,
8698 .input_mux = &alc883_capture_source,
8700 [ALC883_CLEVO_M720] = {
8701 .mixers = { alc883_clevo_m720_mixer },
8702 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8703 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8704 .dac_nids = alc883_dac_nids,
8705 .dig_out_nid = ALC883_DIGOUT_NID,
8706 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8707 .channel_mode = alc883_3ST_2ch_modes,
8708 .input_mux = &alc883_capture_source,
8709 .unsol_event = alc883_clevo_m720_unsol_event,
8710 .init_hook = alc883_clevo_m720_automute,
8712 [ALC883_LENOVO_101E_2ch] = {
8713 .mixers = { alc883_lenovo_101e_2ch_mixer},
8714 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8715 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8716 .dac_nids = alc883_dac_nids,
8717 .adc_nids = alc883_adc_nids_alt,
8718 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8719 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8720 .channel_mode = alc883_3ST_2ch_modes,
8721 .input_mux = &alc883_lenovo_101e_capture_source,
8722 .unsol_event = alc883_lenovo_101e_unsol_event,
8723 .init_hook = alc883_lenovo_101e_all_automute,
8725 [ALC883_LENOVO_NB0763] = {
8726 .mixers = { alc883_lenovo_nb0763_mixer },
8727 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8728 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8729 .dac_nids = alc883_dac_nids,
8730 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8731 .channel_mode = alc883_3ST_2ch_modes,
8733 .input_mux = &alc883_lenovo_nb0763_capture_source,
8734 .unsol_event = alc883_medion_md2_unsol_event,
8735 .init_hook = alc883_medion_md2_automute,
8737 [ALC888_LENOVO_MS7195_DIG] = {
8738 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8739 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8740 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8741 .dac_nids = alc883_dac_nids,
8742 .dig_out_nid = ALC883_DIGOUT_NID,
8743 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8744 .channel_mode = alc883_3ST_6ch_modes,
8746 .input_mux = &alc883_capture_source,
8747 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8748 .init_hook = alc888_lenovo_ms7195_front_automute,
8750 [ALC883_HAIER_W66] = {
8751 .mixers = { alc883_tagra_2ch_mixer},
8752 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8753 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8754 .dac_nids = alc883_dac_nids,
8755 .dig_out_nid = ALC883_DIGOUT_NID,
8756 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8757 .channel_mode = alc883_3ST_2ch_modes,
8758 .input_mux = &alc883_capture_source,
8759 .unsol_event = alc883_haier_w66_unsol_event,
8760 .init_hook = alc883_haier_w66_automute,
8763 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8764 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8765 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8766 .dac_nids = alc883_dac_nids,
8767 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8768 .channel_mode = alc888_3st_hp_modes,
8770 .input_mux = &alc883_capture_source,
8772 [ALC888_6ST_DELL] = {
8773 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8774 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8775 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8776 .dac_nids = alc883_dac_nids,
8777 .dig_out_nid = ALC883_DIGOUT_NID,
8778 .dig_in_nid = ALC883_DIGIN_NID,
8779 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8780 .channel_mode = alc883_sixstack_modes,
8781 .input_mux = &alc883_capture_source,
8782 .unsol_event = alc888_6st_dell_unsol_event,
8783 .init_hook = alc888_6st_dell_front_automute,
8786 .mixers = { alc883_mitac_mixer },
8787 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8788 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8789 .dac_nids = alc883_dac_nids,
8790 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8791 .channel_mode = alc883_3ST_2ch_modes,
8792 .input_mux = &alc883_capture_source,
8793 .unsol_event = alc883_mitac_unsol_event,
8794 .init_hook = alc883_mitac_automute,
8796 [ALC883_FUJITSU_PI2515] = {
8797 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8798 .init_verbs = { alc883_init_verbs,
8799 alc883_2ch_fujitsu_pi2515_verbs},
8800 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8801 .dac_nids = alc883_dac_nids,
8802 .dig_out_nid = ALC883_DIGOUT_NID,
8803 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8804 .channel_mode = alc883_3ST_2ch_modes,
8805 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8806 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8807 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8809 [ALC888_FUJITSU_XA3530] = {
8810 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8811 .init_verbs = { alc883_init_verbs,
8812 alc888_fujitsu_xa3530_verbs },
8813 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8814 .dac_nids = alc883_dac_nids,
8815 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8816 .adc_nids = alc883_adc_nids_rev,
8817 .capsrc_nids = alc883_capsrc_nids_rev,
8818 .dig_out_nid = ALC883_DIGOUT_NID,
8819 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8820 .channel_mode = alc888_4ST_8ch_intel_modes,
8822 ARRAY_SIZE(alc888_2_capture_sources),
8823 .input_mux = alc888_2_capture_sources,
8824 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8825 .init_hook = alc888_fujitsu_xa3530_automute,
8827 [ALC888_LENOVO_SKY] = {
8828 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8829 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8830 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8831 .dac_nids = alc883_dac_nids,
8832 .dig_out_nid = ALC883_DIGOUT_NID,
8833 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8834 .channel_mode = alc883_sixstack_modes,
8836 .input_mux = &alc883_lenovo_sky_capture_source,
8837 .unsol_event = alc883_lenovo_sky_unsol_event,
8838 .init_hook = alc888_lenovo_sky_front_automute,
8840 [ALC888_ASUS_M90V] = {
8841 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8842 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8843 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8844 .dac_nids = alc883_dac_nids,
8845 .dig_out_nid = ALC883_DIGOUT_NID,
8846 .dig_in_nid = ALC883_DIGIN_NID,
8847 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8848 .channel_mode = alc883_3ST_6ch_modes,
8850 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8851 .unsol_event = alc883_mode2_unsol_event,
8852 .init_hook = alc883_mode2_inithook,
8854 [ALC888_ASUS_EEE1601] = {
8855 .mixers = { alc883_asus_eee1601_mixer },
8856 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8857 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8858 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8859 .dac_nids = alc883_dac_nids,
8860 .dig_out_nid = ALC883_DIGOUT_NID,
8861 .dig_in_nid = ALC883_DIGIN_NID,
8862 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8863 .channel_mode = alc883_3ST_2ch_modes,
8865 .input_mux = &alc883_asus_eee1601_capture_source,
8866 .unsol_event = alc883_eee1601_unsol_event,
8867 .init_hook = alc883_eee1601_inithook,
8869 [ALC1200_ASUS_P5Q] = {
8870 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8871 .init_verbs = { alc883_init_verbs },
8872 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8873 .dac_nids = alc883_dac_nids,
8874 .dig_out_nid = ALC1200_DIGOUT_NID,
8875 .dig_in_nid = ALC883_DIGIN_NID,
8876 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8877 .channel_mode = alc883_sixstack_modes,
8878 .input_mux = &alc883_capture_source,
8884 * BIOS auto configuration
8886 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8887 hda_nid_t nid, int pin_type,
8891 struct alc_spec *spec = codec->spec;
8894 alc_set_pin_output(codec, nid, pin_type);
8895 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8898 idx = spec->multiout.dac_nids[dac_idx] - 2;
8899 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8903 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8905 struct alc_spec *spec = codec->spec;
8908 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8909 for (i = 0; i <= HDA_SIDE; i++) {
8910 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8911 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8913 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8918 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8920 struct alc_spec *spec = codec->spec;
8923 pin = spec->autocfg.hp_pins[0];
8924 if (pin) /* connect to front */
8926 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8927 pin = spec->autocfg.speaker_pins[0];
8929 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8932 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8933 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8935 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8937 struct alc_spec *spec = codec->spec;
8940 for (i = 0; i < AUTO_PIN_LAST; i++) {
8941 hda_nid_t nid = spec->autocfg.input_pins[i];
8942 if (alc883_is_input_pin(nid)) {
8943 snd_hda_codec_write(codec, nid, 0,
8944 AC_VERB_SET_PIN_WIDGET_CONTROL,
8945 (i <= AUTO_PIN_FRONT_MIC ?
8946 PIN_VREF80 : PIN_IN));
8947 if (nid != ALC883_PIN_CD_NID)
8948 snd_hda_codec_write(codec, nid, 0,
8949 AC_VERB_SET_AMP_GAIN_MUTE,
8955 #define alc883_auto_init_input_src alc882_auto_init_input_src
8957 /* almost identical with ALC880 parser... */
8958 static int alc883_parse_auto_config(struct hda_codec *codec)
8960 struct alc_spec *spec = codec->spec;
8961 int err = alc880_parse_auto_config(codec);
8966 return 0; /* no config found */
8968 err = alc_auto_add_mic_boost(codec);
8972 /* hack - override the init verbs */
8973 spec->init_verbs[0] = alc883_auto_init_verbs;
8975 return 1; /* config found */
8978 /* additional initialization for auto-configuration model */
8979 static void alc883_auto_init(struct hda_codec *codec)
8981 struct alc_spec *spec = codec->spec;
8982 alc883_auto_init_multi_out(codec);
8983 alc883_auto_init_hp_out(codec);
8984 alc883_auto_init_analog_input(codec);
8985 alc883_auto_init_input_src(codec);
8986 if (spec->unsol_event)
8987 alc_inithook(codec);
8990 static int patch_alc883(struct hda_codec *codec)
8992 struct alc_spec *spec;
8993 int err, board_config;
8995 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9001 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9003 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9006 if (board_config < 0) {
9007 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9008 "trying auto-probe from BIOS...\n");
9009 board_config = ALC883_AUTO;
9012 if (board_config == ALC883_AUTO) {
9013 /* automatic parse from the BIOS config */
9014 err = alc883_parse_auto_config(codec);
9020 "hda_codec: Cannot set up configuration "
9021 "from BIOS. Using base mode...\n");
9022 board_config = ALC883_3ST_2ch_DIG;
9026 if (board_config != ALC883_AUTO)
9027 setup_preset(spec, &alc883_presets[board_config]);
9029 switch (codec->vendor_id) {
9031 if (codec->revision_id == 0x100101) {
9032 spec->stream_name_analog = "ALC1200 Analog";
9033 spec->stream_name_digital = "ALC1200 Digital";
9035 spec->stream_name_analog = "ALC888 Analog";
9036 spec->stream_name_digital = "ALC888 Digital";
9040 spec->stream_name_analog = "ALC889 Analog";
9041 spec->stream_name_digital = "ALC889 Digital";
9044 spec->stream_name_analog = "ALC883 Analog";
9045 spec->stream_name_digital = "ALC883 Digital";
9049 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9050 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9051 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9053 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9054 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9056 if (!spec->num_adc_nids) {
9057 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9058 spec->adc_nids = alc883_adc_nids;
9060 if (!spec->capsrc_nids)
9061 spec->capsrc_nids = alc883_capsrc_nids;
9062 spec->is_mix_capture = 1; /* matrix-style capture */
9063 if (!spec->cap_mixer)
9064 set_capture_mixer(spec);
9066 spec->vmaster_nid = 0x0c;
9068 codec->patch_ops = alc_patch_ops;
9069 if (board_config == ALC883_AUTO)
9070 spec->init_hook = alc883_auto_init;
9072 #ifdef CONFIG_SND_HDA_POWER_SAVE
9073 if (!spec->loopback.amplist)
9074 spec->loopback.amplist = alc883_loopbacks;
9076 codec->proc_widget_hook = print_realtek_coef;
9085 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9086 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9088 #define alc262_dac_nids alc260_dac_nids
9089 #define alc262_adc_nids alc882_adc_nids
9090 #define alc262_adc_nids_alt alc882_adc_nids_alt
9091 #define alc262_capsrc_nids alc882_capsrc_nids
9092 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9094 #define alc262_modes alc260_modes
9095 #define alc262_capture_source alc882_capture_source
9097 static hda_nid_t alc262_dmic_adc_nids[1] = {
9102 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9104 static struct snd_kcontrol_new alc262_base_mixer[] = {
9105 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9106 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9107 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9108 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9109 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9110 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9113 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9114 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9116 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9117 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9118 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9119 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9120 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9121 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9122 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9126 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9128 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9136 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9137 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9138 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9139 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9140 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9141 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9142 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9146 /* update HP, line and mono-out pins according to the master switch */
9147 static void alc262_hp_master_update(struct hda_codec *codec)
9149 struct alc_spec *spec = codec->spec;
9150 int val = spec->master_sw;
9153 snd_hda_codec_write_cache(codec, 0x1b, 0,
9154 AC_VERB_SET_PIN_WIDGET_CONTROL,
9156 snd_hda_codec_write_cache(codec, 0x15, 0,
9157 AC_VERB_SET_PIN_WIDGET_CONTROL,
9159 /* mono (speaker) depending on the HP jack sense */
9160 val = val && !spec->jack_present;
9161 snd_hda_codec_write_cache(codec, 0x16, 0,
9162 AC_VERB_SET_PIN_WIDGET_CONTROL,
9166 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9168 struct alc_spec *spec = codec->spec;
9169 unsigned int presence;
9170 presence = snd_hda_codec_read(codec, 0x1b, 0,
9171 AC_VERB_GET_PIN_SENSE, 0);
9172 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9173 alc262_hp_master_update(codec);
9176 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9178 if ((res >> 26) != ALC880_HP_EVENT)
9180 alc262_hp_bpc_automute(codec);
9183 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9185 struct alc_spec *spec = codec->spec;
9186 unsigned int presence;
9187 presence = snd_hda_codec_read(codec, 0x15, 0,
9188 AC_VERB_GET_PIN_SENSE, 0);
9189 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9190 alc262_hp_master_update(codec);
9193 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9196 if ((res >> 26) != ALC880_HP_EVENT)
9198 alc262_hp_wildwest_automute(codec);
9201 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9202 struct snd_ctl_elem_value *ucontrol)
9204 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9205 struct alc_spec *spec = codec->spec;
9206 *ucontrol->value.integer.value = spec->master_sw;
9210 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9211 struct snd_ctl_elem_value *ucontrol)
9213 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9214 struct alc_spec *spec = codec->spec;
9215 int val = !!*ucontrol->value.integer.value;
9217 if (val == spec->master_sw)
9219 spec->master_sw = val;
9220 alc262_hp_master_update(codec);
9224 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9226 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9227 .name = "Master Playback Switch",
9228 .info = snd_ctl_boolean_mono_info,
9229 .get = alc262_hp_master_sw_get,
9230 .put = alc262_hp_master_sw_put,
9232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9233 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9234 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9235 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9237 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9239 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9240 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9241 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9242 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9243 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9244 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9245 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9246 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9249 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9250 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9251 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9252 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9256 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9258 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9259 .name = "Master Playback Switch",
9260 .info = snd_ctl_boolean_mono_info,
9261 .get = alc262_hp_master_sw_get,
9262 .put = alc262_hp_master_sw_put,
9264 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9265 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9266 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9268 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9270 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9272 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9273 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9274 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9275 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9276 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9279 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9280 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9284 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9285 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9286 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9287 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9291 /* mute/unmute internal speaker according to the hp jack and mute state */
9292 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9294 struct alc_spec *spec = codec->spec;
9296 if (force || !spec->sense_updated) {
9297 unsigned int present;
9298 present = snd_hda_codec_read(codec, 0x15, 0,
9299 AC_VERB_GET_PIN_SENSE, 0);
9300 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9301 spec->sense_updated = 1;
9303 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9304 spec->jack_present ? HDA_AMP_MUTE : 0);
9307 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9310 if ((res >> 26) != ALC880_HP_EVENT)
9312 alc262_hp_t5735_automute(codec, 1);
9315 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9317 alc262_hp_t5735_automute(codec, 1);
9320 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9321 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9322 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9323 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9324 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9326 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9327 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9331 static struct hda_verb alc262_hp_t5735_verbs[] = {
9332 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9333 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9335 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9339 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9340 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9342 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9343 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9344 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9345 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9349 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9350 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9351 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9352 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9353 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9355 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9357 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9363 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9370 /* bind hp and internal speaker mute (with plug check) */
9371 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9372 struct snd_ctl_elem_value *ucontrol)
9374 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9375 long *valp = ucontrol->value.integer.value;
9378 /* change hp mute */
9379 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9381 valp[0] ? 0 : HDA_AMP_MUTE);
9382 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9384 valp[1] ? 0 : HDA_AMP_MUTE);
9386 /* change speaker according to HP jack state */
9387 struct alc_spec *spec = codec->spec;
9389 if (spec->jack_present)
9390 mute = HDA_AMP_MUTE;
9392 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9394 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9395 HDA_AMP_MUTE, mute);
9400 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9401 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9403 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9404 .name = "Master Playback Switch",
9405 .info = snd_hda_mixer_amp_switch_info,
9406 .get = snd_hda_mixer_amp_switch_get,
9407 .put = alc262_sony_master_sw_put,
9408 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9410 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9411 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9412 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9413 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9417 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9418 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9419 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9420 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9423 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9424 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9428 #define alc262_capture_mixer alc882_capture_mixer
9429 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9432 * generic initialization of ADC, input mixers and output mixers
9434 static struct hda_verb alc262_init_verbs[] = {
9436 * Unmute ADC0-2 and set the default input to mic-in
9438 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9440 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9442 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9443 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9445 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9447 * Note: PASD motherboards uses the Line In 2 as the input for
9448 * front panel mic (mic 2)
9450 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9458 * Set up output mixers (0x0c - 0x0e)
9460 /* set vol=0 to output mixers */
9461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9463 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9464 /* set up input amps for analog loopback */
9465 /* Amp Indices: DAC = 0, mixer = 1 */
9466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9475 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9476 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9478 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9481 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9482 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9484 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9486 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9489 /* FIXME: use matrix-type input source selection */
9490 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9491 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9495 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9497 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9499 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9500 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9510 static struct hda_verb alc262_eapd_verbs[] = {
9511 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9512 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9516 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9517 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9518 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9522 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9523 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9524 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9525 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9527 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9528 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9532 static struct hda_verb alc262_sony_unsol_verbs[] = {
9533 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9534 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9535 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9537 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9542 static struct hda_input_mux alc262_dmic_capture_source = {
9545 { "Int DMic", 0x9 },
9550 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9551 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9552 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9553 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9555 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9559 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9560 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9561 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9562 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9563 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9564 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9565 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9566 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9567 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9571 static void alc262_dmic_automute(struct hda_codec *codec)
9573 unsigned int present;
9575 present = snd_hda_codec_read(codec, 0x18, 0,
9576 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9577 snd_hda_codec_write(codec, 0x22, 0,
9578 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9581 /* toggle speaker-output according to the hp-jack state */
9582 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9584 unsigned int present;
9587 present = snd_hda_codec_read(codec, 0x15, 0,
9588 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9589 bits = present ? 0 : PIN_OUT;
9590 snd_hda_codec_write(codec, 0x14, 0,
9591 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9596 /* unsolicited event for HP jack sensing */
9597 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9600 if ((res >> 26) == ALC880_HP_EVENT)
9601 alc262_toshiba_s06_speaker_automute(codec);
9602 if ((res >> 26) == ALC880_MIC_EVENT)
9603 alc262_dmic_automute(codec);
9607 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9609 alc262_toshiba_s06_speaker_automute(codec);
9610 alc262_dmic_automute(codec);
9613 /* mute/unmute internal speaker according to the hp jack and mute state */
9614 static void alc262_hippo_automute(struct hda_codec *codec)
9616 struct alc_spec *spec = codec->spec;
9618 unsigned int present;
9620 /* need to execute and sync at first */
9621 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9622 present = snd_hda_codec_read(codec, 0x15, 0,
9623 AC_VERB_GET_PIN_SENSE, 0);
9624 spec->jack_present = (present & 0x80000000) != 0;
9625 if (spec->jack_present) {
9626 /* mute internal speaker */
9627 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9628 HDA_AMP_MUTE, HDA_AMP_MUTE);
9630 /* unmute internal speaker if necessary */
9631 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9632 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9633 HDA_AMP_MUTE, mute);
9637 /* unsolicited event for HP jack sensing */
9638 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9641 if ((res >> 26) != ALC880_HP_EVENT)
9643 alc262_hippo_automute(codec);
9646 static void alc262_hippo1_automute(struct hda_codec *codec)
9649 unsigned int present;
9651 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9652 present = snd_hda_codec_read(codec, 0x1b, 0,
9653 AC_VERB_GET_PIN_SENSE, 0);
9654 present = (present & 0x80000000) != 0;
9656 /* mute internal speaker */
9657 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9658 HDA_AMP_MUTE, HDA_AMP_MUTE);
9660 /* unmute internal speaker if necessary */
9661 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9662 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9663 HDA_AMP_MUTE, mute);
9667 /* unsolicited event for HP jack sensing */
9668 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9671 if ((res >> 26) != ALC880_HP_EVENT)
9673 alc262_hippo1_automute(codec);
9679 * 0x16 = internal speaker
9680 * 0x18 = external mic
9683 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9684 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9685 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9689 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9691 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9692 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9696 static struct hda_verb alc262_nec_verbs[] = {
9697 /* Unmute Speaker */
9698 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9701 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9702 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9704 /* External mic to headphone */
9705 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9706 /* External mic to speaker */
9707 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9713 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9714 * 0x1b = port replicator headphone out
9717 #define ALC_HP_EVENT 0x37
9719 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9720 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9721 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9722 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9723 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9727 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9728 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9733 static struct hda_input_mux alc262_fujitsu_capture_source = {
9742 static struct hda_input_mux alc262_HP_capture_source = {
9746 { "Front Mic", 0x1 },
9753 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9757 { "Front Mic", 0x2 },
9763 /* mute/unmute internal speaker according to the hp jacks and mute state */
9764 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9766 struct alc_spec *spec = codec->spec;
9769 if (force || !spec->sense_updated) {
9770 unsigned int present;
9771 /* need to execute and sync at first */
9772 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9773 /* check laptop HP jack */
9774 present = snd_hda_codec_read(codec, 0x14, 0,
9775 AC_VERB_GET_PIN_SENSE, 0);
9776 /* need to execute and sync at first */
9777 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9778 /* check docking HP jack */
9779 present |= snd_hda_codec_read(codec, 0x1b, 0,
9780 AC_VERB_GET_PIN_SENSE, 0);
9781 if (present & AC_PINSENSE_PRESENCE)
9782 spec->jack_present = 1;
9784 spec->jack_present = 0;
9785 spec->sense_updated = 1;
9787 /* unmute internal speaker only if both HPs are unplugged and
9788 * master switch is on
9790 if (spec->jack_present)
9791 mute = HDA_AMP_MUTE;
9793 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9794 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9795 HDA_AMP_MUTE, mute);
9798 /* unsolicited event for HP jack sensing */
9799 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9802 if ((res >> 26) != ALC_HP_EVENT)
9804 alc262_fujitsu_automute(codec, 1);
9807 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9809 alc262_fujitsu_automute(codec, 1);
9812 /* bind volumes of both NID 0x0c and 0x0d */
9813 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9814 .ops = &snd_hda_bind_vol,
9816 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9817 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9822 /* mute/unmute internal speaker according to the hp jack and mute state */
9823 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9825 struct alc_spec *spec = codec->spec;
9828 if (force || !spec->sense_updated) {
9829 unsigned int present_int_hp;
9830 /* need to execute and sync at first */
9831 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9832 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9833 AC_VERB_GET_PIN_SENSE, 0);
9834 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9835 spec->sense_updated = 1;
9837 if (spec->jack_present) {
9838 /* mute internal speaker */
9839 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9840 HDA_AMP_MUTE, HDA_AMP_MUTE);
9841 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9842 HDA_AMP_MUTE, HDA_AMP_MUTE);
9844 /* unmute internal speaker if necessary */
9845 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9846 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9847 HDA_AMP_MUTE, mute);
9848 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9849 HDA_AMP_MUTE, mute);
9853 /* unsolicited event for HP jack sensing */
9854 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9857 if ((res >> 26) != ALC_HP_EVENT)
9859 alc262_lenovo_3000_automute(codec, 1);
9862 /* bind hp and internal speaker mute (with plug check) */
9863 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9864 struct snd_ctl_elem_value *ucontrol)
9866 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9867 long *valp = ucontrol->value.integer.value;
9870 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9872 valp ? 0 : HDA_AMP_MUTE);
9873 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9875 valp ? 0 : HDA_AMP_MUTE);
9878 alc262_fujitsu_automute(codec, 0);
9882 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9883 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9885 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9886 .name = "Master Playback Switch",
9887 .info = snd_hda_mixer_amp_switch_info,
9888 .get = snd_hda_mixer_amp_switch_get,
9889 .put = alc262_fujitsu_master_sw_put,
9890 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9894 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9895 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9896 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9899 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9900 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9901 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9905 /* bind hp and internal speaker mute (with plug check) */
9906 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9907 struct snd_ctl_elem_value *ucontrol)
9909 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9910 long *valp = ucontrol->value.integer.value;
9913 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9915 valp ? 0 : HDA_AMP_MUTE);
9918 alc262_lenovo_3000_automute(codec, 0);
9922 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9923 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9925 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9926 .name = "Master Playback Switch",
9927 .info = snd_hda_mixer_amp_switch_info,
9928 .get = snd_hda_mixer_amp_switch_get,
9929 .put = alc262_lenovo_3000_master_sw_put,
9930 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9934 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9937 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9938 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9939 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9943 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9944 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9946 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9947 .name = "Master Playback Switch",
9948 .info = snd_hda_mixer_amp_switch_info,
9949 .get = snd_hda_mixer_amp_switch_get,
9950 .put = alc262_sony_master_sw_put,
9951 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9955 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9956 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9957 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9958 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9962 /* additional init verbs for Benq laptops */
9963 static struct hda_verb alc262_EAPD_verbs[] = {
9964 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9965 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9969 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9970 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9971 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9973 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9974 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9978 /* Samsung Q1 Ultra Vista model setup */
9979 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9980 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9981 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9984 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9985 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9989 static struct hda_verb alc262_ultra_verbs[] = {
9991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9992 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9993 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9996 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9997 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9998 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10000 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10001 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10003 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10004 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10006 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10007 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10008 /* ADC, choose mic */
10009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10010 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10011 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10013 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10014 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10015 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10016 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10022 /* mute/unmute internal speaker according to the hp jack and mute state */
10023 static void alc262_ultra_automute(struct hda_codec *codec)
10025 struct alc_spec *spec = codec->spec;
10029 /* auto-mute only when HP is used as HP */
10030 if (!spec->cur_mux[0]) {
10031 unsigned int present;
10032 /* need to execute and sync at first */
10033 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10034 present = snd_hda_codec_read(codec, 0x15, 0,
10035 AC_VERB_GET_PIN_SENSE, 0);
10036 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10037 if (spec->jack_present)
10038 mute = HDA_AMP_MUTE;
10040 /* mute/unmute internal speaker */
10041 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10042 HDA_AMP_MUTE, mute);
10043 /* mute/unmute HP */
10044 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10045 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10048 /* unsolicited event for HP jack sensing */
10049 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10052 if ((res >> 26) != ALC880_HP_EVENT)
10054 alc262_ultra_automute(codec);
10057 static struct hda_input_mux alc262_ultra_capture_source = {
10061 { "Headphone", 0x7 },
10065 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10066 struct snd_ctl_elem_value *ucontrol)
10068 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10069 struct alc_spec *spec = codec->spec;
10072 ret = alc_mux_enum_put(kcontrol, ucontrol);
10075 /* reprogram the HP pin as mic or HP according to the input source */
10076 snd_hda_codec_write_cache(codec, 0x15, 0,
10077 AC_VERB_SET_PIN_WIDGET_CONTROL,
10078 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10079 alc262_ultra_automute(codec); /* mute/unmute HP */
10083 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10084 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10085 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10087 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10088 .name = "Capture Source",
10089 .info = alc_mux_enum_info,
10090 .get = alc_mux_enum_get,
10091 .put = alc262_ultra_mux_enum_put,
10096 /* add playback controls from the parsed DAC table */
10097 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10098 const struct auto_pin_cfg *cfg)
10103 spec->multiout.num_dacs = 1; /* only use one dac */
10104 spec->multiout.dac_nids = spec->private_dac_nids;
10105 spec->multiout.dac_nids[0] = 2;
10107 nid = cfg->line_out_pins[0];
10109 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10110 "Front Playback Volume",
10111 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10114 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10115 "Front Playback Switch",
10116 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10121 nid = cfg->speaker_pins[0];
10124 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10125 "Speaker Playback Volume",
10126 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10130 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10131 "Speaker Playback Switch",
10132 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10137 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10138 "Speaker Playback Switch",
10139 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10145 nid = cfg->hp_pins[0];
10147 /* spec->multiout.hp_nid = 2; */
10149 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10150 "Headphone Playback Volume",
10151 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10155 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10156 "Headphone Playback Switch",
10157 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10162 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10163 "Headphone Playback Switch",
10164 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10173 /* identical with ALC880 */
10174 #define alc262_auto_create_analog_input_ctls \
10175 alc880_auto_create_analog_input_ctls
10178 * generic initialization of ADC, input mixers and output mixers
10180 static struct hda_verb alc262_volume_init_verbs[] = {
10182 * Unmute ADC0-2 and set the default input to mic-in
10184 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10186 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10187 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10188 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10189 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10191 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10193 * Note: PASD motherboards uses the Line In 2 as the input for
10194 * front panel mic (mic 2)
10196 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10197 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10198 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10199 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10200 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10204 * Set up output mixers (0x0c - 0x0f)
10206 /* set vol=0 to output mixers */
10207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10208 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10209 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10211 /* set up input amps for analog loopback */
10212 /* Amp Indices: DAC = 0, mixer = 1 */
10213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10215 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10216 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10217 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10218 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10220 /* FIXME: use matrix-type input source selection */
10221 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10222 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10223 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10224 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10225 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10226 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10228 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10229 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10230 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10231 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10233 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10241 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10243 * Unmute ADC0-2 and set the default input to mic-in
10245 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10247 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10248 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10249 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10252 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10254 * Note: PASD motherboards uses the Line In 2 as the input for
10255 * front panel mic (mic 2)
10257 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10258 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10264 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10267 * Set up output mixers (0x0c - 0x0e)
10269 /* set vol=0 to output mixers */
10270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10271 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10272 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10274 /* set up input amps for analog loopback */
10275 /* Amp Indices: DAC = 0, mixer = 1 */
10276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10278 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10279 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10280 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10281 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10283 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10284 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10285 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10287 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10290 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10291 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10293 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10294 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10295 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10296 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10297 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10299 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10300 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10301 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10302 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10303 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10304 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10307 /* FIXME: use matrix-type input source selection */
10308 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10309 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10310 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10311 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10315 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10325 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10330 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10332 * Unmute ADC0-2 and set the default input to mic-in
10334 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10336 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10337 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10338 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10341 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10343 * Note: PASD motherboards uses the Line In 2 as the input for front
10344 * panel mic (mic 2)
10346 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10347 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10348 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10349 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10351 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10352 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10356 * Set up output mixers (0x0c - 0x0e)
10358 /* set vol=0 to output mixers */
10359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10361 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10363 /* set up input amps for analog loopback */
10364 /* Amp Indices: DAC = 0, mixer = 1 */
10365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10374 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10375 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10376 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10377 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10378 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10379 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10381 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10382 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10384 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10385 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10387 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10388 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10389 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10390 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10391 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10392 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10394 /* FIXME: use matrix-type input source selection */
10395 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10396 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10402 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10410 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10418 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10421 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10426 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10429 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10430 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10432 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10434 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10435 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10438 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10439 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10444 #ifdef CONFIG_SND_HDA_POWER_SAVE
10445 #define alc262_loopbacks alc880_loopbacks
10448 /* pcm configuration: identiacal with ALC880 */
10449 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10450 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10451 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10452 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10455 * BIOS auto configuration
10457 static int alc262_parse_auto_config(struct hda_codec *codec)
10459 struct alc_spec *spec = codec->spec;
10461 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10463 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10467 if (!spec->autocfg.line_outs)
10468 return 0; /* can't find valid BIOS pin config */
10469 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10472 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10476 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10478 if (spec->autocfg.dig_out_pin)
10479 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10480 if (spec->autocfg.dig_in_pin)
10481 spec->dig_in_nid = ALC262_DIGIN_NID;
10483 if (spec->kctls.list)
10484 add_mixer(spec, spec->kctls.list);
10486 add_verb(spec, alc262_volume_init_verbs);
10487 spec->num_mux_defs = 1;
10488 spec->input_mux = &spec->private_imux;
10490 err = alc_auto_add_mic_boost(codec);
10494 store_pin_configs(codec);
10498 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10499 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10500 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10501 #define alc262_auto_init_input_src alc882_auto_init_input_src
10504 /* init callback for auto-configuration model -- overriding the default init */
10505 static void alc262_auto_init(struct hda_codec *codec)
10507 struct alc_spec *spec = codec->spec;
10508 alc262_auto_init_multi_out(codec);
10509 alc262_auto_init_hp_out(codec);
10510 alc262_auto_init_analog_input(codec);
10511 alc262_auto_init_input_src(codec);
10512 if (spec->unsol_event)
10513 alc_inithook(codec);
10517 * configuration and preset
10519 static const char *alc262_models[ALC262_MODEL_LAST] = {
10520 [ALC262_BASIC] = "basic",
10521 [ALC262_HIPPO] = "hippo",
10522 [ALC262_HIPPO_1] = "hippo_1",
10523 [ALC262_FUJITSU] = "fujitsu",
10524 [ALC262_HP_BPC] = "hp-bpc",
10525 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10526 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10527 [ALC262_HP_RP5700] = "hp-rp5700",
10528 [ALC262_BENQ_ED8] = "benq",
10529 [ALC262_BENQ_T31] = "benq-t31",
10530 [ALC262_SONY_ASSAMD] = "sony-assamd",
10531 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10532 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10533 [ALC262_ULTRA] = "ultra",
10534 [ALC262_LENOVO_3000] = "lenovo-3000",
10535 [ALC262_NEC] = "nec",
10536 [ALC262_AUTO] = "auto",
10539 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10540 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10541 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10542 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10543 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10544 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10545 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10546 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10547 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10548 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10549 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10550 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10551 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10552 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10553 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10554 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10555 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10556 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10557 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10558 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10559 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10560 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10561 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10562 ALC262_HP_TC_T5735),
10563 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10564 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10565 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10566 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10567 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10568 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10569 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10570 ALC262_SONY_ASSAMD),
10571 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10572 ALC262_TOSHIBA_RX1),
10573 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10574 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10575 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10576 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10577 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10578 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10579 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10580 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10581 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10582 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10586 static struct alc_config_preset alc262_presets[] = {
10588 .mixers = { alc262_base_mixer },
10589 .init_verbs = { alc262_init_verbs },
10590 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10591 .dac_nids = alc262_dac_nids,
10593 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10594 .channel_mode = alc262_modes,
10595 .input_mux = &alc262_capture_source,
10598 .mixers = { alc262_base_mixer },
10599 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10600 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10601 .dac_nids = alc262_dac_nids,
10603 .dig_out_nid = ALC262_DIGOUT_NID,
10604 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10605 .channel_mode = alc262_modes,
10606 .input_mux = &alc262_capture_source,
10607 .unsol_event = alc262_hippo_unsol_event,
10608 .init_hook = alc262_hippo_automute,
10610 [ALC262_HIPPO_1] = {
10611 .mixers = { alc262_hippo1_mixer },
10612 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10613 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10614 .dac_nids = alc262_dac_nids,
10616 .dig_out_nid = ALC262_DIGOUT_NID,
10617 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10618 .channel_mode = alc262_modes,
10619 .input_mux = &alc262_capture_source,
10620 .unsol_event = alc262_hippo1_unsol_event,
10621 .init_hook = alc262_hippo1_automute,
10623 [ALC262_FUJITSU] = {
10624 .mixers = { alc262_fujitsu_mixer },
10625 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10626 alc262_fujitsu_unsol_verbs },
10627 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10628 .dac_nids = alc262_dac_nids,
10630 .dig_out_nid = ALC262_DIGOUT_NID,
10631 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10632 .channel_mode = alc262_modes,
10633 .input_mux = &alc262_fujitsu_capture_source,
10634 .unsol_event = alc262_fujitsu_unsol_event,
10635 .init_hook = alc262_fujitsu_init_hook,
10637 [ALC262_HP_BPC] = {
10638 .mixers = { alc262_HP_BPC_mixer },
10639 .init_verbs = { alc262_HP_BPC_init_verbs },
10640 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10641 .dac_nids = alc262_dac_nids,
10643 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10644 .channel_mode = alc262_modes,
10645 .input_mux = &alc262_HP_capture_source,
10646 .unsol_event = alc262_hp_bpc_unsol_event,
10647 .init_hook = alc262_hp_bpc_automute,
10649 [ALC262_HP_BPC_D7000_WF] = {
10650 .mixers = { alc262_HP_BPC_WildWest_mixer },
10651 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10652 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10653 .dac_nids = alc262_dac_nids,
10655 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10656 .channel_mode = alc262_modes,
10657 .input_mux = &alc262_HP_D7000_capture_source,
10658 .unsol_event = alc262_hp_wildwest_unsol_event,
10659 .init_hook = alc262_hp_wildwest_automute,
10661 [ALC262_HP_BPC_D7000_WL] = {
10662 .mixers = { alc262_HP_BPC_WildWest_mixer,
10663 alc262_HP_BPC_WildWest_option_mixer },
10664 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10665 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10666 .dac_nids = alc262_dac_nids,
10668 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10669 .channel_mode = alc262_modes,
10670 .input_mux = &alc262_HP_D7000_capture_source,
10671 .unsol_event = alc262_hp_wildwest_unsol_event,
10672 .init_hook = alc262_hp_wildwest_automute,
10674 [ALC262_HP_TC_T5735] = {
10675 .mixers = { alc262_hp_t5735_mixer },
10676 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10677 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10678 .dac_nids = alc262_dac_nids,
10680 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10681 .channel_mode = alc262_modes,
10682 .input_mux = &alc262_capture_source,
10683 .unsol_event = alc262_hp_t5735_unsol_event,
10684 .init_hook = alc262_hp_t5735_init_hook,
10686 [ALC262_HP_RP5700] = {
10687 .mixers = { alc262_hp_rp5700_mixer },
10688 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10689 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10690 .dac_nids = alc262_dac_nids,
10691 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10692 .channel_mode = alc262_modes,
10693 .input_mux = &alc262_hp_rp5700_capture_source,
10695 [ALC262_BENQ_ED8] = {
10696 .mixers = { alc262_base_mixer },
10697 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10698 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10699 .dac_nids = alc262_dac_nids,
10701 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10702 .channel_mode = alc262_modes,
10703 .input_mux = &alc262_capture_source,
10705 [ALC262_SONY_ASSAMD] = {
10706 .mixers = { alc262_sony_mixer },
10707 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10708 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10709 .dac_nids = alc262_dac_nids,
10711 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10712 .channel_mode = alc262_modes,
10713 .input_mux = &alc262_capture_source,
10714 .unsol_event = alc262_hippo_unsol_event,
10715 .init_hook = alc262_hippo_automute,
10717 [ALC262_BENQ_T31] = {
10718 .mixers = { alc262_benq_t31_mixer },
10719 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10720 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10721 .dac_nids = alc262_dac_nids,
10723 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10724 .channel_mode = alc262_modes,
10725 .input_mux = &alc262_capture_source,
10726 .unsol_event = alc262_hippo_unsol_event,
10727 .init_hook = alc262_hippo_automute,
10730 .mixers = { alc262_ultra_mixer },
10731 .cap_mixer = alc262_ultra_capture_mixer,
10732 .init_verbs = { alc262_ultra_verbs },
10733 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10734 .dac_nids = alc262_dac_nids,
10735 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10736 .channel_mode = alc262_modes,
10737 .input_mux = &alc262_ultra_capture_source,
10738 .adc_nids = alc262_adc_nids, /* ADC0 */
10739 .capsrc_nids = alc262_capsrc_nids,
10740 .num_adc_nids = 1, /* single ADC */
10741 .unsol_event = alc262_ultra_unsol_event,
10742 .init_hook = alc262_ultra_automute,
10744 [ALC262_LENOVO_3000] = {
10745 .mixers = { alc262_lenovo_3000_mixer },
10746 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10747 alc262_lenovo_3000_unsol_verbs },
10748 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10749 .dac_nids = alc262_dac_nids,
10751 .dig_out_nid = ALC262_DIGOUT_NID,
10752 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10753 .channel_mode = alc262_modes,
10754 .input_mux = &alc262_fujitsu_capture_source,
10755 .unsol_event = alc262_lenovo_3000_unsol_event,
10758 .mixers = { alc262_nec_mixer },
10759 .init_verbs = { alc262_nec_verbs },
10760 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10761 .dac_nids = alc262_dac_nids,
10763 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10764 .channel_mode = alc262_modes,
10765 .input_mux = &alc262_capture_source,
10767 [ALC262_TOSHIBA_S06] = {
10768 .mixers = { alc262_toshiba_s06_mixer },
10769 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10770 alc262_eapd_verbs },
10771 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10772 .capsrc_nids = alc262_dmic_capsrc_nids,
10773 .dac_nids = alc262_dac_nids,
10774 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10775 .dig_out_nid = ALC262_DIGOUT_NID,
10776 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10777 .channel_mode = alc262_modes,
10778 .input_mux = &alc262_dmic_capture_source,
10779 .unsol_event = alc262_toshiba_s06_unsol_event,
10780 .init_hook = alc262_toshiba_s06_init_hook,
10782 [ALC262_TOSHIBA_RX1] = {
10783 .mixers = { alc262_toshiba_rx1_mixer },
10784 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10785 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10786 .dac_nids = alc262_dac_nids,
10788 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10789 .channel_mode = alc262_modes,
10790 .input_mux = &alc262_capture_source,
10791 .unsol_event = alc262_hippo_unsol_event,
10792 .init_hook = alc262_hippo_automute,
10796 static int patch_alc262(struct hda_codec *codec)
10798 struct alc_spec *spec;
10802 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10806 codec->spec = spec;
10808 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10813 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10814 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10815 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10816 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10820 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10822 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10826 if (board_config < 0) {
10827 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10828 "trying auto-probe from BIOS...\n");
10829 board_config = ALC262_AUTO;
10832 if (board_config == ALC262_AUTO) {
10833 /* automatic parse from the BIOS config */
10834 err = alc262_parse_auto_config(codec);
10840 "hda_codec: Cannot set up configuration "
10841 "from BIOS. Using base mode...\n");
10842 board_config = ALC262_BASIC;
10846 if (board_config != ALC262_AUTO)
10847 setup_preset(spec, &alc262_presets[board_config]);
10849 spec->stream_name_analog = "ALC262 Analog";
10850 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10851 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10853 spec->stream_name_digital = "ALC262 Digital";
10854 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10855 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10857 spec->is_mix_capture = 1;
10858 if (!spec->adc_nids && spec->input_mux) {
10859 /* check whether NID 0x07 is valid */
10860 unsigned int wcap = get_wcaps(codec, 0x07);
10863 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10864 if (wcap != AC_WID_AUD_IN) {
10865 spec->adc_nids = alc262_adc_nids_alt;
10866 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10867 spec->capsrc_nids = alc262_capsrc_nids_alt;
10869 spec->adc_nids = alc262_adc_nids;
10870 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10871 spec->capsrc_nids = alc262_capsrc_nids;
10874 if (!spec->cap_mixer)
10875 set_capture_mixer(spec);
10877 spec->vmaster_nid = 0x0c;
10879 codec->patch_ops = alc_patch_ops;
10880 if (board_config == ALC262_AUTO)
10881 spec->init_hook = alc262_auto_init;
10882 #ifdef CONFIG_SND_HDA_POWER_SAVE
10883 if (!spec->loopback.amplist)
10884 spec->loopback.amplist = alc262_loopbacks;
10886 codec->proc_widget_hook = print_realtek_coef;
10892 * ALC268 channel source setting (2 channel)
10894 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10895 #define alc268_modes alc260_modes
10897 static hda_nid_t alc268_dac_nids[2] = {
10902 static hda_nid_t alc268_adc_nids[2] = {
10907 static hda_nid_t alc268_adc_nids_alt[1] = {
10912 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10914 static struct snd_kcontrol_new alc268_base_mixer[] = {
10915 /* output mixer control */
10916 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10917 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10918 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10919 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10920 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10921 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10922 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10926 /* bind Beep switches of both NID 0x0f and 0x10 */
10927 static struct hda_bind_ctls alc268_bind_beep_sw = {
10928 .ops = &snd_hda_bind_sw,
10930 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10931 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10936 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10937 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10938 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10942 static struct hda_verb alc268_eapd_verbs[] = {
10943 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10944 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10948 /* Toshiba specific */
10949 #define alc268_toshiba_automute alc262_hippo_automute
10951 static struct hda_verb alc268_toshiba_verbs[] = {
10952 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10956 static struct hda_input_mux alc268_acer_lc_capture_source = {
10964 /* Acer specific */
10965 /* bind volumes of both NID 0x02 and 0x03 */
10966 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10967 .ops = &snd_hda_bind_vol,
10969 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10970 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10975 /* mute/unmute internal speaker according to the hp jack and mute state */
10976 static void alc268_acer_automute(struct hda_codec *codec, int force)
10978 struct alc_spec *spec = codec->spec;
10981 if (force || !spec->sense_updated) {
10982 unsigned int present;
10983 present = snd_hda_codec_read(codec, 0x14, 0,
10984 AC_VERB_GET_PIN_SENSE, 0);
10985 spec->jack_present = (present & 0x80000000) != 0;
10986 spec->sense_updated = 1;
10988 if (spec->jack_present)
10989 mute = HDA_AMP_MUTE; /* mute internal speaker */
10990 else /* unmute internal speaker if necessary */
10991 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10992 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10993 HDA_AMP_MUTE, mute);
10997 /* bind hp and internal speaker mute (with plug check) */
10998 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10999 struct snd_ctl_elem_value *ucontrol)
11001 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11002 long *valp = ucontrol->value.integer.value;
11005 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11007 valp[0] ? 0 : HDA_AMP_MUTE);
11008 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11010 valp[1] ? 0 : HDA_AMP_MUTE);
11012 alc268_acer_automute(codec, 0);
11016 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11017 /* output mixer control */
11018 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11021 .name = "Master Playback Switch",
11022 .info = snd_hda_mixer_amp_switch_info,
11023 .get = snd_hda_mixer_amp_switch_get,
11024 .put = alc268_acer_master_sw_put,
11025 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11027 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11031 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11032 /* output mixer control */
11033 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11035 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11036 .name = "Master Playback Switch",
11037 .info = snd_hda_mixer_amp_switch_info,
11038 .get = snd_hda_mixer_amp_switch_get,
11039 .put = alc268_acer_master_sw_put,
11040 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11042 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11043 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11044 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11048 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11049 /* output mixer control */
11050 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11052 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11053 .name = "Master Playback Switch",
11054 .info = snd_hda_mixer_amp_switch_info,
11055 .get = snd_hda_mixer_amp_switch_get,
11056 .put = alc268_acer_master_sw_put,
11057 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11059 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11060 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11064 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11065 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11067 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11068 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11069 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11074 static struct hda_verb alc268_acer_verbs[] = {
11075 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11076 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11078 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11079 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11080 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11081 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11085 /* unsolicited event for HP jack sensing */
11086 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11089 if ((res >> 26) != ALC880_HP_EVENT)
11091 alc268_toshiba_automute(codec);
11094 static void alc268_acer_unsol_event(struct hda_codec *codec,
11097 if ((res >> 26) != ALC880_HP_EVENT)
11099 alc268_acer_automute(codec, 1);
11102 static void alc268_acer_init_hook(struct hda_codec *codec)
11104 alc268_acer_automute(codec, 1);
11107 /* toggle speaker-output according to the hp-jack state */
11108 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11110 unsigned int present;
11111 unsigned char bits;
11113 present = snd_hda_codec_read(codec, 0x15, 0,
11114 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11115 bits = present ? AMP_IN_MUTE(0) : 0;
11116 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11117 AMP_IN_MUTE(0), bits);
11118 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11119 AMP_IN_MUTE(0), bits);
11123 static void alc268_acer_mic_automute(struct hda_codec *codec)
11125 unsigned int present;
11127 present = snd_hda_codec_read(codec, 0x18, 0,
11128 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11129 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11130 present ? 0x0 : 0x6);
11133 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11136 if ((res >> 26) == ALC880_HP_EVENT)
11137 alc268_aspire_one_speaker_automute(codec);
11138 if ((res >> 26) == ALC880_MIC_EVENT)
11139 alc268_acer_mic_automute(codec);
11142 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11144 alc268_aspire_one_speaker_automute(codec);
11145 alc268_acer_mic_automute(codec);
11148 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11149 /* output mixer control */
11150 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11151 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11152 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11153 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11154 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11155 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11159 static struct hda_verb alc268_dell_verbs[] = {
11160 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11161 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11162 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11166 /* mute/unmute internal speaker according to the hp jack and mute state */
11167 static void alc268_dell_automute(struct hda_codec *codec)
11169 unsigned int present;
11172 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11173 if (present & 0x80000000)
11174 mute = HDA_AMP_MUTE;
11176 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11177 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11178 HDA_AMP_MUTE, mute);
11181 static void alc268_dell_unsol_event(struct hda_codec *codec,
11184 if ((res >> 26) != ALC880_HP_EVENT)
11186 alc268_dell_automute(codec);
11189 #define alc268_dell_init_hook alc268_dell_automute
11191 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11192 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11193 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11194 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11196 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11197 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11198 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11199 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11203 static struct hda_verb alc267_quanta_il1_verbs[] = {
11204 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11205 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11209 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11211 unsigned int present;
11213 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11214 & AC_PINSENSE_PRESENCE;
11215 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11216 present ? 0 : PIN_OUT);
11219 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11221 unsigned int present;
11223 present = snd_hda_codec_read(codec, 0x18, 0,
11224 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11225 snd_hda_codec_write(codec, 0x23, 0,
11226 AC_VERB_SET_CONNECT_SEL,
11227 present ? 0x00 : 0x01);
11230 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11232 alc267_quanta_il1_hp_automute(codec);
11233 alc267_quanta_il1_mic_automute(codec);
11236 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11239 switch (res >> 26) {
11240 case ALC880_HP_EVENT:
11241 alc267_quanta_il1_hp_automute(codec);
11243 case ALC880_MIC_EVENT:
11244 alc267_quanta_il1_mic_automute(codec);
11250 * generic initialization of ADC, input mixers and output mixers
11252 static struct hda_verb alc268_base_init_verbs[] = {
11253 /* Unmute DAC0-1 and set vol = 0 */
11254 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11255 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11256 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11257 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11258 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11259 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11262 * Set up output mixers (0x0c - 0x0e)
11264 /* set vol=0 to output mixers */
11265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11266 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11268 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11270 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11271 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11273 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11274 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11275 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11276 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11277 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11278 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11279 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11280 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11282 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11284 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11285 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11286 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11287 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11288 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11290 /* set PCBEEP vol = 0, mute connections */
11291 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11292 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11293 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11295 /* Unmute Selector 23h,24h and set the default input to mic-in */
11297 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11299 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11306 * generic initialization of ADC, input mixers and output mixers
11308 static struct hda_verb alc268_volume_init_verbs[] = {
11309 /* set output DAC */
11310 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11311 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11312 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11313 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11316 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11317 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11318 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11319 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11321 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11322 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11323 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11325 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11327 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11328 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11329 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11330 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11332 /* set PCBEEP vol = 0, mute connections */
11333 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11334 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11335 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11340 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11341 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11342 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11344 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11345 /* The multiple "Capture Source" controls confuse alsamixer
11346 * So call somewhat different..
11348 /* .name = "Capture Source", */
11349 .name = "Input Source",
11351 .info = alc_mux_enum_info,
11352 .get = alc_mux_enum_get,
11353 .put = alc_mux_enum_put,
11358 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11359 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11360 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11361 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11362 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11364 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11365 /* The multiple "Capture Source" controls confuse alsamixer
11366 * So call somewhat different..
11368 /* .name = "Capture Source", */
11369 .name = "Input Source",
11371 .info = alc_mux_enum_info,
11372 .get = alc_mux_enum_get,
11373 .put = alc_mux_enum_put,
11378 static struct hda_input_mux alc268_capture_source = {
11382 { "Front Mic", 0x1 },
11388 static struct hda_input_mux alc268_acer_capture_source = {
11392 { "Internal Mic", 0x1 },
11397 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11401 { "Internal Mic", 0x6 },
11406 #ifdef CONFIG_SND_DEBUG
11407 static struct snd_kcontrol_new alc268_test_mixer[] = {
11408 /* Volume widgets */
11409 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11410 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11411 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11412 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11413 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11414 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11415 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11416 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11417 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11418 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11419 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11420 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11421 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11422 /* The below appears problematic on some hardwares */
11423 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11424 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11425 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11426 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11427 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11429 /* Modes for retasking pin widgets */
11430 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11431 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11432 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11433 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11435 /* Controls for GPIO pins, assuming they are configured as outputs */
11436 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11437 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11438 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11439 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11441 /* Switches to allow the digital SPDIF output pin to be enabled.
11442 * The ALC268 does not have an SPDIF input.
11444 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11446 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11447 * this output to turn on an external amplifier.
11449 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11450 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11456 /* create input playback/capture controls for the given pin */
11457 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11458 const char *ctlname, int idx)
11463 sprintf(name, "%s Playback Volume", ctlname);
11465 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11466 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11470 } else if (nid == 0x15) {
11471 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11472 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11478 sprintf(name, "%s Playback Switch", ctlname);
11479 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11480 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11486 /* add playback controls from the parsed DAC table */
11487 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11488 const struct auto_pin_cfg *cfg)
11493 spec->multiout.num_dacs = 2; /* only use one dac */
11494 spec->multiout.dac_nids = spec->private_dac_nids;
11495 spec->multiout.dac_nids[0] = 2;
11496 spec->multiout.dac_nids[1] = 3;
11498 nid = cfg->line_out_pins[0];
11500 alc268_new_analog_output(spec, nid, "Front", 0);
11502 nid = cfg->speaker_pins[0];
11504 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11505 "Speaker Playback Volume",
11506 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11510 nid = cfg->hp_pins[0];
11512 alc268_new_analog_output(spec, nid, "Headphone", 0);
11514 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11516 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11517 "Mono Playback Switch",
11518 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11525 /* create playback/capture controls for input pins */
11526 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11527 const struct auto_pin_cfg *cfg)
11529 struct hda_input_mux *imux = &spec->private_imux;
11532 for (i = 0; i < AUTO_PIN_LAST; i++) {
11533 switch(cfg->input_pins[i]) {
11535 idx1 = 0; /* Mic 1 */
11538 idx1 = 1; /* Mic 2 */
11541 idx1 = 2; /* Line In */
11548 idx1 = 6; /* digital mics */
11553 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11554 imux->items[imux->num_items].index = idx1;
11560 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11562 struct alc_spec *spec = codec->spec;
11563 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11564 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11565 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11566 unsigned int dac_vol1, dac_vol2;
11569 snd_hda_codec_write(codec, speaker_nid, 0,
11570 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11571 snd_hda_codec_write(codec, 0x0f, 0,
11572 AC_VERB_SET_AMP_GAIN_MUTE,
11574 snd_hda_codec_write(codec, 0x10, 0,
11575 AC_VERB_SET_AMP_GAIN_MUTE,
11578 snd_hda_codec_write(codec, 0x0f, 0,
11579 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11580 snd_hda_codec_write(codec, 0x10, 0,
11581 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11584 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11585 if (line_nid == 0x14)
11586 dac_vol2 = AMP_OUT_ZERO;
11587 else if (line_nid == 0x15)
11588 dac_vol1 = AMP_OUT_ZERO;
11589 if (hp_nid == 0x14)
11590 dac_vol2 = AMP_OUT_ZERO;
11591 else if (hp_nid == 0x15)
11592 dac_vol1 = AMP_OUT_ZERO;
11593 if (line_nid != 0x16 || hp_nid != 0x16 ||
11594 spec->autocfg.line_out_pins[1] != 0x16 ||
11595 spec->autocfg.line_out_pins[2] != 0x16)
11596 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11598 snd_hda_codec_write(codec, 0x02, 0,
11599 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11600 snd_hda_codec_write(codec, 0x03, 0,
11601 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11604 /* pcm configuration: identiacal with ALC880 */
11605 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11606 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11607 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11608 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11611 * BIOS auto configuration
11613 static int alc268_parse_auto_config(struct hda_codec *codec)
11615 struct alc_spec *spec = codec->spec;
11617 static hda_nid_t alc268_ignore[] = { 0 };
11619 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11623 if (!spec->autocfg.line_outs)
11624 return 0; /* can't find valid BIOS pin config */
11626 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11629 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11633 spec->multiout.max_channels = 2;
11635 /* digital only support output */
11636 if (spec->autocfg.dig_out_pin)
11637 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11639 if (spec->kctls.list)
11640 add_mixer(spec, spec->kctls.list);
11642 if (spec->autocfg.speaker_pins[0] != 0x1d)
11643 add_mixer(spec, alc268_beep_mixer);
11645 add_verb(spec, alc268_volume_init_verbs);
11646 spec->num_mux_defs = 1;
11647 spec->input_mux = &spec->private_imux;
11649 err = alc_auto_add_mic_boost(codec);
11653 store_pin_configs(codec);
11657 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11658 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11659 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11661 /* init callback for auto-configuration model -- overriding the default init */
11662 static void alc268_auto_init(struct hda_codec *codec)
11664 struct alc_spec *spec = codec->spec;
11665 alc268_auto_init_multi_out(codec);
11666 alc268_auto_init_hp_out(codec);
11667 alc268_auto_init_mono_speaker_out(codec);
11668 alc268_auto_init_analog_input(codec);
11669 if (spec->unsol_event)
11670 alc_inithook(codec);
11674 * configuration and preset
11676 static const char *alc268_models[ALC268_MODEL_LAST] = {
11677 [ALC267_QUANTA_IL1] = "quanta-il1",
11678 [ALC268_3ST] = "3stack",
11679 [ALC268_TOSHIBA] = "toshiba",
11680 [ALC268_ACER] = "acer",
11681 [ALC268_ACER_DMIC] = "acer-dmic",
11682 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11683 [ALC268_DELL] = "dell",
11684 [ALC268_ZEPTO] = "zepto",
11685 #ifdef CONFIG_SND_DEBUG
11686 [ALC268_TEST] = "test",
11688 [ALC268_AUTO] = "auto",
11691 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11692 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11693 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11694 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11695 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11696 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11697 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11698 ALC268_ACER_ASPIRE_ONE),
11699 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11700 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11701 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11702 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11703 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11704 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11705 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11706 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11707 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11708 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11709 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11713 static struct alc_config_preset alc268_presets[] = {
11714 [ALC267_QUANTA_IL1] = {
11715 .mixers = { alc267_quanta_il1_mixer },
11716 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11717 alc267_quanta_il1_verbs },
11718 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11719 .dac_nids = alc268_dac_nids,
11720 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11721 .adc_nids = alc268_adc_nids_alt,
11723 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11724 .channel_mode = alc268_modes,
11725 .input_mux = &alc268_capture_source,
11726 .unsol_event = alc267_quanta_il1_unsol_event,
11727 .init_hook = alc267_quanta_il1_automute,
11730 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11731 alc268_beep_mixer },
11732 .init_verbs = { alc268_base_init_verbs },
11733 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11734 .dac_nids = alc268_dac_nids,
11735 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11736 .adc_nids = alc268_adc_nids_alt,
11737 .capsrc_nids = alc268_capsrc_nids,
11739 .dig_out_nid = ALC268_DIGOUT_NID,
11740 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11741 .channel_mode = alc268_modes,
11742 .input_mux = &alc268_capture_source,
11744 [ALC268_TOSHIBA] = {
11745 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11746 alc268_beep_mixer },
11747 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11748 alc268_toshiba_verbs },
11749 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11750 .dac_nids = alc268_dac_nids,
11751 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11752 .adc_nids = alc268_adc_nids_alt,
11753 .capsrc_nids = alc268_capsrc_nids,
11755 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11756 .channel_mode = alc268_modes,
11757 .input_mux = &alc268_capture_source,
11758 .unsol_event = alc268_toshiba_unsol_event,
11759 .init_hook = alc268_toshiba_automute,
11762 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11763 alc268_beep_mixer },
11764 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11765 alc268_acer_verbs },
11766 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11767 .dac_nids = alc268_dac_nids,
11768 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11769 .adc_nids = alc268_adc_nids_alt,
11770 .capsrc_nids = alc268_capsrc_nids,
11772 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11773 .channel_mode = alc268_modes,
11774 .input_mux = &alc268_acer_capture_source,
11775 .unsol_event = alc268_acer_unsol_event,
11776 .init_hook = alc268_acer_init_hook,
11778 [ALC268_ACER_DMIC] = {
11779 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11780 alc268_beep_mixer },
11781 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11782 alc268_acer_verbs },
11783 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11784 .dac_nids = alc268_dac_nids,
11785 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11786 .adc_nids = alc268_adc_nids_alt,
11787 .capsrc_nids = alc268_capsrc_nids,
11789 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11790 .channel_mode = alc268_modes,
11791 .input_mux = &alc268_acer_dmic_capture_source,
11792 .unsol_event = alc268_acer_unsol_event,
11793 .init_hook = alc268_acer_init_hook,
11795 [ALC268_ACER_ASPIRE_ONE] = {
11796 .mixers = { alc268_acer_aspire_one_mixer,
11797 alc268_capture_alt_mixer },
11798 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11799 alc268_acer_aspire_one_verbs },
11800 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11801 .dac_nids = alc268_dac_nids,
11802 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11803 .adc_nids = alc268_adc_nids_alt,
11804 .capsrc_nids = alc268_capsrc_nids,
11806 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11807 .channel_mode = alc268_modes,
11808 .input_mux = &alc268_acer_lc_capture_source,
11809 .unsol_event = alc268_acer_lc_unsol_event,
11810 .init_hook = alc268_acer_lc_init_hook,
11813 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11814 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11815 alc268_dell_verbs },
11816 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11817 .dac_nids = alc268_dac_nids,
11819 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11820 .channel_mode = alc268_modes,
11821 .unsol_event = alc268_dell_unsol_event,
11822 .init_hook = alc268_dell_init_hook,
11823 .input_mux = &alc268_capture_source,
11826 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11827 alc268_beep_mixer },
11828 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11829 alc268_toshiba_verbs },
11830 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11831 .dac_nids = alc268_dac_nids,
11832 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11833 .adc_nids = alc268_adc_nids_alt,
11834 .capsrc_nids = alc268_capsrc_nids,
11836 .dig_out_nid = ALC268_DIGOUT_NID,
11837 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11838 .channel_mode = alc268_modes,
11839 .input_mux = &alc268_capture_source,
11840 .unsol_event = alc268_toshiba_unsol_event,
11841 .init_hook = alc268_toshiba_automute
11843 #ifdef CONFIG_SND_DEBUG
11845 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11846 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11847 alc268_volume_init_verbs },
11848 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11849 .dac_nids = alc268_dac_nids,
11850 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11851 .adc_nids = alc268_adc_nids_alt,
11852 .capsrc_nids = alc268_capsrc_nids,
11854 .dig_out_nid = ALC268_DIGOUT_NID,
11855 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11856 .channel_mode = alc268_modes,
11857 .input_mux = &alc268_capture_source,
11862 static int patch_alc268(struct hda_codec *codec)
11864 struct alc_spec *spec;
11868 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11872 codec->spec = spec;
11874 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11878 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11879 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11880 "trying auto-probe from BIOS...\n");
11881 board_config = ALC268_AUTO;
11884 if (board_config == ALC268_AUTO) {
11885 /* automatic parse from the BIOS config */
11886 err = alc268_parse_auto_config(codec);
11892 "hda_codec: Cannot set up configuration "
11893 "from BIOS. Using base mode...\n");
11894 board_config = ALC268_3ST;
11898 if (board_config != ALC268_AUTO)
11899 setup_preset(spec, &alc268_presets[board_config]);
11901 if (codec->vendor_id == 0x10ec0267) {
11902 spec->stream_name_analog = "ALC267 Analog";
11903 spec->stream_name_digital = "ALC267 Digital";
11905 spec->stream_name_analog = "ALC268 Analog";
11906 spec->stream_name_digital = "ALC268 Digital";
11909 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11910 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11911 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11913 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11915 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11916 /* override the amp caps for beep generator */
11917 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11918 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11919 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11920 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11921 (0 << AC_AMPCAP_MUTE_SHIFT));
11923 if (!spec->adc_nids && spec->input_mux) {
11924 /* check whether NID 0x07 is valid */
11925 unsigned int wcap = get_wcaps(codec, 0x07);
11929 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11930 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11931 spec->adc_nids = alc268_adc_nids_alt;
11932 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11933 add_mixer(spec, alc268_capture_alt_mixer);
11935 spec->adc_nids = alc268_adc_nids;
11936 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11937 add_mixer(spec, alc268_capture_mixer);
11939 spec->capsrc_nids = alc268_capsrc_nids;
11940 /* set default input source */
11941 for (i = 0; i < spec->num_adc_nids; i++)
11942 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11943 0, AC_VERB_SET_CONNECT_SEL,
11944 spec->input_mux->items[0].index);
11947 spec->vmaster_nid = 0x02;
11949 codec->patch_ops = alc_patch_ops;
11950 if (board_config == ALC268_AUTO)
11951 spec->init_hook = alc268_auto_init;
11953 codec->proc_widget_hook = print_realtek_coef;
11959 * ALC269 channel source setting (2 channel)
11961 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11963 #define alc269_dac_nids alc260_dac_nids
11965 static hda_nid_t alc269_adc_nids[1] = {
11970 static hda_nid_t alc269_capsrc_nids[1] = {
11974 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11978 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11986 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11994 #define alc269_modes alc260_modes
11995 #define alc269_capture_source alc880_lg_lw_capture_source
11997 static struct snd_kcontrol_new alc269_base_mixer[] = {
11998 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11999 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12000 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12001 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12003 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12004 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12005 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12006 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12007 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12008 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12009 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12011 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12015 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12016 /* output mixer control */
12017 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12020 .name = "Master Playback Switch",
12021 .info = snd_hda_mixer_amp_switch_info,
12022 .get = snd_hda_mixer_amp_switch_get,
12023 .put = alc268_acer_master_sw_put,
12024 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12028 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12029 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12030 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12031 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12032 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12033 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12037 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12038 /* output mixer control */
12039 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12042 .name = "Master Playback Switch",
12043 .info = snd_hda_mixer_amp_switch_info,
12044 .get = snd_hda_mixer_amp_switch_get,
12045 .put = alc268_acer_master_sw_put,
12046 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12050 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12051 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12052 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12053 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12054 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12055 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12056 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12057 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12058 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12062 /* bind volumes of both NID 0x0c and 0x0d */
12063 static struct hda_bind_ctls alc269_epc_bind_vol = {
12064 .ops = &snd_hda_bind_vol,
12066 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12067 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12072 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12073 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12074 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12075 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12079 /* capture mixer elements */
12080 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12081 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12082 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12083 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12088 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12089 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12091 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12096 static struct snd_kcontrol_new alc269_beep_mixer[] = {
12097 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12098 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12102 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12103 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12104 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12105 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12106 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12107 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12108 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12112 static struct hda_verb alc269_lifebook_verbs[] = {
12113 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12114 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12115 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12117 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12118 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12119 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12120 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12121 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12122 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12126 /* toggle speaker-output according to the hp-jack state */
12127 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12129 unsigned int present;
12130 unsigned char bits;
12132 present = snd_hda_codec_read(codec, 0x15, 0,
12133 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12134 bits = present ? AMP_IN_MUTE(0) : 0;
12135 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12136 AMP_IN_MUTE(0), bits);
12137 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12138 AMP_IN_MUTE(0), bits);
12140 snd_hda_codec_write(codec, 0x20, 0,
12141 AC_VERB_SET_COEF_INDEX, 0x0c);
12142 snd_hda_codec_write(codec, 0x20, 0,
12143 AC_VERB_SET_PROC_COEF, 0x680);
12145 snd_hda_codec_write(codec, 0x20, 0,
12146 AC_VERB_SET_COEF_INDEX, 0x0c);
12147 snd_hda_codec_write(codec, 0x20, 0,
12148 AC_VERB_SET_PROC_COEF, 0x480);
12151 /* toggle speaker-output according to the hp-jacks state */
12152 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12154 unsigned int present;
12155 unsigned char bits;
12157 /* Check laptop headphone socket */
12158 present = snd_hda_codec_read(codec, 0x15, 0,
12159 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12161 /* Check port replicator headphone socket */
12162 present |= snd_hda_codec_read(codec, 0x1a, 0,
12163 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12165 bits = present ? AMP_IN_MUTE(0) : 0;
12166 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12167 AMP_IN_MUTE(0), bits);
12168 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12169 AMP_IN_MUTE(0), bits);
12171 snd_hda_codec_write(codec, 0x20, 0,
12172 AC_VERB_SET_COEF_INDEX, 0x0c);
12173 snd_hda_codec_write(codec, 0x20, 0,
12174 AC_VERB_SET_PROC_COEF, 0x680);
12176 snd_hda_codec_write(codec, 0x20, 0,
12177 AC_VERB_SET_COEF_INDEX, 0x0c);
12178 snd_hda_codec_write(codec, 0x20, 0,
12179 AC_VERB_SET_PROC_COEF, 0x480);
12182 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12184 unsigned int present;
12186 present = snd_hda_codec_read(codec, 0x18, 0,
12187 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12188 snd_hda_codec_write(codec, 0x23, 0,
12189 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12192 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12194 unsigned int present_laptop;
12195 unsigned int present_dock;
12197 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12198 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12200 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12201 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12203 /* Laptop mic port overrides dock mic port, design decision */
12205 snd_hda_codec_write(codec, 0x23, 0,
12206 AC_VERB_SET_CONNECT_SEL, 0x3);
12207 if (present_laptop)
12208 snd_hda_codec_write(codec, 0x23, 0,
12209 AC_VERB_SET_CONNECT_SEL, 0x0);
12210 if (!present_dock && !present_laptop)
12211 snd_hda_codec_write(codec, 0x23, 0,
12212 AC_VERB_SET_CONNECT_SEL, 0x1);
12215 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12218 if ((res >> 26) == ALC880_HP_EVENT)
12219 alc269_quanta_fl1_speaker_automute(codec);
12220 if ((res >> 26) == ALC880_MIC_EVENT)
12221 alc269_quanta_fl1_mic_automute(codec);
12224 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12227 if ((res >> 26) == ALC880_HP_EVENT)
12228 alc269_lifebook_speaker_automute(codec);
12229 if ((res >> 26) == ALC880_MIC_EVENT)
12230 alc269_lifebook_mic_autoswitch(codec);
12233 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12235 alc269_quanta_fl1_speaker_automute(codec);
12236 alc269_quanta_fl1_mic_automute(codec);
12239 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12241 alc269_lifebook_speaker_automute(codec);
12242 alc269_lifebook_mic_autoswitch(codec);
12245 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12246 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12247 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12248 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12250 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12251 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12252 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12256 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12257 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12258 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12259 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12260 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12261 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12262 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12266 /* toggle speaker-output according to the hp-jack state */
12267 static void alc269_speaker_automute(struct hda_codec *codec)
12269 unsigned int present;
12270 unsigned char bits;
12272 present = snd_hda_codec_read(codec, 0x15, 0,
12273 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12274 bits = present ? AMP_IN_MUTE(0) : 0;
12275 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12276 AMP_IN_MUTE(0), bits);
12277 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12278 AMP_IN_MUTE(0), bits);
12281 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12283 unsigned int present;
12285 present = snd_hda_codec_read(codec, 0x18, 0,
12286 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12287 snd_hda_codec_write(codec, 0x23, 0,
12288 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12291 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12293 unsigned int present;
12295 present = snd_hda_codec_read(codec, 0x18, 0,
12296 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12297 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12298 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12299 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12300 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12303 /* unsolicited event for HP jack sensing */
12304 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12307 if ((res >> 26) == ALC880_HP_EVENT)
12308 alc269_speaker_automute(codec);
12310 if ((res >> 26) == ALC880_MIC_EVENT)
12311 alc269_eeepc_dmic_automute(codec);
12314 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12316 alc269_speaker_automute(codec);
12317 alc269_eeepc_dmic_automute(codec);
12320 /* unsolicited event for HP jack sensing */
12321 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12324 if ((res >> 26) == ALC880_HP_EVENT)
12325 alc269_speaker_automute(codec);
12327 if ((res >> 26) == ALC880_MIC_EVENT)
12328 alc269_eeepc_amic_automute(codec);
12331 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12333 alc269_speaker_automute(codec);
12334 alc269_eeepc_amic_automute(codec);
12338 * generic initialization of ADC, input mixers and output mixers
12340 static struct hda_verb alc269_init_verbs[] = {
12342 * Unmute ADC0 and set the default input to mic-in
12344 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12346 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12347 * analog-loopback mixer widget
12348 * Note: PASD motherboards uses the Line In 2 as the input for
12349 * front panel mic (mic 2)
12351 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12352 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12359 * Set up output mixers (0x0c - 0x0e)
12361 /* set vol=0 to output mixers */
12362 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12363 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12365 /* set up input amps for analog loopback */
12366 /* Amp Indices: DAC = 0, mixer = 1 */
12367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12368 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12369 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12370 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12371 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12372 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12374 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12376 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12377 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12378 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12379 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12380 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12382 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12384 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12385 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12386 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12387 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12388 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12390 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12393 /* FIXME: use matrix-type input source selection */
12394 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12395 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12402 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12403 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12407 /* add playback controls from the parsed DAC table */
12408 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12409 const struct auto_pin_cfg *cfg)
12414 spec->multiout.num_dacs = 1; /* only use one dac */
12415 spec->multiout.dac_nids = spec->private_dac_nids;
12416 spec->multiout.dac_nids[0] = 2;
12418 nid = cfg->line_out_pins[0];
12420 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12421 "Front Playback Volume",
12422 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12425 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12426 "Front Playback Switch",
12427 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12432 nid = cfg->speaker_pins[0];
12434 if (!cfg->line_out_pins[0]) {
12435 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12436 "Speaker Playback Volume",
12437 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12443 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12444 "Speaker Playback Switch",
12445 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12450 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12451 "Speaker Playback Switch",
12452 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12458 nid = cfg->hp_pins[0];
12460 /* spec->multiout.hp_nid = 2; */
12461 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12462 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12463 "Headphone Playback Volume",
12464 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12470 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12471 "Headphone Playback Switch",
12472 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12477 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12478 "Headphone Playback Switch",
12479 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12488 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12489 const struct auto_pin_cfg *cfg)
12493 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12496 /* digital-mic input pin is excluded in alc880_auto_create..()
12497 * because it's under 0x18
12499 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12500 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12501 struct hda_input_mux *imux = &spec->private_imux;
12502 imux->items[imux->num_items].label = "Int Mic";
12503 imux->items[imux->num_items].index = 0x05;
12509 #ifdef CONFIG_SND_HDA_POWER_SAVE
12510 #define alc269_loopbacks alc880_loopbacks
12513 /* pcm configuration: identiacal with ALC880 */
12514 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12515 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12516 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12517 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12520 * BIOS auto configuration
12522 static int alc269_parse_auto_config(struct hda_codec *codec)
12524 struct alc_spec *spec = codec->spec;
12526 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12528 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12533 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12536 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12540 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12542 if (spec->autocfg.dig_out_pin)
12543 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12545 if (spec->kctls.list)
12546 add_mixer(spec, spec->kctls.list);
12548 /* create a beep mixer control if the pin 0x1d isn't assigned */
12549 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12550 if (spec->autocfg.input_pins[i] == 0x1d)
12552 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12553 add_mixer(spec, alc269_beep_mixer);
12555 add_verb(spec, alc269_init_verbs);
12556 spec->num_mux_defs = 1;
12557 spec->input_mux = &spec->private_imux;
12558 /* set default input source */
12559 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12560 0, AC_VERB_SET_CONNECT_SEL,
12561 spec->input_mux->items[0].index);
12563 err = alc_auto_add_mic_boost(codec);
12567 if (!spec->cap_mixer)
12568 set_capture_mixer(spec);
12570 store_pin_configs(codec);
12574 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12575 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12576 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12579 /* init callback for auto-configuration model -- overriding the default init */
12580 static void alc269_auto_init(struct hda_codec *codec)
12582 struct alc_spec *spec = codec->spec;
12583 alc269_auto_init_multi_out(codec);
12584 alc269_auto_init_hp_out(codec);
12585 alc269_auto_init_analog_input(codec);
12586 if (spec->unsol_event)
12587 alc_inithook(codec);
12591 * configuration and preset
12593 static const char *alc269_models[ALC269_MODEL_LAST] = {
12594 [ALC269_BASIC] = "basic",
12595 [ALC269_QUANTA_FL1] = "quanta",
12596 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12597 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12598 [ALC269_FUJITSU] = "fujitsu",
12599 [ALC269_LIFEBOOK] = "lifebook"
12602 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12603 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12604 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12605 ALC269_ASUS_EEEPC_P703),
12606 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12607 ALC269_ASUS_EEEPC_P901),
12608 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12609 ALC269_ASUS_EEEPC_P901),
12610 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12611 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12615 static struct alc_config_preset alc269_presets[] = {
12617 .mixers = { alc269_base_mixer },
12618 .init_verbs = { alc269_init_verbs },
12619 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12620 .dac_nids = alc269_dac_nids,
12622 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12623 .channel_mode = alc269_modes,
12624 .input_mux = &alc269_capture_source,
12626 [ALC269_QUANTA_FL1] = {
12627 .mixers = { alc269_quanta_fl1_mixer },
12628 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12629 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12630 .dac_nids = alc269_dac_nids,
12632 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12633 .channel_mode = alc269_modes,
12634 .input_mux = &alc269_capture_source,
12635 .unsol_event = alc269_quanta_fl1_unsol_event,
12636 .init_hook = alc269_quanta_fl1_init_hook,
12638 [ALC269_ASUS_EEEPC_P703] = {
12639 .mixers = { alc269_eeepc_mixer },
12640 .cap_mixer = alc269_epc_capture_mixer,
12641 .init_verbs = { alc269_init_verbs,
12642 alc269_eeepc_amic_init_verbs },
12643 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12644 .dac_nids = alc269_dac_nids,
12646 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12647 .channel_mode = alc269_modes,
12648 .input_mux = &alc269_eeepc_amic_capture_source,
12649 .unsol_event = alc269_eeepc_amic_unsol_event,
12650 .init_hook = alc269_eeepc_amic_inithook,
12652 [ALC269_ASUS_EEEPC_P901] = {
12653 .mixers = { alc269_eeepc_mixer },
12654 .cap_mixer = alc269_epc_capture_mixer,
12655 .init_verbs = { alc269_init_verbs,
12656 alc269_eeepc_dmic_init_verbs },
12657 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12658 .dac_nids = alc269_dac_nids,
12660 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12661 .channel_mode = alc269_modes,
12662 .input_mux = &alc269_eeepc_dmic_capture_source,
12663 .unsol_event = alc269_eeepc_dmic_unsol_event,
12664 .init_hook = alc269_eeepc_dmic_inithook,
12666 [ALC269_FUJITSU] = {
12667 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12668 .cap_mixer = alc269_epc_capture_mixer,
12669 .init_verbs = { alc269_init_verbs,
12670 alc269_eeepc_dmic_init_verbs },
12671 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12672 .dac_nids = alc269_dac_nids,
12674 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12675 .channel_mode = alc269_modes,
12676 .input_mux = &alc269_eeepc_dmic_capture_source,
12677 .unsol_event = alc269_eeepc_dmic_unsol_event,
12678 .init_hook = alc269_eeepc_dmic_inithook,
12680 [ALC269_LIFEBOOK] = {
12681 .mixers = { alc269_lifebook_mixer },
12682 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12683 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12684 .dac_nids = alc269_dac_nids,
12686 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12687 .channel_mode = alc269_modes,
12688 .input_mux = &alc269_capture_source,
12689 .unsol_event = alc269_lifebook_unsol_event,
12690 .init_hook = alc269_lifebook_init_hook,
12694 static int patch_alc269(struct hda_codec *codec)
12696 struct alc_spec *spec;
12700 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12704 codec->spec = spec;
12706 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12708 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12712 if (board_config < 0) {
12713 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12714 "trying auto-probe from BIOS...\n");
12715 board_config = ALC269_AUTO;
12718 if (board_config == ALC269_AUTO) {
12719 /* automatic parse from the BIOS config */
12720 err = alc269_parse_auto_config(codec);
12726 "hda_codec: Cannot set up configuration "
12727 "from BIOS. Using base mode...\n");
12728 board_config = ALC269_BASIC;
12732 if (board_config != ALC269_AUTO)
12733 setup_preset(spec, &alc269_presets[board_config]);
12735 spec->stream_name_analog = "ALC269 Analog";
12736 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12737 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12739 spec->stream_name_digital = "ALC269 Digital";
12740 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12741 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12743 spec->adc_nids = alc269_adc_nids;
12744 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12745 spec->capsrc_nids = alc269_capsrc_nids;
12746 if (!spec->cap_mixer)
12747 set_capture_mixer(spec);
12749 codec->patch_ops = alc_patch_ops;
12750 if (board_config == ALC269_AUTO)
12751 spec->init_hook = alc269_auto_init;
12752 #ifdef CONFIG_SND_HDA_POWER_SAVE
12753 if (!spec->loopback.amplist)
12754 spec->loopback.amplist = alc269_loopbacks;
12756 codec->proc_widget_hook = print_realtek_coef;
12762 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12766 * set the path ways for 2 channel output
12767 * need to set the codec line out and mic 1 pin widgets to inputs
12769 static struct hda_verb alc861_threestack_ch2_init[] = {
12770 /* set pin widget 1Ah (line in) for input */
12771 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12772 /* set pin widget 18h (mic1/2) for input, for mic also enable
12775 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12777 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12779 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12780 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12786 * need to set the codec line out and mic 1 pin widgets to outputs
12788 static struct hda_verb alc861_threestack_ch6_init[] = {
12789 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12790 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12791 /* set pin widget 18h (mic1) for output (CLFE)*/
12792 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12794 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12795 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12797 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12799 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12800 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12805 static struct hda_channel_mode alc861_threestack_modes[2] = {
12806 { 2, alc861_threestack_ch2_init },
12807 { 6, alc861_threestack_ch6_init },
12809 /* Set mic1 as input and unmute the mixer */
12810 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12811 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12812 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12815 /* Set mic1 as output and mute mixer */
12816 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12817 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12818 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12822 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12823 { 2, alc861_uniwill_m31_ch2_init },
12824 { 4, alc861_uniwill_m31_ch4_init },
12827 /* Set mic1 and line-in as input and unmute the mixer */
12828 static struct hda_verb alc861_asus_ch2_init[] = {
12829 /* set pin widget 1Ah (line in) for input */
12830 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12831 /* set pin widget 18h (mic1/2) for input, for mic also enable
12834 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12836 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12838 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12839 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12843 /* Set mic1 nad line-in as output and mute mixer */
12844 static struct hda_verb alc861_asus_ch6_init[] = {
12845 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12846 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12847 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12848 /* set pin widget 18h (mic1) for output (CLFE)*/
12849 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12850 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12851 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12852 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12854 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12856 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12857 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12862 static struct hda_channel_mode alc861_asus_modes[2] = {
12863 { 2, alc861_asus_ch2_init },
12864 { 6, alc861_asus_ch6_init },
12869 static struct snd_kcontrol_new alc861_base_mixer[] = {
12870 /* output mixer control */
12871 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12872 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12873 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12874 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12875 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12877 /*Input mixer control */
12878 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12879 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12880 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12881 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12882 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12883 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12884 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12885 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12886 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12887 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12892 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12893 /* output mixer control */
12894 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12895 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12896 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12897 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12898 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12900 /* Input mixer control */
12901 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12902 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12903 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12904 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12905 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12906 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12908 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12910 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12913 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12914 .name = "Channel Mode",
12915 .info = alc_ch_mode_info,
12916 .get = alc_ch_mode_get,
12917 .put = alc_ch_mode_put,
12918 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12923 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12924 /* output mixer control */
12925 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12927 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12932 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12933 /* output mixer control */
12934 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12935 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12936 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12937 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12938 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12940 /* Input mixer control */
12941 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12942 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12943 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12944 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12945 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12946 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12948 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12949 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12953 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12954 .name = "Channel Mode",
12955 .info = alc_ch_mode_info,
12956 .get = alc_ch_mode_get,
12957 .put = alc_ch_mode_put,
12958 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12963 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12964 /* output mixer control */
12965 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12966 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12967 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12968 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12969 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12971 /* Input mixer control */
12972 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12973 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12974 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12975 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12976 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12977 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12979 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12980 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12981 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12984 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12985 .name = "Channel Mode",
12986 .info = alc_ch_mode_info,
12987 .get = alc_ch_mode_get,
12988 .put = alc_ch_mode_put,
12989 .private_value = ARRAY_SIZE(alc861_asus_modes),
12994 /* additional mixer */
12995 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12996 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12997 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12998 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12999 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
13004 * generic initialization of ADC, input mixers and output mixers
13006 static struct hda_verb alc861_base_init_verbs[] = {
13008 * Unmute ADC0 and set the default input to mic-in
13010 /* port-A for surround (rear panel) */
13011 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13012 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13013 /* port-B for mic-in (rear panel) with vref */
13014 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13015 /* port-C for line-in (rear panel) */
13016 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13017 /* port-D for Front */
13018 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13019 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13020 /* port-E for HP out (front panel) */
13021 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13022 /* route front PCM to HP */
13023 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13024 /* port-F for mic-in (front panel) with vref */
13025 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13026 /* port-G for CLFE (rear panel) */
13027 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13028 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13029 /* port-H for side (rear panel) */
13030 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13031 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13033 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13034 /* route front mic to ADC1*/
13035 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13036 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13038 /* Unmute DAC0~3 & spdif out*/
13039 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13040 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13041 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13042 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13043 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13045 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13046 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13047 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13048 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13049 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13051 /* Unmute Stereo Mixer 15 */
13052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13057 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13058 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13059 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13060 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13061 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13062 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13063 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13065 /* hp used DAC 3 (Front) */
13066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13067 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13072 static struct hda_verb alc861_threestack_init_verbs[] = {
13074 * Unmute ADC0 and set the default input to mic-in
13076 /* port-A for surround (rear panel) */
13077 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13078 /* port-B for mic-in (rear panel) with vref */
13079 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13080 /* port-C for line-in (rear panel) */
13081 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13082 /* port-D for Front */
13083 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13084 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13085 /* port-E for HP out (front panel) */
13086 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13087 /* route front PCM to HP */
13088 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13089 /* port-F for mic-in (front panel) with vref */
13090 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13091 /* port-G for CLFE (rear panel) */
13092 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13093 /* port-H for side (rear panel) */
13094 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13096 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13097 /* route front mic to ADC1*/
13098 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13099 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13100 /* Unmute DAC0~3 & spdif out*/
13101 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13103 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13104 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13107 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13108 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13109 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13110 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13111 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13113 /* Unmute Stereo Mixer 15 */
13114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13119 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13120 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13121 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13122 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13123 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13124 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13125 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13127 /* hp used DAC 3 (Front) */
13128 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13129 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13133 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13135 * Unmute ADC0 and set the default input to mic-in
13137 /* port-A for surround (rear panel) */
13138 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13139 /* port-B for mic-in (rear panel) with vref */
13140 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13141 /* port-C for line-in (rear panel) */
13142 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13143 /* port-D for Front */
13144 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13145 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13146 /* port-E for HP out (front panel) */
13147 /* this has to be set to VREF80 */
13148 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13149 /* route front PCM to HP */
13150 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13151 /* port-F for mic-in (front panel) with vref */
13152 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13153 /* port-G for CLFE (rear panel) */
13154 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13155 /* port-H for side (rear panel) */
13156 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13158 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13159 /* route front mic to ADC1*/
13160 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13161 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13162 /* Unmute DAC0~3 & spdif out*/
13163 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13164 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13165 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13166 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13169 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13170 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13171 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13172 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13173 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13175 /* Unmute Stereo Mixer 15 */
13176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13181 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13182 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13184 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13185 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13189 /* hp used DAC 3 (Front) */
13190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13195 static struct hda_verb alc861_asus_init_verbs[] = {
13197 * Unmute ADC0 and set the default input to mic-in
13199 /* port-A for surround (rear panel)
13200 * according to codec#0 this is the HP jack
13202 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13203 /* route front PCM to HP */
13204 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13205 /* port-B for mic-in (rear panel) with vref */
13206 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13207 /* port-C for line-in (rear panel) */
13208 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13209 /* port-D for Front */
13210 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13211 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13212 /* port-E for HP out (front panel) */
13213 /* this has to be set to VREF80 */
13214 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13215 /* route front PCM to HP */
13216 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13217 /* port-F for mic-in (front panel) with vref */
13218 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13219 /* port-G for CLFE (rear panel) */
13220 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13221 /* port-H for side (rear panel) */
13222 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13224 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13225 /* route front mic to ADC1*/
13226 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13227 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13228 /* Unmute DAC0~3 & spdif out*/
13229 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13230 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13231 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13232 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13234 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13235 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13236 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13237 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13238 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13240 /* Unmute Stereo Mixer 15 */
13241 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13244 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13246 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13247 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13248 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13249 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13250 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13252 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13254 /* hp used DAC 3 (Front) */
13255 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13256 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13260 /* additional init verbs for ASUS laptops */
13261 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13262 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13263 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13268 * generic initialization of ADC, input mixers and output mixers
13270 static struct hda_verb alc861_auto_init_verbs[] = {
13272 * Unmute ADC0 and set the default input to mic-in
13274 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13275 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13277 /* Unmute DAC0~3 & spdif out*/
13278 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13279 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13280 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13281 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13284 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13285 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13286 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13287 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13288 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13290 /* Unmute Stereo Mixer 15 */
13291 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13292 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13293 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13296 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13297 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13298 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13299 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13300 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13302 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13303 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13307 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13308 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13309 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13310 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13311 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13312 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13314 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13319 static struct hda_verb alc861_toshiba_init_verbs[] = {
13320 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13325 /* toggle speaker-output according to the hp-jack state */
13326 static void alc861_toshiba_automute(struct hda_codec *codec)
13328 unsigned int present;
13330 present = snd_hda_codec_read(codec, 0x0f, 0,
13331 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13332 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13333 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13334 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13335 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13338 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13341 if ((res >> 26) == ALC880_HP_EVENT)
13342 alc861_toshiba_automute(codec);
13345 /* pcm configuration: identiacal with ALC880 */
13346 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13347 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13348 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13349 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13352 #define ALC861_DIGOUT_NID 0x07
13354 static struct hda_channel_mode alc861_8ch_modes[1] = {
13358 static hda_nid_t alc861_dac_nids[4] = {
13359 /* front, surround, clfe, side */
13360 0x03, 0x06, 0x05, 0x04
13363 static hda_nid_t alc660_dac_nids[3] = {
13364 /* front, clfe, surround */
13368 static hda_nid_t alc861_adc_nids[1] = {
13373 static struct hda_input_mux alc861_capture_source = {
13377 { "Front Mic", 0x3 },
13384 /* fill in the dac_nids table from the parsed pin configuration */
13385 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13386 const struct auto_pin_cfg *cfg)
13391 spec->multiout.dac_nids = spec->private_dac_nids;
13392 for (i = 0; i < cfg->line_outs; i++) {
13393 nid = cfg->line_out_pins[i];
13395 if (i >= ARRAY_SIZE(alc861_dac_nids))
13397 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13400 spec->multiout.num_dacs = cfg->line_outs;
13404 /* add playback controls from the parsed DAC table */
13405 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13406 const struct auto_pin_cfg *cfg)
13409 static const char *chname[4] = {
13410 "Front", "Surround", NULL /*CLFE*/, "Side"
13415 for (i = 0; i < cfg->line_outs; i++) {
13416 nid = spec->multiout.dac_nids[i];
13421 err = add_control(spec, ALC_CTL_BIND_MUTE,
13422 "Center Playback Switch",
13423 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13427 err = add_control(spec, ALC_CTL_BIND_MUTE,
13428 "LFE Playback Switch",
13429 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13434 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13436 if (nid == alc861_dac_nids[idx])
13438 sprintf(name, "%s Playback Switch", chname[idx]);
13439 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13440 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13449 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13457 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13459 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13460 "Headphone Playback Switch",
13461 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13464 spec->multiout.hp_nid = nid;
13469 /* create playback/capture controls for input pins */
13470 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13471 const struct auto_pin_cfg *cfg)
13473 struct hda_input_mux *imux = &spec->private_imux;
13474 int i, err, idx, idx1;
13476 for (i = 0; i < AUTO_PIN_LAST; i++) {
13477 switch (cfg->input_pins[i]) {
13480 idx = 2; /* Line In */
13484 idx = 2; /* Line In */
13488 idx = 1; /* Mic In */
13492 idx = 1; /* Mic In */
13502 err = new_analog_input(spec, cfg->input_pins[i],
13503 auto_pin_cfg_labels[i], idx, 0x15);
13507 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13508 imux->items[imux->num_items].index = idx1;
13514 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13516 int pin_type, int dac_idx)
13518 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13520 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13524 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13526 struct alc_spec *spec = codec->spec;
13529 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13530 for (i = 0; i < spec->autocfg.line_outs; i++) {
13531 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13532 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13534 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13535 spec->multiout.dac_nids[i]);
13539 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13541 struct alc_spec *spec = codec->spec;
13544 pin = spec->autocfg.hp_pins[0];
13545 if (pin) /* connect to front */
13546 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13547 spec->multiout.dac_nids[0]);
13548 pin = spec->autocfg.speaker_pins[0];
13550 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13553 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13555 struct alc_spec *spec = codec->spec;
13558 for (i = 0; i < AUTO_PIN_LAST; i++) {
13559 hda_nid_t nid = spec->autocfg.input_pins[i];
13560 if (nid >= 0x0c && nid <= 0x11) {
13561 snd_hda_codec_write(codec, nid, 0,
13562 AC_VERB_SET_PIN_WIDGET_CONTROL,
13563 i <= AUTO_PIN_FRONT_MIC ?
13564 PIN_VREF80 : PIN_IN);
13569 /* parse the BIOS configuration and set up the alc_spec */
13570 /* return 1 if successful, 0 if the proper config is not found,
13571 * or a negative error code
13573 static int alc861_parse_auto_config(struct hda_codec *codec)
13575 struct alc_spec *spec = codec->spec;
13577 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13579 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13583 if (!spec->autocfg.line_outs)
13584 return 0; /* can't find valid BIOS pin config */
13586 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13589 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13592 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13595 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13599 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13601 if (spec->autocfg.dig_out_pin)
13602 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13604 if (spec->kctls.list)
13605 add_mixer(spec, spec->kctls.list);
13607 add_verb(spec, alc861_auto_init_verbs);
13609 spec->num_mux_defs = 1;
13610 spec->input_mux = &spec->private_imux;
13612 spec->adc_nids = alc861_adc_nids;
13613 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13614 set_capture_mixer(spec);
13616 store_pin_configs(codec);
13620 /* additional initialization for auto-configuration model */
13621 static void alc861_auto_init(struct hda_codec *codec)
13623 struct alc_spec *spec = codec->spec;
13624 alc861_auto_init_multi_out(codec);
13625 alc861_auto_init_hp_out(codec);
13626 alc861_auto_init_analog_input(codec);
13627 if (spec->unsol_event)
13628 alc_inithook(codec);
13631 #ifdef CONFIG_SND_HDA_POWER_SAVE
13632 static struct hda_amp_list alc861_loopbacks[] = {
13633 { 0x15, HDA_INPUT, 0 },
13634 { 0x15, HDA_INPUT, 1 },
13635 { 0x15, HDA_INPUT, 2 },
13636 { 0x15, HDA_INPUT, 3 },
13643 * configuration and preset
13645 static const char *alc861_models[ALC861_MODEL_LAST] = {
13646 [ALC861_3ST] = "3stack",
13647 [ALC660_3ST] = "3stack-660",
13648 [ALC861_3ST_DIG] = "3stack-dig",
13649 [ALC861_6ST_DIG] = "6stack-dig",
13650 [ALC861_UNIWILL_M31] = "uniwill-m31",
13651 [ALC861_TOSHIBA] = "toshiba",
13652 [ALC861_ASUS] = "asus",
13653 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13654 [ALC861_AUTO] = "auto",
13657 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13658 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13659 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13660 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13661 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13662 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13663 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13664 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13665 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13666 * Any other models that need this preset?
13668 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13669 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13670 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13671 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13672 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13673 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13674 /* FIXME: the below seems conflict */
13675 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13676 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13677 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13681 static struct alc_config_preset alc861_presets[] = {
13683 .mixers = { alc861_3ST_mixer },
13684 .init_verbs = { alc861_threestack_init_verbs },
13685 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13686 .dac_nids = alc861_dac_nids,
13687 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13688 .channel_mode = alc861_threestack_modes,
13690 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13691 .adc_nids = alc861_adc_nids,
13692 .input_mux = &alc861_capture_source,
13694 [ALC861_3ST_DIG] = {
13695 .mixers = { alc861_base_mixer },
13696 .init_verbs = { alc861_threestack_init_verbs },
13697 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13698 .dac_nids = alc861_dac_nids,
13699 .dig_out_nid = ALC861_DIGOUT_NID,
13700 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13701 .channel_mode = alc861_threestack_modes,
13703 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13704 .adc_nids = alc861_adc_nids,
13705 .input_mux = &alc861_capture_source,
13707 [ALC861_6ST_DIG] = {
13708 .mixers = { alc861_base_mixer },
13709 .init_verbs = { alc861_base_init_verbs },
13710 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13711 .dac_nids = alc861_dac_nids,
13712 .dig_out_nid = ALC861_DIGOUT_NID,
13713 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13714 .channel_mode = alc861_8ch_modes,
13715 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13716 .adc_nids = alc861_adc_nids,
13717 .input_mux = &alc861_capture_source,
13720 .mixers = { alc861_3ST_mixer },
13721 .init_verbs = { alc861_threestack_init_verbs },
13722 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13723 .dac_nids = alc660_dac_nids,
13724 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13725 .channel_mode = alc861_threestack_modes,
13727 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13728 .adc_nids = alc861_adc_nids,
13729 .input_mux = &alc861_capture_source,
13731 [ALC861_UNIWILL_M31] = {
13732 .mixers = { alc861_uniwill_m31_mixer },
13733 .init_verbs = { alc861_uniwill_m31_init_verbs },
13734 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13735 .dac_nids = alc861_dac_nids,
13736 .dig_out_nid = ALC861_DIGOUT_NID,
13737 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13738 .channel_mode = alc861_uniwill_m31_modes,
13740 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13741 .adc_nids = alc861_adc_nids,
13742 .input_mux = &alc861_capture_source,
13744 [ALC861_TOSHIBA] = {
13745 .mixers = { alc861_toshiba_mixer },
13746 .init_verbs = { alc861_base_init_verbs,
13747 alc861_toshiba_init_verbs },
13748 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13749 .dac_nids = alc861_dac_nids,
13750 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13751 .channel_mode = alc883_3ST_2ch_modes,
13752 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13753 .adc_nids = alc861_adc_nids,
13754 .input_mux = &alc861_capture_source,
13755 .unsol_event = alc861_toshiba_unsol_event,
13756 .init_hook = alc861_toshiba_automute,
13759 .mixers = { alc861_asus_mixer },
13760 .init_verbs = { alc861_asus_init_verbs },
13761 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13762 .dac_nids = alc861_dac_nids,
13763 .dig_out_nid = ALC861_DIGOUT_NID,
13764 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13765 .channel_mode = alc861_asus_modes,
13768 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13769 .adc_nids = alc861_adc_nids,
13770 .input_mux = &alc861_capture_source,
13772 [ALC861_ASUS_LAPTOP] = {
13773 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13774 .init_verbs = { alc861_asus_init_verbs,
13775 alc861_asus_laptop_init_verbs },
13776 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13777 .dac_nids = alc861_dac_nids,
13778 .dig_out_nid = ALC861_DIGOUT_NID,
13779 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13780 .channel_mode = alc883_3ST_2ch_modes,
13782 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13783 .adc_nids = alc861_adc_nids,
13784 .input_mux = &alc861_capture_source,
13789 static int patch_alc861(struct hda_codec *codec)
13791 struct alc_spec *spec;
13795 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13799 codec->spec = spec;
13801 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13805 if (board_config < 0) {
13806 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13807 "trying auto-probe from BIOS...\n");
13808 board_config = ALC861_AUTO;
13811 if (board_config == ALC861_AUTO) {
13812 /* automatic parse from the BIOS config */
13813 err = alc861_parse_auto_config(codec);
13819 "hda_codec: Cannot set up configuration "
13820 "from BIOS. Using base mode...\n");
13821 board_config = ALC861_3ST_DIG;
13825 if (board_config != ALC861_AUTO)
13826 setup_preset(spec, &alc861_presets[board_config]);
13828 spec->stream_name_analog = "ALC861 Analog";
13829 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13830 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13832 spec->stream_name_digital = "ALC861 Digital";
13833 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13834 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13836 spec->vmaster_nid = 0x03;
13838 codec->patch_ops = alc_patch_ops;
13839 if (board_config == ALC861_AUTO)
13840 spec->init_hook = alc861_auto_init;
13841 #ifdef CONFIG_SND_HDA_POWER_SAVE
13842 if (!spec->loopback.amplist)
13843 spec->loopback.amplist = alc861_loopbacks;
13845 codec->proc_widget_hook = print_realtek_coef;
13851 * ALC861-VD support
13855 * In addition, an independent DAC
13857 #define ALC861VD_DIGOUT_NID 0x06
13859 static hda_nid_t alc861vd_dac_nids[4] = {
13860 /* front, surr, clfe, side surr */
13861 0x02, 0x03, 0x04, 0x05
13864 /* dac_nids for ALC660vd are in a different order - according to
13865 * Realtek's driver.
13866 * This should probably tesult in a different mixer for 6stack models
13867 * of ALC660vd codecs, but for now there is only 3stack mixer
13868 * - and it is the same as in 861vd.
13869 * adc_nids in ALC660vd are (is) the same as in 861vd
13871 static hda_nid_t alc660vd_dac_nids[3] = {
13872 /* front, rear, clfe, rear_surr */
13876 static hda_nid_t alc861vd_adc_nids[1] = {
13881 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13884 /* FIXME: should be a matrix-type input source selection */
13885 static struct hda_input_mux alc861vd_capture_source = {
13889 { "Front Mic", 0x1 },
13895 static struct hda_input_mux alc861vd_dallas_capture_source = {
13898 { "Ext Mic", 0x0 },
13899 { "Int Mic", 0x1 },
13903 static struct hda_input_mux alc861vd_hp_capture_source = {
13906 { "Front Mic", 0x0 },
13907 { "ATAPI Mic", 0x1 },
13914 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13921 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13922 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13923 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13924 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13925 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13932 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13933 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13934 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13935 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13936 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13940 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13941 { 6, alc861vd_6stack_ch6_init },
13942 { 8, alc861vd_6stack_ch8_init },
13945 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13947 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13948 .name = "Channel Mode",
13949 .info = alc_ch_mode_info,
13950 .get = alc_ch_mode_get,
13951 .put = alc_ch_mode_put,
13956 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13957 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13959 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13960 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13963 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13964 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13966 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13968 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13970 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13971 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13973 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13974 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13976 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13978 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13982 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13983 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13984 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13986 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13987 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13992 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13993 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13998 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13999 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14000 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14002 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14004 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14008 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14009 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14010 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14012 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14013 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14015 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14016 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14018 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14019 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14024 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14025 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14026 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14027 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14031 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14035 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14036 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14037 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14039 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14040 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14045 /* Pin assignment: Speaker=0x14, HP = 0x15,
14046 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14048 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14049 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14050 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14051 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14052 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14053 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14054 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14055 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14056 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14057 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14058 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14059 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
14060 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
14064 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14065 * Front Mic=0x18, ATAPI Mic = 0x19,
14067 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14068 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14069 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14070 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14071 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14072 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14073 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14074 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14075 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14081 * generic initialization of ADC, input mixers and output mixers
14083 static struct hda_verb alc861vd_volume_init_verbs[] = {
14085 * Unmute ADC0 and set the default input to mic-in
14087 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14088 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14090 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14091 * the analog-loopback mixer widget
14093 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14094 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14100 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14107 * Set up output mixers (0x02 - 0x05)
14109 /* set vol=0 to output mixers */
14110 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14111 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14112 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14113 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14115 /* set up input amps for analog loopback */
14116 /* Amp Indices: DAC = 0, mixer = 1 */
14117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14118 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14120 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14122 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14123 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14124 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14130 * 3-stack pin configuration:
14131 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14133 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14135 * Set pin mode and muting
14137 /* set front pin widgets 0x14 for output */
14138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14139 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14140 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14142 /* Mic (rear) pin: input vref at 80% */
14143 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14144 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14145 /* Front Mic pin: input vref at 80% */
14146 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14147 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14148 /* Line In pin: input */
14149 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14150 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14151 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14152 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14153 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14154 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14155 /* CD pin widget for input */
14156 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14162 * 6-stack pin configuration:
14164 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14166 * Set pin mode and muting
14168 /* set front pin widgets 0x14 for output */
14169 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14170 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14171 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14173 /* Rear Pin: output 1 (0x0d) */
14174 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14176 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14177 /* CLFE Pin: output 2 (0x0e) */
14178 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14179 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14180 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14181 /* Side Pin: output 3 (0x0f) */
14182 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14184 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14186 /* Mic (rear) pin: input vref at 80% */
14187 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14189 /* Front Mic pin: input vref at 80% */
14190 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14192 /* Line In pin: input */
14193 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14195 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14198 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14199 /* CD pin widget for input */
14200 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14205 static struct hda_verb alc861vd_eapd_verbs[] = {
14206 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14210 static struct hda_verb alc660vd_eapd_verbs[] = {
14211 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14212 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14216 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14219 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14220 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14221 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14225 /* toggle speaker-output according to the hp-jack state */
14226 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14228 unsigned int present;
14229 unsigned char bits;
14231 present = snd_hda_codec_read(codec, 0x1b, 0,
14232 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14233 bits = present ? HDA_AMP_MUTE : 0;
14234 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14235 HDA_AMP_MUTE, bits);
14238 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14240 unsigned int present;
14241 unsigned char bits;
14243 present = snd_hda_codec_read(codec, 0x18, 0,
14244 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14245 bits = present ? HDA_AMP_MUTE : 0;
14246 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14247 HDA_AMP_MUTE, bits);
14250 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14252 alc861vd_lenovo_hp_automute(codec);
14253 alc861vd_lenovo_mic_automute(codec);
14256 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14259 switch (res >> 26) {
14260 case ALC880_HP_EVENT:
14261 alc861vd_lenovo_hp_automute(codec);
14263 case ALC880_MIC_EVENT:
14264 alc861vd_lenovo_mic_automute(codec);
14269 static struct hda_verb alc861vd_dallas_verbs[] = {
14270 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14271 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14272 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14273 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14277 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14278 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14279 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14280 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14281 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14282 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14284 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14285 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14287 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14288 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14289 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14290 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14291 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14295 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14296 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14297 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14298 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14299 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14300 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14307 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14308 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14309 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14314 /* toggle speaker-output according to the hp-jack state */
14315 static void alc861vd_dallas_automute(struct hda_codec *codec)
14317 unsigned int present;
14319 present = snd_hda_codec_read(codec, 0x15, 0,
14320 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14321 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14322 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14325 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14327 if ((res >> 26) == ALC880_HP_EVENT)
14328 alc861vd_dallas_automute(codec);
14331 #ifdef CONFIG_SND_HDA_POWER_SAVE
14332 #define alc861vd_loopbacks alc880_loopbacks
14335 /* pcm configuration: identiacal with ALC880 */
14336 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14337 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14338 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14339 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14342 * configuration and preset
14344 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14345 [ALC660VD_3ST] = "3stack-660",
14346 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14347 [ALC660VD_ASUS_V1S] = "asus-v1s",
14348 [ALC861VD_3ST] = "3stack",
14349 [ALC861VD_3ST_DIG] = "3stack-digout",
14350 [ALC861VD_6ST_DIG] = "6stack-digout",
14351 [ALC861VD_LENOVO] = "lenovo",
14352 [ALC861VD_DALLAS] = "dallas",
14353 [ALC861VD_HP] = "hp",
14354 [ALC861VD_AUTO] = "auto",
14357 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14358 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14359 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14360 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14361 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14362 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14363 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14364 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14365 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14366 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14367 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14368 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14369 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14370 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14371 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14372 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14373 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14374 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14378 static struct alc_config_preset alc861vd_presets[] = {
14380 .mixers = { alc861vd_3st_mixer },
14381 .init_verbs = { alc861vd_volume_init_verbs,
14382 alc861vd_3stack_init_verbs },
14383 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14384 .dac_nids = alc660vd_dac_nids,
14385 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14386 .channel_mode = alc861vd_3stack_2ch_modes,
14387 .input_mux = &alc861vd_capture_source,
14389 [ALC660VD_3ST_DIG] = {
14390 .mixers = { alc861vd_3st_mixer },
14391 .init_verbs = { alc861vd_volume_init_verbs,
14392 alc861vd_3stack_init_verbs },
14393 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14394 .dac_nids = alc660vd_dac_nids,
14395 .dig_out_nid = ALC861VD_DIGOUT_NID,
14396 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14397 .channel_mode = alc861vd_3stack_2ch_modes,
14398 .input_mux = &alc861vd_capture_source,
14401 .mixers = { alc861vd_3st_mixer },
14402 .init_verbs = { alc861vd_volume_init_verbs,
14403 alc861vd_3stack_init_verbs },
14404 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14405 .dac_nids = alc861vd_dac_nids,
14406 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14407 .channel_mode = alc861vd_3stack_2ch_modes,
14408 .input_mux = &alc861vd_capture_source,
14410 [ALC861VD_3ST_DIG] = {
14411 .mixers = { alc861vd_3st_mixer },
14412 .init_verbs = { alc861vd_volume_init_verbs,
14413 alc861vd_3stack_init_verbs },
14414 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14415 .dac_nids = alc861vd_dac_nids,
14416 .dig_out_nid = ALC861VD_DIGOUT_NID,
14417 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14418 .channel_mode = alc861vd_3stack_2ch_modes,
14419 .input_mux = &alc861vd_capture_source,
14421 [ALC861VD_6ST_DIG] = {
14422 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14423 .init_verbs = { alc861vd_volume_init_verbs,
14424 alc861vd_6stack_init_verbs },
14425 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14426 .dac_nids = alc861vd_dac_nids,
14427 .dig_out_nid = ALC861VD_DIGOUT_NID,
14428 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14429 .channel_mode = alc861vd_6stack_modes,
14430 .input_mux = &alc861vd_capture_source,
14432 [ALC861VD_LENOVO] = {
14433 .mixers = { alc861vd_lenovo_mixer },
14434 .init_verbs = { alc861vd_volume_init_verbs,
14435 alc861vd_3stack_init_verbs,
14436 alc861vd_eapd_verbs,
14437 alc861vd_lenovo_unsol_verbs },
14438 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14439 .dac_nids = alc660vd_dac_nids,
14440 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14441 .channel_mode = alc861vd_3stack_2ch_modes,
14442 .input_mux = &alc861vd_capture_source,
14443 .unsol_event = alc861vd_lenovo_unsol_event,
14444 .init_hook = alc861vd_lenovo_automute,
14446 [ALC861VD_DALLAS] = {
14447 .mixers = { alc861vd_dallas_mixer },
14448 .init_verbs = { alc861vd_dallas_verbs },
14449 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14450 .dac_nids = alc861vd_dac_nids,
14451 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14452 .channel_mode = alc861vd_3stack_2ch_modes,
14453 .input_mux = &alc861vd_dallas_capture_source,
14454 .unsol_event = alc861vd_dallas_unsol_event,
14455 .init_hook = alc861vd_dallas_automute,
14458 .mixers = { alc861vd_hp_mixer },
14459 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14460 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14461 .dac_nids = alc861vd_dac_nids,
14462 .dig_out_nid = ALC861VD_DIGOUT_NID,
14463 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14464 .channel_mode = alc861vd_3stack_2ch_modes,
14465 .input_mux = &alc861vd_hp_capture_source,
14466 .unsol_event = alc861vd_dallas_unsol_event,
14467 .init_hook = alc861vd_dallas_automute,
14469 [ALC660VD_ASUS_V1S] = {
14470 .mixers = { alc861vd_lenovo_mixer },
14471 .init_verbs = { alc861vd_volume_init_verbs,
14472 alc861vd_3stack_init_verbs,
14473 alc861vd_eapd_verbs,
14474 alc861vd_lenovo_unsol_verbs },
14475 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14476 .dac_nids = alc660vd_dac_nids,
14477 .dig_out_nid = ALC861VD_DIGOUT_NID,
14478 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14479 .channel_mode = alc861vd_3stack_2ch_modes,
14480 .input_mux = &alc861vd_capture_source,
14481 .unsol_event = alc861vd_lenovo_unsol_event,
14482 .init_hook = alc861vd_lenovo_automute,
14487 * BIOS auto configuration
14489 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14490 hda_nid_t nid, int pin_type, int dac_idx)
14492 alc_set_pin_output(codec, nid, pin_type);
14495 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14497 struct alc_spec *spec = codec->spec;
14500 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14501 for (i = 0; i <= HDA_SIDE; i++) {
14502 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14503 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14505 alc861vd_auto_set_output_and_unmute(codec, nid,
14511 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14513 struct alc_spec *spec = codec->spec;
14516 pin = spec->autocfg.hp_pins[0];
14517 if (pin) /* connect to front and use dac 0 */
14518 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14519 pin = spec->autocfg.speaker_pins[0];
14521 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14524 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14525 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14527 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14529 struct alc_spec *spec = codec->spec;
14532 for (i = 0; i < AUTO_PIN_LAST; i++) {
14533 hda_nid_t nid = spec->autocfg.input_pins[i];
14534 if (alc861vd_is_input_pin(nid)) {
14535 snd_hda_codec_write(codec, nid, 0,
14536 AC_VERB_SET_PIN_WIDGET_CONTROL,
14537 i <= AUTO_PIN_FRONT_MIC ?
14538 PIN_VREF80 : PIN_IN);
14539 if (nid != ALC861VD_PIN_CD_NID)
14540 snd_hda_codec_write(codec, nid, 0,
14541 AC_VERB_SET_AMP_GAIN_MUTE,
14547 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14549 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14550 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14552 /* add playback controls from the parsed DAC table */
14553 /* Based on ALC880 version. But ALC861VD has separate,
14554 * different NIDs for mute/unmute switch and volume control */
14555 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14556 const struct auto_pin_cfg *cfg)
14559 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14560 hda_nid_t nid_v, nid_s;
14563 for (i = 0; i < cfg->line_outs; i++) {
14564 if (!spec->multiout.dac_nids[i])
14566 nid_v = alc861vd_idx_to_mixer_vol(
14568 spec->multiout.dac_nids[i]));
14569 nid_s = alc861vd_idx_to_mixer_switch(
14571 spec->multiout.dac_nids[i]));
14575 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14576 "Center Playback Volume",
14577 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14581 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14582 "LFE Playback Volume",
14583 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14587 err = add_control(spec, ALC_CTL_BIND_MUTE,
14588 "Center Playback Switch",
14589 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14593 err = add_control(spec, ALC_CTL_BIND_MUTE,
14594 "LFE Playback Switch",
14595 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14600 sprintf(name, "%s Playback Volume", chname[i]);
14601 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14602 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14606 sprintf(name, "%s Playback Switch", chname[i]);
14607 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14608 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14617 /* add playback controls for speaker and HP outputs */
14618 /* Based on ALC880 version. But ALC861VD has separate,
14619 * different NIDs for mute/unmute switch and volume control */
14620 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14621 hda_nid_t pin, const char *pfx)
14623 hda_nid_t nid_v, nid_s;
14630 if (alc880_is_fixed_pin(pin)) {
14631 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14632 /* specify the DAC as the extra output */
14633 if (!spec->multiout.hp_nid)
14634 spec->multiout.hp_nid = nid_v;
14636 spec->multiout.extra_out_nid[0] = nid_v;
14637 /* control HP volume/switch on the output mixer amp */
14638 nid_v = alc861vd_idx_to_mixer_vol(
14639 alc880_fixed_pin_idx(pin));
14640 nid_s = alc861vd_idx_to_mixer_switch(
14641 alc880_fixed_pin_idx(pin));
14643 sprintf(name, "%s Playback Volume", pfx);
14644 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14645 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14648 sprintf(name, "%s Playback Switch", pfx);
14649 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14650 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14653 } else if (alc880_is_multi_pin(pin)) {
14654 /* set manual connection */
14655 /* we have only a switch on HP-out PIN */
14656 sprintf(name, "%s Playback Switch", pfx);
14657 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14658 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14665 /* parse the BIOS configuration and set up the alc_spec
14666 * return 1 if successful, 0 if the proper config is not found,
14667 * or a negative error code
14668 * Based on ALC880 version - had to change it to override
14669 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14670 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14672 struct alc_spec *spec = codec->spec;
14674 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14676 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14680 if (!spec->autocfg.line_outs)
14681 return 0; /* can't find valid BIOS pin config */
14683 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14686 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14689 err = alc861vd_auto_create_extra_out(spec,
14690 spec->autocfg.speaker_pins[0],
14694 err = alc861vd_auto_create_extra_out(spec,
14695 spec->autocfg.hp_pins[0],
14699 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14703 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14705 if (spec->autocfg.dig_out_pin)
14706 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14708 if (spec->kctls.list)
14709 add_mixer(spec, spec->kctls.list);
14711 add_verb(spec, alc861vd_volume_init_verbs);
14713 spec->num_mux_defs = 1;
14714 spec->input_mux = &spec->private_imux;
14716 err = alc_auto_add_mic_boost(codec);
14720 store_pin_configs(codec);
14724 /* additional initialization for auto-configuration model */
14725 static void alc861vd_auto_init(struct hda_codec *codec)
14727 struct alc_spec *spec = codec->spec;
14728 alc861vd_auto_init_multi_out(codec);
14729 alc861vd_auto_init_hp_out(codec);
14730 alc861vd_auto_init_analog_input(codec);
14731 alc861vd_auto_init_input_src(codec);
14732 if (spec->unsol_event)
14733 alc_inithook(codec);
14736 static int patch_alc861vd(struct hda_codec *codec)
14738 struct alc_spec *spec;
14739 int err, board_config;
14741 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14745 codec->spec = spec;
14747 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14751 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14752 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14753 "ALC861VD, trying auto-probe from BIOS...\n");
14754 board_config = ALC861VD_AUTO;
14757 if (board_config == ALC861VD_AUTO) {
14758 /* automatic parse from the BIOS config */
14759 err = alc861vd_parse_auto_config(codec);
14765 "hda_codec: Cannot set up configuration "
14766 "from BIOS. Using base mode...\n");
14767 board_config = ALC861VD_3ST;
14771 if (board_config != ALC861VD_AUTO)
14772 setup_preset(spec, &alc861vd_presets[board_config]);
14774 if (codec->vendor_id == 0x10ec0660) {
14775 spec->stream_name_analog = "ALC660-VD Analog";
14776 spec->stream_name_digital = "ALC660-VD Digital";
14777 /* always turn on EAPD */
14778 add_verb(spec, alc660vd_eapd_verbs);
14780 spec->stream_name_analog = "ALC861VD Analog";
14781 spec->stream_name_digital = "ALC861VD Digital";
14784 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14785 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14787 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14788 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14790 spec->adc_nids = alc861vd_adc_nids;
14791 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14792 spec->capsrc_nids = alc861vd_capsrc_nids;
14793 spec->is_mix_capture = 1;
14795 set_capture_mixer(spec);
14797 spec->vmaster_nid = 0x02;
14799 codec->patch_ops = alc_patch_ops;
14801 if (board_config == ALC861VD_AUTO)
14802 spec->init_hook = alc861vd_auto_init;
14803 #ifdef CONFIG_SND_HDA_POWER_SAVE
14804 if (!spec->loopback.amplist)
14805 spec->loopback.amplist = alc861vd_loopbacks;
14807 codec->proc_widget_hook = print_realtek_coef;
14815 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14816 * configuration. Each pin widget can choose any input DACs and a mixer.
14817 * Each ADC is connected from a mixer of all inputs. This makes possible
14818 * 6-channel independent captures.
14820 * In addition, an independent DAC for the multi-playback (not used in this
14823 #define ALC662_DIGOUT_NID 0x06
14824 #define ALC662_DIGIN_NID 0x0a
14826 static hda_nid_t alc662_dac_nids[4] = {
14827 /* front, rear, clfe, rear_surr */
14831 static hda_nid_t alc662_adc_nids[1] = {
14836 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14839 /* FIXME: should be a matrix-type input source selection */
14840 static struct hda_input_mux alc662_capture_source = {
14844 { "Front Mic", 0x1 },
14850 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14858 static struct hda_input_mux alc662_eeepc_capture_source = {
14866 static struct hda_input_mux alc663_capture_source = {
14870 { "Front Mic", 0x1 },
14875 static struct hda_input_mux alc663_m51va_capture_source = {
14878 { "Ext-Mic", 0x0 },
14886 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14893 static struct hda_verb alc662_3ST_ch2_init[] = {
14894 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14895 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14896 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14897 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14904 static struct hda_verb alc662_3ST_ch6_init[] = {
14905 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14906 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14907 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14908 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14909 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14910 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14914 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14915 { 2, alc662_3ST_ch2_init },
14916 { 6, alc662_3ST_ch6_init },
14922 static struct hda_verb alc662_sixstack_ch6_init[] = {
14923 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14924 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14925 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14932 static struct hda_verb alc662_sixstack_ch8_init[] = {
14933 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14934 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14935 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14939 static struct hda_channel_mode alc662_5stack_modes[2] = {
14940 { 2, alc662_sixstack_ch6_init },
14941 { 6, alc662_sixstack_ch8_init },
14944 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14945 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14948 static struct snd_kcontrol_new alc662_base_mixer[] = {
14949 /* output mixer control */
14950 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14951 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14952 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14953 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14954 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14955 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14956 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14957 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14958 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14960 /*Input mixer control */
14961 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14962 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14963 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14964 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14965 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14966 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14967 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14968 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14972 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14973 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14974 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14975 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14976 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14977 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14978 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14979 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14982 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14983 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14984 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14985 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14989 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14990 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14991 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14992 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14993 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14994 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14995 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14996 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14997 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14998 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14999 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15000 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15001 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15002 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15003 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15004 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15006 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15007 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
15008 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15012 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15013 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15014 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15015 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15016 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15017 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15018 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15019 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15025 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15026 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15028 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15029 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15031 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15032 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15033 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15035 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15036 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15037 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15041 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15042 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15043 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15044 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15045 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15046 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15047 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15048 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15049 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15050 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15051 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15052 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15053 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15055 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15059 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15060 .ops = &snd_hda_bind_vol,
15062 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15063 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15068 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15069 .ops = &snd_hda_bind_sw,
15071 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15072 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15077 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15078 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15079 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15085 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15086 .ops = &snd_hda_bind_sw,
15088 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15089 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15090 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15095 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15096 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15097 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15100 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15101 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15106 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15107 .ops = &snd_hda_bind_sw,
15109 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15110 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15111 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15116 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15117 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15118 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15121 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15122 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15126 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15127 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15128 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15132 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15133 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15137 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15138 .ops = &snd_hda_bind_vol,
15140 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15141 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15146 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15147 .ops = &snd_hda_bind_sw,
15149 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15150 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15155 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15156 HDA_BIND_VOL("Master Playback Volume",
15157 &alc663_asus_two_bind_master_vol),
15158 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15159 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15162 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15166 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15167 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15168 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15169 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15170 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15176 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15177 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15178 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15179 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15180 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15185 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15186 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15190 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15191 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15192 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15196 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15197 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15198 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15204 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15207 .name = "Channel Mode",
15208 .info = alc_ch_mode_info,
15209 .get = alc_ch_mode_get,
15210 .put = alc_ch_mode_put,
15215 static struct hda_verb alc662_init_verbs[] = {
15216 /* ADC: mute amp left and right */
15217 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15218 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15219 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15221 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15222 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15223 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15224 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15225 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15231 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15232 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15234 /* Front Pin: output 0 (0x0c) */
15235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15238 /* Rear Pin: output 1 (0x0d) */
15239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15242 /* CLFE Pin: output 2 (0x0e) */
15243 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15244 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15246 /* Mic (rear) pin: input vref at 80% */
15247 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15249 /* Front Mic pin: input vref at 80% */
15250 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15251 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15252 /* Line In pin: input */
15253 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15254 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15255 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15256 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15257 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15258 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15259 /* CD pin widget for input */
15260 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15262 /* FIXME: use matrix-type input source selection */
15263 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15268 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15270 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15273 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15275 /* always trun on EAPD */
15276 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15277 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15282 static struct hda_verb alc662_sue_init_verbs[] = {
15283 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15284 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15288 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15289 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15290 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15294 /* Set Unsolicited Event*/
15295 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15296 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15297 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15302 * generic initialization of ADC, input mixers and output mixers
15304 static struct hda_verb alc662_auto_init_verbs[] = {
15306 * Unmute ADC and set the default input to mic-in
15308 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15309 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15311 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15313 * Note: PASD motherboards uses the Line In 2 as the input for front
15314 * panel mic (mic 2)
15316 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15324 * Set up output mixers (0x0c - 0x0f)
15326 /* set vol=0 to output mixers */
15327 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15328 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15329 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15331 /* set up input amps for analog loopback */
15332 /* Amp Indices: DAC = 0, mixer = 1 */
15333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15341 /* FIXME: use matrix-type input source selection */
15342 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15349 /* additional verbs for ALC663 */
15350 static struct hda_verb alc663_auto_init_verbs[] = {
15351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15356 static struct hda_verb alc663_m51va_init_verbs[] = {
15357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15358 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15359 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15360 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15361 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15364 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15365 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15369 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15370 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15371 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15372 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15375 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15376 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15380 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15381 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15382 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15383 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15384 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15387 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15388 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15392 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15394 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15395 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15398 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15399 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15403 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15404 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15405 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15406 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15407 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15408 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15409 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15410 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15413 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15414 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15415 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15419 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15421 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15422 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15423 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15425 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15426 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15427 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15428 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15429 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15430 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15431 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15435 static struct hda_verb alc663_g71v_init_verbs[] = {
15436 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15437 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15438 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15440 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15441 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15442 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15445 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15446 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15450 static struct hda_verb alc663_g50v_init_verbs[] = {
15451 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15452 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15453 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15455 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15456 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15460 static struct hda_verb alc662_ecs_init_verbs[] = {
15461 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15463 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15464 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15468 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15469 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15470 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15474 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15476 unsigned int present;
15477 unsigned char bits;
15479 present = snd_hda_codec_read(codec, 0x14, 0,
15480 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15481 bits = present ? HDA_AMP_MUTE : 0;
15482 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15483 HDA_AMP_MUTE, bits);
15486 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15488 unsigned int present;
15489 unsigned char bits;
15491 present = snd_hda_codec_read(codec, 0x1b, 0,
15492 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15493 bits = present ? HDA_AMP_MUTE : 0;
15494 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15495 HDA_AMP_MUTE, bits);
15496 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15497 HDA_AMP_MUTE, bits);
15500 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15503 if ((res >> 26) == ALC880_HP_EVENT)
15504 alc662_lenovo_101e_all_automute(codec);
15505 if ((res >> 26) == ALC880_FRONT_EVENT)
15506 alc662_lenovo_101e_ispeaker_automute(codec);
15509 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15511 unsigned int present;
15513 present = snd_hda_codec_read(codec, 0x18, 0,
15514 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15515 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15516 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15517 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15518 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15519 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15520 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15521 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15522 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15525 /* unsolicited event for HP jack sensing */
15526 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15529 if ((res >> 26) == ALC880_HP_EVENT)
15530 alc262_hippo1_automute( codec );
15532 if ((res >> 26) == ALC880_MIC_EVENT)
15533 alc662_eeepc_mic_automute(codec);
15536 static void alc662_eeepc_inithook(struct hda_codec *codec)
15538 alc262_hippo1_automute( codec );
15539 alc662_eeepc_mic_automute(codec);
15542 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15545 unsigned int present;
15547 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15548 present = snd_hda_codec_read(codec, 0x14, 0,
15549 AC_VERB_GET_PIN_SENSE, 0);
15550 present = (present & 0x80000000) != 0;
15552 /* mute internal speaker */
15553 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15554 HDA_AMP_MUTE, HDA_AMP_MUTE);
15556 /* unmute internal speaker if necessary */
15557 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15558 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15559 HDA_AMP_MUTE, mute);
15563 /* unsolicited event for HP jack sensing */
15564 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15567 if ((res >> 26) == ALC880_HP_EVENT)
15568 alc662_eeepc_ep20_automute(codec);
15571 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15573 alc662_eeepc_ep20_automute(codec);
15576 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15578 unsigned int present;
15579 unsigned char bits;
15581 present = snd_hda_codec_read(codec, 0x21, 0,
15582 AC_VERB_GET_PIN_SENSE, 0)
15583 & AC_PINSENSE_PRESENCE;
15584 bits = present ? HDA_AMP_MUTE : 0;
15585 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15586 AMP_IN_MUTE(0), bits);
15587 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15588 AMP_IN_MUTE(0), bits);
15591 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15593 unsigned int present;
15594 unsigned char bits;
15596 present = snd_hda_codec_read(codec, 0x21, 0,
15597 AC_VERB_GET_PIN_SENSE, 0)
15598 & AC_PINSENSE_PRESENCE;
15599 bits = present ? HDA_AMP_MUTE : 0;
15600 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15601 AMP_IN_MUTE(0), bits);
15602 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15603 AMP_IN_MUTE(0), bits);
15604 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15605 AMP_IN_MUTE(0), bits);
15606 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15607 AMP_IN_MUTE(0), bits);
15610 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15612 unsigned int present;
15613 unsigned char bits;
15615 present = snd_hda_codec_read(codec, 0x15, 0,
15616 AC_VERB_GET_PIN_SENSE, 0)
15617 & AC_PINSENSE_PRESENCE;
15618 bits = present ? HDA_AMP_MUTE : 0;
15619 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15620 AMP_IN_MUTE(0), bits);
15621 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15622 AMP_IN_MUTE(0), bits);
15623 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15624 AMP_IN_MUTE(0), bits);
15625 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15626 AMP_IN_MUTE(0), bits);
15629 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15631 unsigned int present;
15632 unsigned char bits;
15634 present = snd_hda_codec_read(codec, 0x1b, 0,
15635 AC_VERB_GET_PIN_SENSE, 0)
15636 & AC_PINSENSE_PRESENCE;
15637 bits = present ? 0 : PIN_OUT;
15638 snd_hda_codec_write(codec, 0x14, 0,
15639 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15642 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15644 unsigned int present1, present2;
15646 present1 = snd_hda_codec_read(codec, 0x21, 0,
15647 AC_VERB_GET_PIN_SENSE, 0)
15648 & AC_PINSENSE_PRESENCE;
15649 present2 = snd_hda_codec_read(codec, 0x15, 0,
15650 AC_VERB_GET_PIN_SENSE, 0)
15651 & AC_PINSENSE_PRESENCE;
15653 if (present1 || present2) {
15654 snd_hda_codec_write_cache(codec, 0x14, 0,
15655 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15657 snd_hda_codec_write_cache(codec, 0x14, 0,
15658 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15662 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15664 unsigned int present1, present2;
15666 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15667 AC_VERB_GET_PIN_SENSE, 0)
15668 & AC_PINSENSE_PRESENCE;
15669 present2 = snd_hda_codec_read(codec, 0x15, 0,
15670 AC_VERB_GET_PIN_SENSE, 0)
15671 & AC_PINSENSE_PRESENCE;
15673 if (present1 || present2) {
15674 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15675 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15676 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15677 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15679 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15680 AMP_IN_MUTE(0), 0);
15681 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15682 AMP_IN_MUTE(0), 0);
15686 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15688 unsigned int present;
15690 present = snd_hda_codec_read(codec, 0x18, 0,
15691 AC_VERB_GET_PIN_SENSE, 0)
15692 & AC_PINSENSE_PRESENCE;
15693 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15694 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15695 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15696 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15697 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15698 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15699 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15700 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15703 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15706 switch (res >> 26) {
15707 case ALC880_HP_EVENT:
15708 alc663_m51va_speaker_automute(codec);
15710 case ALC880_MIC_EVENT:
15711 alc663_m51va_mic_automute(codec);
15716 static void alc663_m51va_inithook(struct hda_codec *codec)
15718 alc663_m51va_speaker_automute(codec);
15719 alc663_m51va_mic_automute(codec);
15722 /* ***************** Mode1 ******************************/
15723 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15726 switch (res >> 26) {
15727 case ALC880_HP_EVENT:
15728 alc663_m51va_speaker_automute(codec);
15730 case ALC880_MIC_EVENT:
15731 alc662_eeepc_mic_automute(codec);
15736 static void alc663_mode1_inithook(struct hda_codec *codec)
15738 alc663_m51va_speaker_automute(codec);
15739 alc662_eeepc_mic_automute(codec);
15741 /* ***************** Mode2 ******************************/
15742 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15745 switch (res >> 26) {
15746 case ALC880_HP_EVENT:
15747 alc662_f5z_speaker_automute(codec);
15749 case ALC880_MIC_EVENT:
15750 alc662_eeepc_mic_automute(codec);
15755 static void alc662_mode2_inithook(struct hda_codec *codec)
15757 alc662_f5z_speaker_automute(codec);
15758 alc662_eeepc_mic_automute(codec);
15760 /* ***************** Mode3 ******************************/
15761 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15764 switch (res >> 26) {
15765 case ALC880_HP_EVENT:
15766 alc663_two_hp_m1_speaker_automute(codec);
15768 case ALC880_MIC_EVENT:
15769 alc662_eeepc_mic_automute(codec);
15774 static void alc663_mode3_inithook(struct hda_codec *codec)
15776 alc663_two_hp_m1_speaker_automute(codec);
15777 alc662_eeepc_mic_automute(codec);
15779 /* ***************** Mode4 ******************************/
15780 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15783 switch (res >> 26) {
15784 case ALC880_HP_EVENT:
15785 alc663_21jd_two_speaker_automute(codec);
15787 case ALC880_MIC_EVENT:
15788 alc662_eeepc_mic_automute(codec);
15793 static void alc663_mode4_inithook(struct hda_codec *codec)
15795 alc663_21jd_two_speaker_automute(codec);
15796 alc662_eeepc_mic_automute(codec);
15798 /* ***************** Mode5 ******************************/
15799 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15802 switch (res >> 26) {
15803 case ALC880_HP_EVENT:
15804 alc663_15jd_two_speaker_automute(codec);
15806 case ALC880_MIC_EVENT:
15807 alc662_eeepc_mic_automute(codec);
15812 static void alc663_mode5_inithook(struct hda_codec *codec)
15814 alc663_15jd_two_speaker_automute(codec);
15815 alc662_eeepc_mic_automute(codec);
15817 /* ***************** Mode6 ******************************/
15818 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15821 switch (res >> 26) {
15822 case ALC880_HP_EVENT:
15823 alc663_two_hp_m2_speaker_automute(codec);
15825 case ALC880_MIC_EVENT:
15826 alc662_eeepc_mic_automute(codec);
15831 static void alc663_mode6_inithook(struct hda_codec *codec)
15833 alc663_two_hp_m2_speaker_automute(codec);
15834 alc662_eeepc_mic_automute(codec);
15837 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15839 unsigned int present;
15840 unsigned char bits;
15842 present = snd_hda_codec_read(codec, 0x21, 0,
15843 AC_VERB_GET_PIN_SENSE, 0)
15844 & AC_PINSENSE_PRESENCE;
15845 bits = present ? HDA_AMP_MUTE : 0;
15846 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15847 HDA_AMP_MUTE, bits);
15848 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15849 HDA_AMP_MUTE, bits);
15852 static void alc663_g71v_front_automute(struct hda_codec *codec)
15854 unsigned int present;
15855 unsigned char bits;
15857 present = snd_hda_codec_read(codec, 0x15, 0,
15858 AC_VERB_GET_PIN_SENSE, 0)
15859 & AC_PINSENSE_PRESENCE;
15860 bits = present ? HDA_AMP_MUTE : 0;
15861 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15862 HDA_AMP_MUTE, bits);
15865 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15868 switch (res >> 26) {
15869 case ALC880_HP_EVENT:
15870 alc663_g71v_hp_automute(codec);
15872 case ALC880_FRONT_EVENT:
15873 alc663_g71v_front_automute(codec);
15875 case ALC880_MIC_EVENT:
15876 alc662_eeepc_mic_automute(codec);
15881 static void alc663_g71v_inithook(struct hda_codec *codec)
15883 alc663_g71v_front_automute(codec);
15884 alc663_g71v_hp_automute(codec);
15885 alc662_eeepc_mic_automute(codec);
15888 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15891 switch (res >> 26) {
15892 case ALC880_HP_EVENT:
15893 alc663_m51va_speaker_automute(codec);
15895 case ALC880_MIC_EVENT:
15896 alc662_eeepc_mic_automute(codec);
15901 static void alc663_g50v_inithook(struct hda_codec *codec)
15903 alc663_m51va_speaker_automute(codec);
15904 alc662_eeepc_mic_automute(codec);
15907 /* bind hp and internal speaker mute (with plug check) */
15908 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15909 struct snd_ctl_elem_value *ucontrol)
15911 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15912 long *valp = ucontrol->value.integer.value;
15915 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15917 valp[0] ? 0 : HDA_AMP_MUTE);
15918 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15920 valp[1] ? 0 : HDA_AMP_MUTE);
15922 alc262_hippo1_automute(codec);
15926 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15927 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15930 .name = "Master Playback Switch",
15931 .info = snd_hda_mixer_amp_switch_info,
15932 .get = snd_hda_mixer_amp_switch_get,
15933 .put = alc662_ecs_master_sw_put,
15934 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15937 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15938 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15939 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15941 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15942 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15943 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15947 #ifdef CONFIG_SND_HDA_POWER_SAVE
15948 #define alc662_loopbacks alc880_loopbacks
15952 /* pcm configuration: identiacal with ALC880 */
15953 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15954 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15955 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15956 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15959 * configuration and preset
15961 static const char *alc662_models[ALC662_MODEL_LAST] = {
15962 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15963 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15964 [ALC662_3ST_6ch] = "3stack-6ch",
15965 [ALC662_5ST_DIG] = "6stack-dig",
15966 [ALC662_LENOVO_101E] = "lenovo-101e",
15967 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15968 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15969 [ALC662_ECS] = "ecs",
15970 [ALC663_ASUS_M51VA] = "m51va",
15971 [ALC663_ASUS_G71V] = "g71v",
15972 [ALC663_ASUS_H13] = "h13",
15973 [ALC663_ASUS_G50V] = "g50v",
15974 [ALC663_ASUS_MODE1] = "asus-mode1",
15975 [ALC662_ASUS_MODE2] = "asus-mode2",
15976 [ALC663_ASUS_MODE3] = "asus-mode3",
15977 [ALC663_ASUS_MODE4] = "asus-mode4",
15978 [ALC663_ASUS_MODE5] = "asus-mode5",
15979 [ALC663_ASUS_MODE6] = "asus-mode6",
15980 [ALC662_AUTO] = "auto",
15983 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15984 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15985 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15986 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15987 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15988 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15989 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15990 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15991 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15992 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15993 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15994 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15995 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15996 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15997 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15998 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15999 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16000 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16001 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16002 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16003 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16004 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16005 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16006 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16007 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16008 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16009 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16010 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16011 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16012 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16013 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16014 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16015 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16016 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16017 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16018 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16019 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16020 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16021 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16022 ALC662_3ST_6ch_DIG),
16023 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16024 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16025 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16026 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16027 ALC662_3ST_6ch_DIG),
16028 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16029 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16030 ALC662_3ST_6ch_DIG),
16031 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
16032 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
16033 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
16037 static struct alc_config_preset alc662_presets[] = {
16038 [ALC662_3ST_2ch_DIG] = {
16039 .mixers = { alc662_3ST_2ch_mixer },
16040 .init_verbs = { alc662_init_verbs },
16041 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16042 .dac_nids = alc662_dac_nids,
16043 .dig_out_nid = ALC662_DIGOUT_NID,
16044 .dig_in_nid = ALC662_DIGIN_NID,
16045 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16046 .channel_mode = alc662_3ST_2ch_modes,
16047 .input_mux = &alc662_capture_source,
16049 [ALC662_3ST_6ch_DIG] = {
16050 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16051 .init_verbs = { alc662_init_verbs },
16052 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16053 .dac_nids = alc662_dac_nids,
16054 .dig_out_nid = ALC662_DIGOUT_NID,
16055 .dig_in_nid = ALC662_DIGIN_NID,
16056 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16057 .channel_mode = alc662_3ST_6ch_modes,
16059 .input_mux = &alc662_capture_source,
16061 [ALC662_3ST_6ch] = {
16062 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16063 .init_verbs = { alc662_init_verbs },
16064 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16065 .dac_nids = alc662_dac_nids,
16066 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16067 .channel_mode = alc662_3ST_6ch_modes,
16069 .input_mux = &alc662_capture_source,
16071 [ALC662_5ST_DIG] = {
16072 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16073 .init_verbs = { alc662_init_verbs },
16074 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16075 .dac_nids = alc662_dac_nids,
16076 .dig_out_nid = ALC662_DIGOUT_NID,
16077 .dig_in_nid = ALC662_DIGIN_NID,
16078 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16079 .channel_mode = alc662_5stack_modes,
16080 .input_mux = &alc662_capture_source,
16082 [ALC662_LENOVO_101E] = {
16083 .mixers = { alc662_lenovo_101e_mixer },
16084 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16085 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16086 .dac_nids = alc662_dac_nids,
16087 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16088 .channel_mode = alc662_3ST_2ch_modes,
16089 .input_mux = &alc662_lenovo_101e_capture_source,
16090 .unsol_event = alc662_lenovo_101e_unsol_event,
16091 .init_hook = alc662_lenovo_101e_all_automute,
16093 [ALC662_ASUS_EEEPC_P701] = {
16094 .mixers = { alc662_eeepc_p701_mixer },
16095 .init_verbs = { alc662_init_verbs,
16096 alc662_eeepc_sue_init_verbs },
16097 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16098 .dac_nids = alc662_dac_nids,
16099 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16100 .channel_mode = alc662_3ST_2ch_modes,
16101 .input_mux = &alc662_eeepc_capture_source,
16102 .unsol_event = alc662_eeepc_unsol_event,
16103 .init_hook = alc662_eeepc_inithook,
16105 [ALC662_ASUS_EEEPC_EP20] = {
16106 .mixers = { alc662_eeepc_ep20_mixer,
16107 alc662_chmode_mixer },
16108 .init_verbs = { alc662_init_verbs,
16109 alc662_eeepc_ep20_sue_init_verbs },
16110 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16111 .dac_nids = alc662_dac_nids,
16112 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16113 .channel_mode = alc662_3ST_6ch_modes,
16114 .input_mux = &alc662_lenovo_101e_capture_source,
16115 .unsol_event = alc662_eeepc_ep20_unsol_event,
16116 .init_hook = alc662_eeepc_ep20_inithook,
16119 .mixers = { alc662_ecs_mixer },
16120 .init_verbs = { alc662_init_verbs,
16121 alc662_ecs_init_verbs },
16122 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16123 .dac_nids = alc662_dac_nids,
16124 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16125 .channel_mode = alc662_3ST_2ch_modes,
16126 .input_mux = &alc662_eeepc_capture_source,
16127 .unsol_event = alc662_eeepc_unsol_event,
16128 .init_hook = alc662_eeepc_inithook,
16130 [ALC663_ASUS_M51VA] = {
16131 .mixers = { alc663_m51va_mixer },
16132 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16133 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16134 .dac_nids = alc662_dac_nids,
16135 .dig_out_nid = ALC662_DIGOUT_NID,
16136 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16137 .channel_mode = alc662_3ST_2ch_modes,
16138 .input_mux = &alc663_m51va_capture_source,
16139 .unsol_event = alc663_m51va_unsol_event,
16140 .init_hook = alc663_m51va_inithook,
16142 [ALC663_ASUS_G71V] = {
16143 .mixers = { alc663_g71v_mixer },
16144 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16145 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16146 .dac_nids = alc662_dac_nids,
16147 .dig_out_nid = ALC662_DIGOUT_NID,
16148 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16149 .channel_mode = alc662_3ST_2ch_modes,
16150 .input_mux = &alc662_eeepc_capture_source,
16151 .unsol_event = alc663_g71v_unsol_event,
16152 .init_hook = alc663_g71v_inithook,
16154 [ALC663_ASUS_H13] = {
16155 .mixers = { alc663_m51va_mixer },
16156 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16157 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16158 .dac_nids = alc662_dac_nids,
16159 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16160 .channel_mode = alc662_3ST_2ch_modes,
16161 .input_mux = &alc663_m51va_capture_source,
16162 .unsol_event = alc663_m51va_unsol_event,
16163 .init_hook = alc663_m51va_inithook,
16165 [ALC663_ASUS_G50V] = {
16166 .mixers = { alc663_g50v_mixer },
16167 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16168 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16169 .dac_nids = alc662_dac_nids,
16170 .dig_out_nid = ALC662_DIGOUT_NID,
16171 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16172 .channel_mode = alc662_3ST_6ch_modes,
16173 .input_mux = &alc663_capture_source,
16174 .unsol_event = alc663_g50v_unsol_event,
16175 .init_hook = alc663_g50v_inithook,
16177 [ALC663_ASUS_MODE1] = {
16178 .mixers = { alc663_m51va_mixer },
16179 .cap_mixer = alc662_auto_capture_mixer,
16180 .init_verbs = { alc662_init_verbs,
16181 alc663_21jd_amic_init_verbs },
16182 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16184 .dac_nids = alc662_dac_nids,
16185 .dig_out_nid = ALC662_DIGOUT_NID,
16186 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16187 .channel_mode = alc662_3ST_2ch_modes,
16188 .input_mux = &alc662_eeepc_capture_source,
16189 .unsol_event = alc663_mode1_unsol_event,
16190 .init_hook = alc663_mode1_inithook,
16192 [ALC662_ASUS_MODE2] = {
16193 .mixers = { alc662_1bjd_mixer },
16194 .cap_mixer = alc662_auto_capture_mixer,
16195 .init_verbs = { alc662_init_verbs,
16196 alc662_1bjd_amic_init_verbs },
16197 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16198 .dac_nids = alc662_dac_nids,
16199 .dig_out_nid = ALC662_DIGOUT_NID,
16200 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16201 .channel_mode = alc662_3ST_2ch_modes,
16202 .input_mux = &alc662_eeepc_capture_source,
16203 .unsol_event = alc662_mode2_unsol_event,
16204 .init_hook = alc662_mode2_inithook,
16206 [ALC663_ASUS_MODE3] = {
16207 .mixers = { alc663_two_hp_m1_mixer },
16208 .cap_mixer = alc662_auto_capture_mixer,
16209 .init_verbs = { alc662_init_verbs,
16210 alc663_two_hp_amic_m1_init_verbs },
16211 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16213 .dac_nids = alc662_dac_nids,
16214 .dig_out_nid = ALC662_DIGOUT_NID,
16215 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16216 .channel_mode = alc662_3ST_2ch_modes,
16217 .input_mux = &alc662_eeepc_capture_source,
16218 .unsol_event = alc663_mode3_unsol_event,
16219 .init_hook = alc663_mode3_inithook,
16221 [ALC663_ASUS_MODE4] = {
16222 .mixers = { alc663_asus_21jd_clfe_mixer },
16223 .cap_mixer = alc662_auto_capture_mixer,
16224 .init_verbs = { alc662_init_verbs,
16225 alc663_21jd_amic_init_verbs},
16226 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16228 .dac_nids = alc662_dac_nids,
16229 .dig_out_nid = ALC662_DIGOUT_NID,
16230 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16231 .channel_mode = alc662_3ST_2ch_modes,
16232 .input_mux = &alc662_eeepc_capture_source,
16233 .unsol_event = alc663_mode4_unsol_event,
16234 .init_hook = alc663_mode4_inithook,
16236 [ALC663_ASUS_MODE5] = {
16237 .mixers = { alc663_asus_15jd_clfe_mixer },
16238 .cap_mixer = alc662_auto_capture_mixer,
16239 .init_verbs = { alc662_init_verbs,
16240 alc663_15jd_amic_init_verbs },
16241 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16243 .dac_nids = alc662_dac_nids,
16244 .dig_out_nid = ALC662_DIGOUT_NID,
16245 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16246 .channel_mode = alc662_3ST_2ch_modes,
16247 .input_mux = &alc662_eeepc_capture_source,
16248 .unsol_event = alc663_mode5_unsol_event,
16249 .init_hook = alc663_mode5_inithook,
16251 [ALC663_ASUS_MODE6] = {
16252 .mixers = { alc663_two_hp_m2_mixer },
16253 .cap_mixer = alc662_auto_capture_mixer,
16254 .init_verbs = { alc662_init_verbs,
16255 alc663_two_hp_amic_m2_init_verbs },
16256 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16258 .dac_nids = alc662_dac_nids,
16259 .dig_out_nid = ALC662_DIGOUT_NID,
16260 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16261 .channel_mode = alc662_3ST_2ch_modes,
16262 .input_mux = &alc662_eeepc_capture_source,
16263 .unsol_event = alc663_mode6_unsol_event,
16264 .init_hook = alc663_mode6_inithook,
16270 * BIOS auto configuration
16273 /* add playback controls from the parsed DAC table */
16274 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16275 const struct auto_pin_cfg *cfg)
16278 static const char *chname[4] = {
16279 "Front", "Surround", NULL /*CLFE*/, "Side"
16284 for (i = 0; i < cfg->line_outs; i++) {
16285 if (!spec->multiout.dac_nids[i])
16287 nid = alc880_idx_to_dac(i);
16290 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16291 "Center Playback Volume",
16292 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16296 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16297 "LFE Playback Volume",
16298 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16302 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16303 "Center Playback Switch",
16304 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16308 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16309 "LFE Playback Switch",
16310 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16315 sprintf(name, "%s Playback Volume", chname[i]);
16316 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16317 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16321 sprintf(name, "%s Playback Switch", chname[i]);
16322 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16323 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16332 /* add playback controls for speaker and HP outputs */
16333 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16344 /* ALC663 has a mono output pin on 0x17 */
16345 sprintf(name, "%s Playback Switch", pfx);
16346 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16347 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16351 if (alc880_is_fixed_pin(pin)) {
16352 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16353 /* printk("DAC nid=%x\n",nid); */
16354 /* specify the DAC as the extra output */
16355 if (!spec->multiout.hp_nid)
16356 spec->multiout.hp_nid = nid;
16358 spec->multiout.extra_out_nid[0] = nid;
16359 /* control HP volume/switch on the output mixer amp */
16360 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16361 sprintf(name, "%s Playback Volume", pfx);
16362 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16363 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16366 sprintf(name, "%s Playback Switch", pfx);
16367 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16368 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16371 } else if (alc880_is_multi_pin(pin)) {
16372 /* set manual connection */
16373 /* we have only a switch on HP-out PIN */
16374 sprintf(name, "%s Playback Switch", pfx);
16375 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16376 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16383 /* create playback/capture controls for input pins */
16384 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16385 const struct auto_pin_cfg *cfg)
16387 struct hda_input_mux *imux = &spec->private_imux;
16390 for (i = 0; i < AUTO_PIN_LAST; i++) {
16391 if (alc880_is_input_pin(cfg->input_pins[i])) {
16392 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16393 err = new_analog_input(spec, cfg->input_pins[i],
16394 auto_pin_cfg_labels[i],
16398 imux->items[imux->num_items].label =
16399 auto_pin_cfg_labels[i];
16400 imux->items[imux->num_items].index =
16401 alc880_input_pin_idx(cfg->input_pins[i]);
16408 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16409 hda_nid_t nid, int pin_type,
16412 alc_set_pin_output(codec, nid, pin_type);
16413 /* need the manual connection? */
16414 if (alc880_is_multi_pin(nid)) {
16415 struct alc_spec *spec = codec->spec;
16416 int idx = alc880_multi_pin_idx(nid);
16417 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16418 AC_VERB_SET_CONNECT_SEL,
16419 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16423 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16425 struct alc_spec *spec = codec->spec;
16428 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16429 for (i = 0; i <= HDA_SIDE; i++) {
16430 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16431 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16433 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16438 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16440 struct alc_spec *spec = codec->spec;
16443 pin = spec->autocfg.hp_pins[0];
16444 if (pin) /* connect to front */
16446 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16447 pin = spec->autocfg.speaker_pins[0];
16449 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16452 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16453 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16455 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16457 struct alc_spec *spec = codec->spec;
16460 for (i = 0; i < AUTO_PIN_LAST; i++) {
16461 hda_nid_t nid = spec->autocfg.input_pins[i];
16462 if (alc662_is_input_pin(nid)) {
16463 snd_hda_codec_write(codec, nid, 0,
16464 AC_VERB_SET_PIN_WIDGET_CONTROL,
16465 (i <= AUTO_PIN_FRONT_MIC ?
16466 PIN_VREF80 : PIN_IN));
16467 if (nid != ALC662_PIN_CD_NID)
16468 snd_hda_codec_write(codec, nid, 0,
16469 AC_VERB_SET_AMP_GAIN_MUTE,
16475 #define alc662_auto_init_input_src alc882_auto_init_input_src
16477 static int alc662_parse_auto_config(struct hda_codec *codec)
16479 struct alc_spec *spec = codec->spec;
16481 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16483 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16487 if (!spec->autocfg.line_outs)
16488 return 0; /* can't find valid BIOS pin config */
16490 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16493 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16496 err = alc662_auto_create_extra_out(spec,
16497 spec->autocfg.speaker_pins[0],
16501 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16505 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16509 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16511 if (spec->autocfg.dig_out_pin)
16512 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16514 if (spec->kctls.list)
16515 add_mixer(spec, spec->kctls.list);
16517 spec->num_mux_defs = 1;
16518 spec->input_mux = &spec->private_imux;
16520 add_verb(spec, alc662_auto_init_verbs);
16521 if (codec->vendor_id == 0x10ec0663)
16522 add_verb(spec, alc663_auto_init_verbs);
16524 err = alc_auto_add_mic_boost(codec);
16528 store_pin_configs(codec);
16532 /* additional initialization for auto-configuration model */
16533 static void alc662_auto_init(struct hda_codec *codec)
16535 struct alc_spec *spec = codec->spec;
16536 alc662_auto_init_multi_out(codec);
16537 alc662_auto_init_hp_out(codec);
16538 alc662_auto_init_analog_input(codec);
16539 alc662_auto_init_input_src(codec);
16540 if (spec->unsol_event)
16541 alc_inithook(codec);
16544 static int patch_alc662(struct hda_codec *codec)
16546 struct alc_spec *spec;
16547 int err, board_config;
16549 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16553 codec->spec = spec;
16555 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16557 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16560 if (board_config < 0) {
16561 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16562 "trying auto-probe from BIOS...\n");
16563 board_config = ALC662_AUTO;
16566 if (board_config == ALC662_AUTO) {
16567 /* automatic parse from the BIOS config */
16568 err = alc662_parse_auto_config(codec);
16574 "hda_codec: Cannot set up configuration "
16575 "from BIOS. Using base mode...\n");
16576 board_config = ALC662_3ST_2ch_DIG;
16580 if (board_config != ALC662_AUTO)
16581 setup_preset(spec, &alc662_presets[board_config]);
16583 if (codec->vendor_id == 0x10ec0663) {
16584 spec->stream_name_analog = "ALC663 Analog";
16585 spec->stream_name_digital = "ALC663 Digital";
16586 } else if (codec->vendor_id == 0x10ec0272) {
16587 spec->stream_name_analog = "ALC272 Analog";
16588 spec->stream_name_digital = "ALC272 Digital";
16590 spec->stream_name_analog = "ALC662 Analog";
16591 spec->stream_name_digital = "ALC662 Digital";
16594 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16595 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16597 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16598 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16600 spec->adc_nids = alc662_adc_nids;
16601 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16602 spec->capsrc_nids = alc662_capsrc_nids;
16603 spec->is_mix_capture = 1;
16605 if (!spec->cap_mixer)
16606 set_capture_mixer(spec);
16608 spec->vmaster_nid = 0x02;
16610 codec->patch_ops = alc_patch_ops;
16611 if (board_config == ALC662_AUTO)
16612 spec->init_hook = alc662_auto_init;
16613 #ifdef CONFIG_SND_HDA_POWER_SAVE
16614 if (!spec->loopback.amplist)
16615 spec->loopback.amplist = alc662_loopbacks;
16617 codec->proc_widget_hook = print_realtek_coef;
16625 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16626 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16627 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16628 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16629 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16630 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16631 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16632 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16633 .patch = patch_alc861 },
16634 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16635 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16636 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16637 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16638 .patch = patch_alc883 },
16639 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16640 .patch = patch_alc662 },
16641 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16642 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16643 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16644 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16645 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16646 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16647 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16648 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16649 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16650 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16651 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16652 .patch = patch_alc883 },
16653 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16654 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16655 {} /* terminator */
16658 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16660 MODULE_LICENSE("GPL");
16661 MODULE_DESCRIPTION("Realtek HD-audio codec");
16663 static struct hda_codec_preset_list realtek_list = {
16664 .preset = snd_hda_preset_realtek,
16665 .owner = THIS_MODULE,
16668 static int __init patch_realtek_init(void)
16670 return snd_hda_add_codec_preset(&realtek_list);
16673 static void __exit patch_realtek_exit(void)
16675 snd_hda_delete_codec_preset(&realtek_list);
16678 module_init(patch_realtek_init)
16679 module_exit(patch_realtek_exit)