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);
1046 snd_hda_codec_write(codec, 0x14, 0,
1047 AC_VERB_SET_EAPD_BTLENABLE, 2);
1048 snd_hda_codec_write(codec, 0x15, 0,
1049 AC_VERB_SET_EAPD_BTLENABLE, 2);
1052 switch (codec->vendor_id) {
1054 snd_hda_codec_write(codec, 0x1a, 0,
1055 AC_VERB_SET_COEF_INDEX, 7);
1056 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1057 AC_VERB_GET_PROC_COEF, 0);
1058 snd_hda_codec_write(codec, 0x1a, 0,
1059 AC_VERB_SET_COEF_INDEX, 7);
1060 snd_hda_codec_write(codec, 0x1a, 0,
1061 AC_VERB_SET_PROC_COEF,
1071 snd_hda_codec_write(codec, 0x20, 0,
1072 AC_VERB_SET_COEF_INDEX, 7);
1073 tmp = snd_hda_codec_read(codec, 0x20, 0,
1074 AC_VERB_GET_PROC_COEF, 0);
1075 snd_hda_codec_write(codec, 0x20, 0,
1076 AC_VERB_SET_COEF_INDEX, 7);
1077 snd_hda_codec_write(codec, 0x20, 0,
1078 AC_VERB_SET_PROC_COEF,
1082 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1086 snd_hda_codec_write(codec, 0x20, 0,
1087 AC_VERB_SET_COEF_INDEX, 7);
1088 tmp = snd_hda_codec_read(codec, 0x20, 0,
1089 AC_VERB_GET_PROC_COEF, 0);
1090 snd_hda_codec_write(codec, 0x20, 0,
1091 AC_VERB_SET_COEF_INDEX, 7);
1092 snd_hda_codec_write(codec, 0x20, 0,
1093 AC_VERB_SET_PROC_COEF,
1101 /* is laptop or Desktop and enable the function "Mute internal speaker
1102 * when the external headphone out jack is plugged"
1104 if (!(ass & 0x8000))
1107 * 10~8 : Jack location
1108 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1110 * 15 : 1 --> enable the function "Mute internal speaker
1111 * when the external headphone out jack is plugged"
1113 if (!spec->autocfg.speaker_pins[0]) {
1114 if (spec->autocfg.line_out_pins[0])
1115 spec->autocfg.speaker_pins[0] =
1116 spec->autocfg.line_out_pins[0];
1121 if (!spec->autocfg.hp_pins[0]) {
1122 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1124 spec->autocfg.hp_pins[0] = porta;
1126 spec->autocfg.hp_pins[0] = porte;
1128 spec->autocfg.hp_pins[0] = portd;
1132 if (spec->autocfg.hp_pins[0])
1133 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1134 AC_VERB_SET_UNSOLICITED_ENABLE,
1135 AC_USRSP_EN | ALC880_HP_EVENT);
1137 #if 0 /* it's broken in some acses -- temporarily disabled */
1138 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1139 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1140 snd_hda_codec_write(codec,
1141 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1142 AC_VERB_SET_UNSOLICITED_ENABLE,
1143 AC_USRSP_EN | ALC880_MIC_EVENT);
1144 #endif /* disabled */
1146 spec->unsol_event = alc_sku_unsol_event;
1150 * Fix-up pin default configurations
1158 static void alc_fix_pincfg(struct hda_codec *codec,
1159 const struct snd_pci_quirk *quirk,
1160 const struct alc_pincfg **pinfix)
1162 const struct alc_pincfg *cfg;
1164 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1168 cfg = pinfix[quirk->value];
1169 for (; cfg->nid; cfg++) {
1172 for (i = 0; i < 4; i++) {
1173 snd_hda_codec_write(codec, cfg->nid, 0,
1174 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1188 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1189 /* Mic-in jack as mic in */
1190 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1191 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1192 /* Line-in jack as Line in */
1193 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1194 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1195 /* Line-Out as Front */
1196 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1203 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1204 /* Mic-in jack as mic in */
1205 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1206 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1207 /* Line-in jack as Surround */
1208 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1209 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1210 /* Line-Out as Front */
1211 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1218 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1219 /* Mic-in jack as CLFE */
1220 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1221 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1222 /* Line-in jack as Surround */
1223 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1224 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1225 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1226 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1233 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1234 /* Mic-in jack as CLFE */
1235 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1236 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1237 /* Line-in jack as Surround */
1238 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1239 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1240 /* Line-Out as Side */
1241 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1245 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1246 { 2, alc888_4ST_ch2_intel_init },
1247 { 4, alc888_4ST_ch4_intel_init },
1248 { 6, alc888_4ST_ch6_intel_init },
1249 { 8, alc888_4ST_ch8_intel_init },
1253 * ALC888 Fujitsu Siemens Amillo xa3530
1256 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1257 /* Front Mic: set to PIN_IN (empty by default) */
1258 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1259 /* Connect Internal HP to Front */
1260 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1261 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1262 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1263 /* Connect Bass HP to Front */
1264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1266 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1267 /* Connect Line-Out side jack (SPDIF) to Side */
1268 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1269 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1270 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1271 /* Connect Mic jack to CLFE */
1272 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1273 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1274 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1275 /* Connect Line-in jack to Surround */
1276 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1277 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1278 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1279 /* Connect HP out jack to Front */
1280 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1281 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1282 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1283 /* Enable unsolicited event for HP jack and Line-out jack */
1284 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1285 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1289 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1291 unsigned int present;
1293 /* Line out presence */
1294 present = snd_hda_codec_read(codec, 0x17, 0,
1295 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1296 /* HP out presence */
1297 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1298 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1299 bits = present ? HDA_AMP_MUTE : 0;
1300 /* Toggle internal speakers muting */
1301 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1302 HDA_AMP_MUTE, bits);
1303 /* Toggle internal bass muting */
1304 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1305 HDA_AMP_MUTE, bits);
1308 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1311 if (res >> 26 == ALC880_HP_EVENT)
1312 alc888_fujitsu_xa3530_automute(codec);
1317 * ALC888 Acer Aspire 4930G model
1320 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1321 /* Front Mic: set to PIN_IN (empty by default) */
1322 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1323 /* Unselect Front Mic by default in input mixer 3 */
1324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1325 /* Enable unsolicited event for HP jack */
1326 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1327 /* Connect Internal HP to front */
1328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1329 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1330 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1331 /* Connect HP out to front */
1332 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1333 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1334 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1338 static struct hda_input_mux alc888_2_capture_sources[2] = {
1339 /* Front mic only available on one ADC */
1346 { "Front Mic", 0xb },
1359 static struct snd_kcontrol_new alc888_base_mixer[] = {
1360 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1361 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1362 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1363 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1364 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1366 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1367 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1368 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1369 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1370 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1371 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1372 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1373 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1374 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1378 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1379 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1383 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1385 unsigned int present;
1387 present = snd_hda_codec_read(codec, 0x15, 0,
1388 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1389 bits = present ? HDA_AMP_MUTE : 0;
1390 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1391 HDA_AMP_MUTE, bits);
1394 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1397 if (res >> 26 == ALC880_HP_EVENT)
1398 alc888_acer_aspire_4930g_automute(codec);
1402 * ALC880 3-stack model
1404 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1405 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1406 * F-Mic = 0x1b, HP = 0x19
1409 static hda_nid_t alc880_dac_nids[4] = {
1410 /* front, rear, clfe, rear_surr */
1411 0x02, 0x05, 0x04, 0x03
1414 static hda_nid_t alc880_adc_nids[3] = {
1419 /* The datasheet says the node 0x07 is connected from inputs,
1420 * but it shows zero connection in the real implementation on some devices.
1421 * Note: this is a 915GAV bug, fixed on 915GLV
1423 static hda_nid_t alc880_adc_nids_alt[2] = {
1428 #define ALC880_DIGOUT_NID 0x06
1429 #define ALC880_DIGIN_NID 0x0a
1431 static struct hda_input_mux alc880_capture_source = {
1435 { "Front Mic", 0x3 },
1441 /* channel source setting (2/6 channel selection for 3-stack) */
1443 static struct hda_verb alc880_threestack_ch2_init[] = {
1444 /* set line-in to input, mute it */
1445 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1446 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1447 /* set mic-in to input vref 80%, mute it */
1448 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1449 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1454 static struct hda_verb alc880_threestack_ch6_init[] = {
1455 /* set line-in to output, unmute it */
1456 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1457 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1458 /* set mic-in to output, unmute it */
1459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1464 static struct hda_channel_mode alc880_threestack_modes[2] = {
1465 { 2, alc880_threestack_ch2_init },
1466 { 6, alc880_threestack_ch6_init },
1469 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1470 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1471 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1472 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1473 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1474 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1475 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1476 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1477 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1478 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1479 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1480 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1481 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1483 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1484 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1485 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1486 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1487 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1488 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1491 .name = "Channel Mode",
1492 .info = alc_ch_mode_info,
1493 .get = alc_ch_mode_get,
1494 .put = alc_ch_mode_put,
1499 /* capture mixer elements */
1500 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1501 struct snd_ctl_elem_info *uinfo)
1503 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1504 struct alc_spec *spec = codec->spec;
1507 mutex_lock(&codec->control_mutex);
1508 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1510 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1511 mutex_unlock(&codec->control_mutex);
1515 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1516 unsigned int size, unsigned int __user *tlv)
1518 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1519 struct alc_spec *spec = codec->spec;
1522 mutex_lock(&codec->control_mutex);
1523 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1525 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1526 mutex_unlock(&codec->control_mutex);
1530 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1531 struct snd_ctl_elem_value *ucontrol);
1533 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1534 struct snd_ctl_elem_value *ucontrol,
1537 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1538 struct alc_spec *spec = codec->spec;
1539 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1542 mutex_lock(&codec->control_mutex);
1543 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1545 err = func(kcontrol, ucontrol);
1546 mutex_unlock(&codec->control_mutex);
1550 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1551 struct snd_ctl_elem_value *ucontrol)
1553 return alc_cap_getput_caller(kcontrol, ucontrol,
1554 snd_hda_mixer_amp_volume_get);
1557 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1558 struct snd_ctl_elem_value *ucontrol)
1560 return alc_cap_getput_caller(kcontrol, ucontrol,
1561 snd_hda_mixer_amp_volume_put);
1564 /* capture mixer elements */
1565 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1567 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1568 struct snd_ctl_elem_value *ucontrol)
1570 return alc_cap_getput_caller(kcontrol, ucontrol,
1571 snd_hda_mixer_amp_switch_get);
1574 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1575 struct snd_ctl_elem_value *ucontrol)
1577 return alc_cap_getput_caller(kcontrol, ucontrol,
1578 snd_hda_mixer_amp_switch_put);
1581 #define DEFINE_CAPMIX(num) \
1582 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1585 .name = "Capture Switch", \
1586 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1588 .info = alc_cap_sw_info, \
1589 .get = alc_cap_sw_get, \
1590 .put = alc_cap_sw_put, \
1593 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1594 .name = "Capture Volume", \
1595 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1596 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1597 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1599 .info = alc_cap_vol_info, \
1600 .get = alc_cap_vol_get, \
1601 .put = alc_cap_vol_put, \
1602 .tlv = { .c = alc_cap_vol_tlv }, \
1605 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1606 /* .name = "Capture Source", */ \
1607 .name = "Input Source", \
1609 .info = alc_mux_enum_info, \
1610 .get = alc_mux_enum_get, \
1611 .put = alc_mux_enum_put, \
1616 /* up to three ADCs */
1623 * ALC880 5-stack model
1625 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1627 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1628 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1631 /* additional mixers to alc880_three_stack_mixer */
1632 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1633 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1634 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1638 /* channel source setting (6/8 channel selection for 5-stack) */
1640 static struct hda_verb alc880_fivestack_ch6_init[] = {
1641 /* set line-in to input, mute it */
1642 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1643 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1648 static struct hda_verb alc880_fivestack_ch8_init[] = {
1649 /* set line-in to output, unmute it */
1650 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1651 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1655 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1656 { 6, alc880_fivestack_ch6_init },
1657 { 8, alc880_fivestack_ch8_init },
1662 * ALC880 6-stack model
1664 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1665 * Side = 0x05 (0x0f)
1666 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1667 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1670 static hda_nid_t alc880_6st_dac_nids[4] = {
1671 /* front, rear, clfe, rear_surr */
1672 0x02, 0x03, 0x04, 0x05
1675 static struct hda_input_mux alc880_6stack_capture_source = {
1679 { "Front Mic", 0x1 },
1685 /* fixed 8-channels */
1686 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1690 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1691 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1692 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1693 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1694 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1695 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1696 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1697 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1698 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1699 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1700 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1701 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1702 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1703 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1704 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1705 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1706 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1707 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1709 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1710 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1712 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1713 .name = "Channel Mode",
1714 .info = alc_ch_mode_info,
1715 .get = alc_ch_mode_get,
1716 .put = alc_ch_mode_put,
1725 * W810 has rear IO for:
1728 * Center/LFE (DAC 04)
1731 * The system also has a pair of internal speakers, and a headphone jack.
1732 * These are both connected to Line2 on the codec, hence to DAC 02.
1734 * There is a variable resistor to control the speaker or headphone
1735 * volume. This is a hardware-only device without a software API.
1737 * Plugging headphones in will disable the internal speakers. This is
1738 * implemented in hardware, not via the driver using jack sense. In
1739 * a similar fashion, plugging into the rear socket marked "front" will
1740 * disable both the speakers and headphones.
1742 * For input, there's a microphone jack, and an "audio in" jack.
1743 * These may not do anything useful with this driver yet, because I
1744 * haven't setup any initialization verbs for these yet...
1747 static hda_nid_t alc880_w810_dac_nids[3] = {
1748 /* front, rear/surround, clfe */
1752 /* fixed 6 channels */
1753 static struct hda_channel_mode alc880_w810_modes[1] = {
1757 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1758 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1759 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1760 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1761 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1762 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1763 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1764 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1766 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1767 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1775 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1776 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1780 static hda_nid_t alc880_z71v_dac_nids[1] = {
1783 #define ALC880_Z71V_HP_DAC 0x03
1785 /* fixed 2 channels */
1786 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1790 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1791 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1792 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1793 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1794 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1796 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1804 * ALC880 F1734 model
1806 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1807 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1810 static hda_nid_t alc880_f1734_dac_nids[1] = {
1813 #define ALC880_F1734_HP_DAC 0x02
1815 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1816 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1817 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1818 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1819 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1820 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1821 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1822 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1823 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1827 static struct hda_input_mux alc880_f1734_capture_source = {
1839 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1840 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1841 * Mic = 0x18, Line = 0x1a
1844 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1845 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1847 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1848 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1849 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1850 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1851 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1852 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1853 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1854 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1855 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1856 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1857 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1858 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1859 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1864 .name = "Channel Mode",
1865 .info = alc_ch_mode_info,
1866 .get = alc_ch_mode_get,
1867 .put = alc_ch_mode_put,
1873 * ALC880 ASUS W1V model
1875 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1876 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1877 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1880 /* additional mixers to alc880_asus_mixer */
1881 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1882 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1883 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1887 /* additional mixers to alc880_asus_mixer */
1888 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1889 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1890 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1895 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1897 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1899 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1900 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1903 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1904 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1909 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1910 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1911 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1912 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1913 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1914 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1915 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1916 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1917 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1918 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1919 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1920 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1921 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1922 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1924 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1926 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1927 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1930 .name = "Channel Mode",
1931 .info = alc_ch_mode_info,
1932 .get = alc_ch_mode_get,
1933 .put = alc_ch_mode_put,
1938 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1939 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1940 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1941 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1942 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1943 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1944 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1945 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1946 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1947 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1948 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1952 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1953 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1954 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1955 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1956 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1958 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1963 * virtual master controls
1967 * slave controls for virtual master
1969 static const char *alc_slave_vols[] = {
1970 "Front Playback Volume",
1971 "Surround Playback Volume",
1972 "Center Playback Volume",
1973 "LFE Playback Volume",
1974 "Side Playback Volume",
1975 "Headphone Playback Volume",
1976 "Speaker Playback Volume",
1977 "Mono Playback Volume",
1978 "Line-Out Playback Volume",
1979 "PCM Playback Volume",
1983 static const char *alc_slave_sws[] = {
1984 "Front Playback Switch",
1985 "Surround Playback Switch",
1986 "Center Playback Switch",
1987 "LFE Playback Switch",
1988 "Side Playback Switch",
1989 "Headphone Playback Switch",
1990 "Speaker Playback Switch",
1991 "Mono Playback Switch",
1992 "IEC958 Playback Switch",
1997 * build control elements
2000 static void alc_free_kctls(struct hda_codec *codec);
2002 static int alc_build_controls(struct hda_codec *codec)
2004 struct alc_spec *spec = codec->spec;
2008 for (i = 0; i < spec->num_mixers; i++) {
2009 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2013 if (spec->cap_mixer) {
2014 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2018 if (spec->multiout.dig_out_nid) {
2019 err = snd_hda_create_spdif_out_ctls(codec,
2020 spec->multiout.dig_out_nid);
2023 err = snd_hda_create_spdif_share_sw(codec,
2027 spec->multiout.share_spdif = 1;
2029 if (spec->dig_in_nid) {
2030 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2035 /* if we have no master control, let's create it */
2036 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2037 unsigned int vmaster_tlv[4];
2038 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2039 HDA_OUTPUT, vmaster_tlv);
2040 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2041 vmaster_tlv, alc_slave_vols);
2045 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2046 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2047 NULL, alc_slave_sws);
2052 alc_free_kctls(codec); /* no longer needed */
2058 * initialize the codec volumes, etc
2062 * generic initialization of ADC, input mixers and output mixers
2064 static struct hda_verb alc880_volume_init_verbs[] = {
2066 * Unmute ADC0-2 and set the default input to mic-in
2068 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2069 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2070 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2072 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2075 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2077 * Note: PASD motherboards uses the Line In 2 as the input for front
2080 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2090 * Set up output mixers (0x0c - 0x0f)
2092 /* set vol=0 to output mixers */
2093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2094 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2095 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2096 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2097 /* set up input amps for analog loopback */
2098 /* Amp Indices: DAC = 0, mixer = 1 */
2099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2100 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2101 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2102 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2104 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2106 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2112 * 3-stack pin configuration:
2113 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2115 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2117 * preset connection lists of input pins
2118 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2120 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2121 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2122 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2125 * Set pin mode and muting
2127 /* set front pin widgets 0x14 for output */
2128 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2129 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2130 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2131 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2132 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2133 /* Mic2 (as headphone out) for HP output */
2134 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2135 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2136 /* Line In pin widget for input */
2137 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2138 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2139 /* Line2 (as front mic) pin widget for input and vref at 80% */
2140 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2141 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2142 /* CD pin widget for input */
2143 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2149 * 5-stack pin configuration:
2150 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2151 * line-in/side = 0x1a, f-mic = 0x1b
2153 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2155 * preset connection lists of input pins
2156 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2158 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2159 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2162 * Set pin mode and muting
2164 /* set pin widgets 0x14-0x17 for output */
2165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2167 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2168 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2169 /* unmute pins for output (no gain on this amp) */
2170 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2172 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2173 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2175 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2176 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2177 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2178 /* Mic2 (as headphone out) for HP output */
2179 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2180 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2181 /* Line In pin widget for input */
2182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2183 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2184 /* Line2 (as front mic) pin widget for input and vref at 80% */
2185 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2187 /* CD pin widget for input */
2188 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2194 * W810 pin configuration:
2195 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2197 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2198 /* hphone/speaker input selector: front DAC */
2199 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2201 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2202 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2203 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2204 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2205 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2206 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2208 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2209 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2215 * Z71V pin configuration:
2216 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2218 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2221 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2224 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2225 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2226 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2227 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2233 * 6-stack pin configuration:
2234 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2235 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2237 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2238 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2240 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2241 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2244 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2245 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2246 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2247 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2249 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2250 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2251 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2252 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2253 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2254 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2255 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2256 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2257 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2263 * Uniwill pin configuration:
2264 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2267 static struct hda_verb alc880_uniwill_init_verbs[] = {
2268 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2274 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2275 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2276 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2277 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2282 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2283 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2285 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2286 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2287 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2289 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2290 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2291 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2292 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2293 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2295 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2296 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2303 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2305 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2306 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2311 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2312 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2313 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2314 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2315 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2321 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2323 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2324 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2325 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2326 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2328 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2329 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2334 static struct hda_verb alc880_beep_init_verbs[] = {
2335 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2339 /* toggle speaker-output according to the hp-jack state */
2340 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2342 unsigned int present;
2345 present = snd_hda_codec_read(codec, 0x14, 0,
2346 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2347 bits = present ? HDA_AMP_MUTE : 0;
2348 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2349 HDA_AMP_MUTE, bits);
2350 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2351 HDA_AMP_MUTE, bits);
2354 /* auto-toggle front mic */
2355 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2357 unsigned int present;
2360 present = snd_hda_codec_read(codec, 0x18, 0,
2361 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2362 bits = present ? HDA_AMP_MUTE : 0;
2363 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2366 static void alc880_uniwill_automute(struct hda_codec *codec)
2368 alc880_uniwill_hp_automute(codec);
2369 alc880_uniwill_mic_automute(codec);
2372 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2375 /* Looks like the unsol event is incompatible with the standard
2376 * definition. 4bit tag is placed at 28 bit!
2378 switch (res >> 28) {
2379 case ALC880_HP_EVENT:
2380 alc880_uniwill_hp_automute(codec);
2382 case ALC880_MIC_EVENT:
2383 alc880_uniwill_mic_automute(codec);
2388 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2390 unsigned int present;
2393 present = snd_hda_codec_read(codec, 0x14, 0,
2394 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2395 bits = present ? HDA_AMP_MUTE : 0;
2396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2399 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2401 unsigned int present;
2403 present = snd_hda_codec_read(codec, 0x21, 0,
2404 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2405 present &= HDA_AMP_VOLMASK;
2406 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2407 HDA_AMP_VOLMASK, present);
2408 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2409 HDA_AMP_VOLMASK, present);
2412 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2415 /* Looks like the unsol event is incompatible with the standard
2416 * definition. 4bit tag is placed at 28 bit!
2418 if ((res >> 28) == ALC880_HP_EVENT)
2419 alc880_uniwill_p53_hp_automute(codec);
2420 if ((res >> 28) == ALC880_DCVOL_EVENT)
2421 alc880_uniwill_p53_dcvol_automute(codec);
2425 * F1734 pin configuration:
2426 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2428 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2429 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2430 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2431 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2432 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2433 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2435 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2436 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2438 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2440 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2441 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2444 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2445 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2446 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2447 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2448 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2450 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2451 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2457 * ASUS pin configuration:
2458 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2460 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2461 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2462 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2463 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2464 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2467 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2469 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2472 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2475 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2477 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2478 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2479 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2481 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2482 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2483 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2488 /* Enable GPIO mask and set output */
2489 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2490 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2492 /* Clevo m520g init */
2493 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2494 /* headphone output */
2495 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2500 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2501 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2503 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2504 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2505 /* Mic1 (rear panel) */
2506 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2507 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2508 /* Mic2 (front panel) */
2509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2512 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2513 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2514 /* change to EAPD mode */
2515 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2516 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2521 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2522 /* change to EAPD mode */
2523 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2524 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2526 /* Headphone output */
2527 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2530 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2532 /* Line In pin widget for input */
2533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2534 /* CD pin widget for input */
2535 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2536 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2537 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2539 /* change to EAPD mode */
2540 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2541 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2547 * LG m1 express dual
2550 * Rear Line-In/Out (blue): 0x14
2551 * Build-in Mic-In: 0x15
2553 * HP-Out (green): 0x1b
2554 * Mic-In/Out (red): 0x19
2558 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2559 static hda_nid_t alc880_lg_dac_nids[3] = {
2563 /* seems analog CD is not working */
2564 static struct hda_input_mux alc880_lg_capture_source = {
2569 { "Internal Mic", 0x6 },
2573 /* 2,4,6 channel modes */
2574 static struct hda_verb alc880_lg_ch2_init[] = {
2575 /* set line-in and mic-in to input */
2576 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2577 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2581 static struct hda_verb alc880_lg_ch4_init[] = {
2582 /* set line-in to out and mic-in to input */
2583 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2584 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2588 static struct hda_verb alc880_lg_ch6_init[] = {
2589 /* set line-in and mic-in to output */
2590 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2591 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2595 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2596 { 2, alc880_lg_ch2_init },
2597 { 4, alc880_lg_ch4_init },
2598 { 6, alc880_lg_ch6_init },
2601 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2602 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2603 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2604 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2605 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2606 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2607 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2608 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2609 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2611 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2612 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2613 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2614 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2615 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2617 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2618 .name = "Channel Mode",
2619 .info = alc_ch_mode_info,
2620 .get = alc_ch_mode_get,
2621 .put = alc_ch_mode_put,
2626 static struct hda_verb alc880_lg_init_verbs[] = {
2627 /* set capture source to mic-in */
2628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2629 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2630 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2631 /* mute all amp mixer inputs */
2632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2635 /* line-in to input */
2636 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2637 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2642 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2643 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2644 /* mic-in to input */
2645 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2646 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2647 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2649 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2650 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2651 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2653 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2657 /* toggle speaker-output according to the hp-jack state */
2658 static void alc880_lg_automute(struct hda_codec *codec)
2660 unsigned int present;
2663 present = snd_hda_codec_read(codec, 0x1b, 0,
2664 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2665 bits = present ? HDA_AMP_MUTE : 0;
2666 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2667 HDA_AMP_MUTE, bits);
2670 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2672 /* Looks like the unsol event is incompatible with the standard
2673 * definition. 4bit tag is placed at 28 bit!
2675 if ((res >> 28) == 0x01)
2676 alc880_lg_automute(codec);
2685 * Built-in Mic-In: 0x19
2691 static struct hda_input_mux alc880_lg_lw_capture_source = {
2695 { "Internal Mic", 0x1 },
2700 #define alc880_lg_lw_modes alc880_threestack_modes
2702 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2703 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2704 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2705 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2706 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2707 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2708 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2709 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2710 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2714 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2715 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2716 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2718 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2719 .name = "Channel Mode",
2720 .info = alc_ch_mode_info,
2721 .get = alc_ch_mode_get,
2722 .put = alc_ch_mode_put,
2727 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2728 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2729 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2730 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2732 /* set capture source to mic-in */
2733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2734 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2735 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2741 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2742 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2743 /* mic-in to input */
2744 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2745 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2748 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2750 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2754 /* toggle speaker-output according to the hp-jack state */
2755 static void alc880_lg_lw_automute(struct hda_codec *codec)
2757 unsigned int present;
2760 present = snd_hda_codec_read(codec, 0x1b, 0,
2761 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2762 bits = present ? HDA_AMP_MUTE : 0;
2763 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2764 HDA_AMP_MUTE, bits);
2767 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2769 /* Looks like the unsol event is incompatible with the standard
2770 * definition. 4bit tag is placed at 28 bit!
2772 if ((res >> 28) == 0x01)
2773 alc880_lg_lw_automute(codec);
2776 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2777 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2778 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2781 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2782 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2786 static struct hda_input_mux alc880_medion_rim_capture_source = {
2790 { "Internal Mic", 0x1 },
2794 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2795 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2801 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2802 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2803 /* Mic2 (as headphone out) for HP output */
2804 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2805 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2806 /* Internal Speaker */
2807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2808 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2811 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2813 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2817 /* toggle speaker-output according to the hp-jack state */
2818 static void alc880_medion_rim_automute(struct hda_codec *codec)
2820 unsigned int present;
2823 present = snd_hda_codec_read(codec, 0x14, 0,
2824 AC_VERB_GET_PIN_SENSE, 0)
2825 & AC_PINSENSE_PRESENCE;
2826 bits = present ? HDA_AMP_MUTE : 0;
2827 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2828 HDA_AMP_MUTE, bits);
2830 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2832 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2835 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2838 /* Looks like the unsol event is incompatible with the standard
2839 * definition. 4bit tag is placed at 28 bit!
2841 if ((res >> 28) == ALC880_HP_EVENT)
2842 alc880_medion_rim_automute(codec);
2845 #ifdef CONFIG_SND_HDA_POWER_SAVE
2846 static struct hda_amp_list alc880_loopbacks[] = {
2847 { 0x0b, HDA_INPUT, 0 },
2848 { 0x0b, HDA_INPUT, 1 },
2849 { 0x0b, HDA_INPUT, 2 },
2850 { 0x0b, HDA_INPUT, 3 },
2851 { 0x0b, HDA_INPUT, 4 },
2855 static struct hda_amp_list alc880_lg_loopbacks[] = {
2856 { 0x0b, HDA_INPUT, 1 },
2857 { 0x0b, HDA_INPUT, 6 },
2858 { 0x0b, HDA_INPUT, 7 },
2867 static int alc_init(struct hda_codec *codec)
2869 struct alc_spec *spec = codec->spec;
2873 if (codec->vendor_id == 0x10ec0888)
2874 alc888_coef_init(codec);
2876 for (i = 0; i < spec->num_init_verbs; i++)
2877 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2879 if (spec->init_hook)
2880 spec->init_hook(codec);
2885 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2887 struct alc_spec *spec = codec->spec;
2889 if (spec->unsol_event)
2890 spec->unsol_event(codec, res);
2893 #ifdef CONFIG_SND_HDA_POWER_SAVE
2894 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2896 struct alc_spec *spec = codec->spec;
2897 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2902 * Analog playback callbacks
2904 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2905 struct hda_codec *codec,
2906 struct snd_pcm_substream *substream)
2908 struct alc_spec *spec = codec->spec;
2909 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2913 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2914 struct hda_codec *codec,
2915 unsigned int stream_tag,
2916 unsigned int format,
2917 struct snd_pcm_substream *substream)
2919 struct alc_spec *spec = codec->spec;
2920 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2921 stream_tag, format, substream);
2924 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2925 struct hda_codec *codec,
2926 struct snd_pcm_substream *substream)
2928 struct alc_spec *spec = codec->spec;
2929 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2935 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2936 struct hda_codec *codec,
2937 struct snd_pcm_substream *substream)
2939 struct alc_spec *spec = codec->spec;
2940 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2943 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2944 struct hda_codec *codec,
2945 unsigned int stream_tag,
2946 unsigned int format,
2947 struct snd_pcm_substream *substream)
2949 struct alc_spec *spec = codec->spec;
2950 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2951 stream_tag, format, substream);
2954 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2955 struct hda_codec *codec,
2956 struct snd_pcm_substream *substream)
2958 struct alc_spec *spec = codec->spec;
2959 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2965 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2966 struct hda_codec *codec,
2967 unsigned int stream_tag,
2968 unsigned int format,
2969 struct snd_pcm_substream *substream)
2971 struct alc_spec *spec = codec->spec;
2973 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2974 stream_tag, 0, format);
2978 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2979 struct hda_codec *codec,
2980 struct snd_pcm_substream *substream)
2982 struct alc_spec *spec = codec->spec;
2984 snd_hda_codec_cleanup_stream(codec,
2985 spec->adc_nids[substream->number + 1]);
2992 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2996 /* NID is set in alc_build_pcms */
2998 .open = alc880_playback_pcm_open,
2999 .prepare = alc880_playback_pcm_prepare,
3000 .cleanup = alc880_playback_pcm_cleanup
3004 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3008 /* NID is set in alc_build_pcms */
3011 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3015 /* NID is set in alc_build_pcms */
3018 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3019 .substreams = 2, /* can be overridden */
3022 /* NID is set in alc_build_pcms */
3024 .prepare = alc880_alt_capture_pcm_prepare,
3025 .cleanup = alc880_alt_capture_pcm_cleanup
3029 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3033 /* NID is set in alc_build_pcms */
3035 .open = alc880_dig_playback_pcm_open,
3036 .close = alc880_dig_playback_pcm_close,
3037 .prepare = alc880_dig_playback_pcm_prepare
3041 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3045 /* NID is set in alc_build_pcms */
3048 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3049 static struct hda_pcm_stream alc_pcm_null_stream = {
3055 static int alc_build_pcms(struct hda_codec *codec)
3057 struct alc_spec *spec = codec->spec;
3058 struct hda_pcm *info = spec->pcm_rec;
3061 codec->num_pcms = 1;
3062 codec->pcm_info = info;
3064 info->name = spec->stream_name_analog;
3065 if (spec->stream_analog_playback) {
3066 if (snd_BUG_ON(!spec->multiout.dac_nids))
3068 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3069 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3071 if (spec->stream_analog_capture) {
3072 if (snd_BUG_ON(!spec->adc_nids))
3074 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3075 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3078 if (spec->channel_mode) {
3079 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3080 for (i = 0; i < spec->num_channel_mode; i++) {
3081 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3082 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3087 /* SPDIF for stream index #1 */
3088 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3089 codec->num_pcms = 2;
3090 info = spec->pcm_rec + 1;
3091 info->name = spec->stream_name_digital;
3092 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3093 if (spec->multiout.dig_out_nid &&
3094 spec->stream_digital_playback) {
3095 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3096 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3098 if (spec->dig_in_nid &&
3099 spec->stream_digital_capture) {
3100 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3101 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3103 /* FIXME: do we need this for all Realtek codec models? */
3104 codec->spdif_status_reset = 1;
3107 /* If the use of more than one ADC is requested for the current
3108 * model, configure a second analog capture-only PCM.
3110 /* Additional Analaog capture for index #2 */
3111 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3112 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3113 codec->num_pcms = 3;
3114 info = spec->pcm_rec + 2;
3115 info->name = spec->stream_name_analog;
3116 if (spec->alt_dac_nid) {
3117 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3118 *spec->stream_analog_alt_playback;
3119 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3122 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3123 alc_pcm_null_stream;
3124 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3126 if (spec->num_adc_nids > 1) {
3127 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3128 *spec->stream_analog_alt_capture;
3129 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3131 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3132 spec->num_adc_nids - 1;
3134 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3135 alc_pcm_null_stream;
3136 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3143 static void alc_free_kctls(struct hda_codec *codec)
3145 struct alc_spec *spec = codec->spec;
3147 if (spec->kctls.list) {
3148 struct snd_kcontrol_new *kctl = spec->kctls.list;
3150 for (i = 0; i < spec->kctls.used; i++)
3151 kfree(kctl[i].name);
3153 snd_array_free(&spec->kctls);
3156 static void alc_free(struct hda_codec *codec)
3158 struct alc_spec *spec = codec->spec;
3163 alc_free_kctls(codec);
3165 codec->spec = NULL; /* to be sure */
3168 #ifdef SND_HDA_NEEDS_RESUME
3169 static void store_pin_configs(struct hda_codec *codec)
3171 struct alc_spec *spec = codec->spec;
3172 hda_nid_t nid, end_nid;
3174 end_nid = codec->start_nid + codec->num_nodes;
3175 for (nid = codec->start_nid; nid < end_nid; nid++) {
3176 unsigned int wid_caps = get_wcaps(codec, nid);
3177 unsigned int wid_type =
3178 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3179 if (wid_type != AC_WID_PIN)
3181 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3183 spec->pin_nids[spec->num_pins] = nid;
3184 spec->pin_cfgs[spec->num_pins] =
3185 snd_hda_codec_read(codec, nid, 0,
3186 AC_VERB_GET_CONFIG_DEFAULT, 0);
3191 static void resume_pin_configs(struct hda_codec *codec)
3193 struct alc_spec *spec = codec->spec;
3196 for (i = 0; i < spec->num_pins; i++) {
3197 hda_nid_t pin_nid = spec->pin_nids[i];
3198 unsigned int pin_config = spec->pin_cfgs[i];
3199 snd_hda_codec_write(codec, pin_nid, 0,
3200 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3201 pin_config & 0x000000ff);
3202 snd_hda_codec_write(codec, pin_nid, 0,
3203 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3204 (pin_config & 0x0000ff00) >> 8);
3205 snd_hda_codec_write(codec, pin_nid, 0,
3206 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3207 (pin_config & 0x00ff0000) >> 16);
3208 snd_hda_codec_write(codec, pin_nid, 0,
3209 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3214 static int alc_resume(struct hda_codec *codec)
3216 resume_pin_configs(codec);
3217 codec->patch_ops.init(codec);
3218 snd_hda_codec_resume_amp(codec);
3219 snd_hda_codec_resume_cache(codec);
3223 #define store_pin_configs(codec)
3228 static struct hda_codec_ops alc_patch_ops = {
3229 .build_controls = alc_build_controls,
3230 .build_pcms = alc_build_pcms,
3233 .unsol_event = alc_unsol_event,
3234 #ifdef SND_HDA_NEEDS_RESUME
3235 .resume = alc_resume,
3237 #ifdef CONFIG_SND_HDA_POWER_SAVE
3238 .check_power_status = alc_check_power_status,
3244 * Test configuration for debugging
3246 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3249 #ifdef CONFIG_SND_DEBUG
3250 static hda_nid_t alc880_test_dac_nids[4] = {
3251 0x02, 0x03, 0x04, 0x05
3254 static struct hda_input_mux alc880_test_capture_source = {
3263 { "Surround", 0x6 },
3267 static struct hda_channel_mode alc880_test_modes[4] = {
3274 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3275 struct snd_ctl_elem_info *uinfo)
3277 static char *texts[] = {
3278 "N/A", "Line Out", "HP Out",
3279 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3281 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3283 uinfo->value.enumerated.items = 8;
3284 if (uinfo->value.enumerated.item >= 8)
3285 uinfo->value.enumerated.item = 7;
3286 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3290 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3291 struct snd_ctl_elem_value *ucontrol)
3293 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3294 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3295 unsigned int pin_ctl, item = 0;
3297 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3298 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3299 if (pin_ctl & AC_PINCTL_OUT_EN) {
3300 if (pin_ctl & AC_PINCTL_HP_EN)
3304 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3305 switch (pin_ctl & AC_PINCTL_VREFEN) {
3306 case AC_PINCTL_VREF_HIZ: item = 3; break;
3307 case AC_PINCTL_VREF_50: item = 4; break;
3308 case AC_PINCTL_VREF_GRD: item = 5; break;
3309 case AC_PINCTL_VREF_80: item = 6; break;
3310 case AC_PINCTL_VREF_100: item = 7; break;
3313 ucontrol->value.enumerated.item[0] = item;
3317 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3318 struct snd_ctl_elem_value *ucontrol)
3320 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3321 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3322 static unsigned int ctls[] = {
3323 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3324 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3325 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3326 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3327 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3328 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3330 unsigned int old_ctl, new_ctl;
3332 old_ctl = snd_hda_codec_read(codec, nid, 0,
3333 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3334 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3335 if (old_ctl != new_ctl) {
3337 snd_hda_codec_write_cache(codec, nid, 0,
3338 AC_VERB_SET_PIN_WIDGET_CONTROL,
3340 val = ucontrol->value.enumerated.item[0] >= 3 ?
3342 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3349 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3350 struct snd_ctl_elem_info *uinfo)
3352 static char *texts[] = {
3353 "Front", "Surround", "CLFE", "Side"
3355 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3357 uinfo->value.enumerated.items = 4;
3358 if (uinfo->value.enumerated.item >= 4)
3359 uinfo->value.enumerated.item = 3;
3360 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3364 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3365 struct snd_ctl_elem_value *ucontrol)
3367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3368 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3371 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3372 ucontrol->value.enumerated.item[0] = sel & 3;
3376 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3377 struct snd_ctl_elem_value *ucontrol)
3379 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3380 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3383 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3384 if (ucontrol->value.enumerated.item[0] != sel) {
3385 sel = ucontrol->value.enumerated.item[0] & 3;
3386 snd_hda_codec_write_cache(codec, nid, 0,
3387 AC_VERB_SET_CONNECT_SEL, sel);
3393 #define PIN_CTL_TEST(xname,nid) { \
3394 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3396 .info = alc_test_pin_ctl_info, \
3397 .get = alc_test_pin_ctl_get, \
3398 .put = alc_test_pin_ctl_put, \
3399 .private_value = nid \
3402 #define PIN_SRC_TEST(xname,nid) { \
3403 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3405 .info = alc_test_pin_src_info, \
3406 .get = alc_test_pin_src_get, \
3407 .put = alc_test_pin_src_put, \
3408 .private_value = nid \
3411 static struct snd_kcontrol_new alc880_test_mixer[] = {
3412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3413 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3414 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3415 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3417 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3418 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3419 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3420 PIN_CTL_TEST("Front Pin Mode", 0x14),
3421 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3422 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3423 PIN_CTL_TEST("Side Pin Mode", 0x17),
3424 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3425 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3426 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3427 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3428 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3429 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3430 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3431 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3432 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3433 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3434 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3435 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3436 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3437 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3438 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3439 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3440 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3441 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3444 .name = "Channel Mode",
3445 .info = alc_ch_mode_info,
3446 .get = alc_ch_mode_get,
3447 .put = alc_ch_mode_put,
3452 static struct hda_verb alc880_test_init_verbs[] = {
3453 /* Unmute inputs of 0x0c - 0x0f */
3454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3460 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3461 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3462 /* Vol output for 0x0c-0x0f */
3463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3467 /* Set output pins 0x14-0x17 */
3468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3471 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3472 /* Unmute output pins 0x14-0x17 */
3473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3474 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3475 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3476 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3477 /* Set input pins 0x18-0x1c */
3478 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3479 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3480 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3481 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3482 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3483 /* Mute input pins 0x18-0x1b */
3484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3485 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3487 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3490 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3492 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3494 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3495 /* Analog input/passthru */
3496 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3497 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3498 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3499 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3508 static const char *alc880_models[ALC880_MODEL_LAST] = {
3509 [ALC880_3ST] = "3stack",
3510 [ALC880_TCL_S700] = "tcl",
3511 [ALC880_3ST_DIG] = "3stack-digout",
3512 [ALC880_CLEVO] = "clevo",
3513 [ALC880_5ST] = "5stack",
3514 [ALC880_5ST_DIG] = "5stack-digout",
3515 [ALC880_W810] = "w810",
3516 [ALC880_Z71V] = "z71v",
3517 [ALC880_6ST] = "6stack",
3518 [ALC880_6ST_DIG] = "6stack-digout",
3519 [ALC880_ASUS] = "asus",
3520 [ALC880_ASUS_W1V] = "asus-w1v",
3521 [ALC880_ASUS_DIG] = "asus-dig",
3522 [ALC880_ASUS_DIG2] = "asus-dig2",
3523 [ALC880_UNIWILL_DIG] = "uniwill",
3524 [ALC880_UNIWILL_P53] = "uniwill-p53",
3525 [ALC880_FUJITSU] = "fujitsu",
3526 [ALC880_F1734] = "F1734",
3528 [ALC880_LG_LW] = "lg-lw",
3529 [ALC880_MEDION_RIM] = "medion",
3530 #ifdef CONFIG_SND_DEBUG
3531 [ALC880_TEST] = "test",
3533 [ALC880_AUTO] = "auto",
3536 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3537 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3538 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3539 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3540 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3541 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3542 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3543 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3544 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3545 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3546 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3547 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3548 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3549 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3550 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3551 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3552 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3553 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3554 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3555 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3556 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3557 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3558 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3559 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3560 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3561 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3562 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3563 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3564 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3565 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3566 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3567 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3568 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3569 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3570 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3571 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3572 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3573 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3574 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3575 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3576 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3577 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3578 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3579 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3580 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3581 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3582 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3583 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3584 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3585 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3586 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3587 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3588 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3589 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3590 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3591 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3592 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3593 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3594 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3595 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3596 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3597 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3598 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3599 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3600 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3601 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3602 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3603 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3604 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3605 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3606 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3607 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3612 * ALC880 codec presets
3614 static struct alc_config_preset alc880_presets[] = {
3616 .mixers = { alc880_three_stack_mixer },
3617 .init_verbs = { alc880_volume_init_verbs,
3618 alc880_pin_3stack_init_verbs },
3619 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3620 .dac_nids = alc880_dac_nids,
3621 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3622 .channel_mode = alc880_threestack_modes,
3624 .input_mux = &alc880_capture_source,
3626 [ALC880_3ST_DIG] = {
3627 .mixers = { alc880_three_stack_mixer },
3628 .init_verbs = { alc880_volume_init_verbs,
3629 alc880_pin_3stack_init_verbs },
3630 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3631 .dac_nids = alc880_dac_nids,
3632 .dig_out_nid = ALC880_DIGOUT_NID,
3633 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3634 .channel_mode = alc880_threestack_modes,
3636 .input_mux = &alc880_capture_source,
3638 [ALC880_TCL_S700] = {
3639 .mixers = { alc880_tcl_s700_mixer },
3640 .init_verbs = { alc880_volume_init_verbs,
3641 alc880_pin_tcl_S700_init_verbs,
3642 alc880_gpio2_init_verbs },
3643 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3644 .dac_nids = alc880_dac_nids,
3645 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3646 .num_adc_nids = 1, /* single ADC */
3648 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3649 .channel_mode = alc880_2_jack_modes,
3650 .input_mux = &alc880_capture_source,
3653 .mixers = { alc880_three_stack_mixer,
3654 alc880_five_stack_mixer},
3655 .init_verbs = { alc880_volume_init_verbs,
3656 alc880_pin_5stack_init_verbs },
3657 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3658 .dac_nids = alc880_dac_nids,
3659 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3660 .channel_mode = alc880_fivestack_modes,
3661 .input_mux = &alc880_capture_source,
3663 [ALC880_5ST_DIG] = {
3664 .mixers = { alc880_three_stack_mixer,
3665 alc880_five_stack_mixer },
3666 .init_verbs = { alc880_volume_init_verbs,
3667 alc880_pin_5stack_init_verbs },
3668 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3669 .dac_nids = alc880_dac_nids,
3670 .dig_out_nid = ALC880_DIGOUT_NID,
3671 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3672 .channel_mode = alc880_fivestack_modes,
3673 .input_mux = &alc880_capture_source,
3676 .mixers = { alc880_six_stack_mixer },
3677 .init_verbs = { alc880_volume_init_verbs,
3678 alc880_pin_6stack_init_verbs },
3679 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3680 .dac_nids = alc880_6st_dac_nids,
3681 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3682 .channel_mode = alc880_sixstack_modes,
3683 .input_mux = &alc880_6stack_capture_source,
3685 [ALC880_6ST_DIG] = {
3686 .mixers = { alc880_six_stack_mixer },
3687 .init_verbs = { alc880_volume_init_verbs,
3688 alc880_pin_6stack_init_verbs },
3689 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3690 .dac_nids = alc880_6st_dac_nids,
3691 .dig_out_nid = ALC880_DIGOUT_NID,
3692 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3693 .channel_mode = alc880_sixstack_modes,
3694 .input_mux = &alc880_6stack_capture_source,
3697 .mixers = { alc880_w810_base_mixer },
3698 .init_verbs = { alc880_volume_init_verbs,
3699 alc880_pin_w810_init_verbs,
3700 alc880_gpio2_init_verbs },
3701 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3702 .dac_nids = alc880_w810_dac_nids,
3703 .dig_out_nid = ALC880_DIGOUT_NID,
3704 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3705 .channel_mode = alc880_w810_modes,
3706 .input_mux = &alc880_capture_source,
3709 .mixers = { alc880_z71v_mixer },
3710 .init_verbs = { alc880_volume_init_verbs,
3711 alc880_pin_z71v_init_verbs },
3712 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3713 .dac_nids = alc880_z71v_dac_nids,
3714 .dig_out_nid = ALC880_DIGOUT_NID,
3716 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3717 .channel_mode = alc880_2_jack_modes,
3718 .input_mux = &alc880_capture_source,
3721 .mixers = { alc880_f1734_mixer },
3722 .init_verbs = { alc880_volume_init_verbs,
3723 alc880_pin_f1734_init_verbs },
3724 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3725 .dac_nids = alc880_f1734_dac_nids,
3727 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3728 .channel_mode = alc880_2_jack_modes,
3729 .input_mux = &alc880_f1734_capture_source,
3730 .unsol_event = alc880_uniwill_p53_unsol_event,
3731 .init_hook = alc880_uniwill_p53_hp_automute,
3734 .mixers = { alc880_asus_mixer },
3735 .init_verbs = { alc880_volume_init_verbs,
3736 alc880_pin_asus_init_verbs,
3737 alc880_gpio1_init_verbs },
3738 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3739 .dac_nids = alc880_asus_dac_nids,
3740 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3741 .channel_mode = alc880_asus_modes,
3743 .input_mux = &alc880_capture_source,
3745 [ALC880_ASUS_DIG] = {
3746 .mixers = { alc880_asus_mixer },
3747 .init_verbs = { alc880_volume_init_verbs,
3748 alc880_pin_asus_init_verbs,
3749 alc880_gpio1_init_verbs },
3750 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3751 .dac_nids = alc880_asus_dac_nids,
3752 .dig_out_nid = ALC880_DIGOUT_NID,
3753 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3754 .channel_mode = alc880_asus_modes,
3756 .input_mux = &alc880_capture_source,
3758 [ALC880_ASUS_DIG2] = {
3759 .mixers = { alc880_asus_mixer },
3760 .init_verbs = { alc880_volume_init_verbs,
3761 alc880_pin_asus_init_verbs,
3762 alc880_gpio2_init_verbs }, /* use GPIO2 */
3763 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3764 .dac_nids = alc880_asus_dac_nids,
3765 .dig_out_nid = ALC880_DIGOUT_NID,
3766 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3767 .channel_mode = alc880_asus_modes,
3769 .input_mux = &alc880_capture_source,
3771 [ALC880_ASUS_W1V] = {
3772 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3773 .init_verbs = { alc880_volume_init_verbs,
3774 alc880_pin_asus_init_verbs,
3775 alc880_gpio1_init_verbs },
3776 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3777 .dac_nids = alc880_asus_dac_nids,
3778 .dig_out_nid = ALC880_DIGOUT_NID,
3779 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3780 .channel_mode = alc880_asus_modes,
3782 .input_mux = &alc880_capture_source,
3784 [ALC880_UNIWILL_DIG] = {
3785 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3786 .init_verbs = { alc880_volume_init_verbs,
3787 alc880_pin_asus_init_verbs },
3788 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3789 .dac_nids = alc880_asus_dac_nids,
3790 .dig_out_nid = ALC880_DIGOUT_NID,
3791 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3792 .channel_mode = alc880_asus_modes,
3794 .input_mux = &alc880_capture_source,
3796 [ALC880_UNIWILL] = {
3797 .mixers = { alc880_uniwill_mixer },
3798 .init_verbs = { alc880_volume_init_verbs,
3799 alc880_uniwill_init_verbs },
3800 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3801 .dac_nids = alc880_asus_dac_nids,
3802 .dig_out_nid = ALC880_DIGOUT_NID,
3803 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3804 .channel_mode = alc880_threestack_modes,
3806 .input_mux = &alc880_capture_source,
3807 .unsol_event = alc880_uniwill_unsol_event,
3808 .init_hook = alc880_uniwill_automute,
3810 [ALC880_UNIWILL_P53] = {
3811 .mixers = { alc880_uniwill_p53_mixer },
3812 .init_verbs = { alc880_volume_init_verbs,
3813 alc880_uniwill_p53_init_verbs },
3814 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3815 .dac_nids = alc880_asus_dac_nids,
3816 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3817 .channel_mode = alc880_threestack_modes,
3818 .input_mux = &alc880_capture_source,
3819 .unsol_event = alc880_uniwill_p53_unsol_event,
3820 .init_hook = alc880_uniwill_p53_hp_automute,
3822 [ALC880_FUJITSU] = {
3823 .mixers = { alc880_fujitsu_mixer,
3824 alc880_pcbeep_mixer, },
3825 .init_verbs = { alc880_volume_init_verbs,
3826 alc880_uniwill_p53_init_verbs,
3827 alc880_beep_init_verbs },
3828 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3829 .dac_nids = alc880_dac_nids,
3830 .dig_out_nid = ALC880_DIGOUT_NID,
3831 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3832 .channel_mode = alc880_2_jack_modes,
3833 .input_mux = &alc880_capture_source,
3834 .unsol_event = alc880_uniwill_p53_unsol_event,
3835 .init_hook = alc880_uniwill_p53_hp_automute,
3838 .mixers = { alc880_three_stack_mixer },
3839 .init_verbs = { alc880_volume_init_verbs,
3840 alc880_pin_clevo_init_verbs },
3841 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3842 .dac_nids = alc880_dac_nids,
3844 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3845 .channel_mode = alc880_threestack_modes,
3847 .input_mux = &alc880_capture_source,
3850 .mixers = { alc880_lg_mixer },
3851 .init_verbs = { alc880_volume_init_verbs,
3852 alc880_lg_init_verbs },
3853 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3854 .dac_nids = alc880_lg_dac_nids,
3855 .dig_out_nid = ALC880_DIGOUT_NID,
3856 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3857 .channel_mode = alc880_lg_ch_modes,
3859 .input_mux = &alc880_lg_capture_source,
3860 .unsol_event = alc880_lg_unsol_event,
3861 .init_hook = alc880_lg_automute,
3862 #ifdef CONFIG_SND_HDA_POWER_SAVE
3863 .loopbacks = alc880_lg_loopbacks,
3867 .mixers = { alc880_lg_lw_mixer },
3868 .init_verbs = { alc880_volume_init_verbs,
3869 alc880_lg_lw_init_verbs },
3870 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3871 .dac_nids = alc880_dac_nids,
3872 .dig_out_nid = ALC880_DIGOUT_NID,
3873 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3874 .channel_mode = alc880_lg_lw_modes,
3875 .input_mux = &alc880_lg_lw_capture_source,
3876 .unsol_event = alc880_lg_lw_unsol_event,
3877 .init_hook = alc880_lg_lw_automute,
3879 [ALC880_MEDION_RIM] = {
3880 .mixers = { alc880_medion_rim_mixer },
3881 .init_verbs = { alc880_volume_init_verbs,
3882 alc880_medion_rim_init_verbs,
3883 alc_gpio2_init_verbs },
3884 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3885 .dac_nids = alc880_dac_nids,
3886 .dig_out_nid = ALC880_DIGOUT_NID,
3887 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3888 .channel_mode = alc880_2_jack_modes,
3889 .input_mux = &alc880_medion_rim_capture_source,
3890 .unsol_event = alc880_medion_rim_unsol_event,
3891 .init_hook = alc880_medion_rim_automute,
3893 #ifdef CONFIG_SND_DEBUG
3895 .mixers = { alc880_test_mixer },
3896 .init_verbs = { alc880_test_init_verbs },
3897 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3898 .dac_nids = alc880_test_dac_nids,
3899 .dig_out_nid = ALC880_DIGOUT_NID,
3900 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3901 .channel_mode = alc880_test_modes,
3902 .input_mux = &alc880_test_capture_source,
3908 * Automatic parse of I/O pins from the BIOS configuration
3913 ALC_CTL_WIDGET_MUTE,
3916 static struct snd_kcontrol_new alc880_control_templates[] = {
3917 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3918 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3919 HDA_BIND_MUTE(NULL, 0, 0, 0),
3922 /* add dynamic controls */
3923 static int add_control(struct alc_spec *spec, int type, const char *name,
3926 struct snd_kcontrol_new *knew;
3928 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3929 knew = snd_array_new(&spec->kctls);
3932 *knew = alc880_control_templates[type];
3933 knew->name = kstrdup(name, GFP_KERNEL);
3936 knew->private_value = val;
3940 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3941 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3942 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3943 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3944 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3945 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3946 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3947 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3948 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3949 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3950 #define ALC880_PIN_CD_NID 0x1c
3952 /* fill in the dac_nids table from the parsed pin configuration */
3953 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3954 const struct auto_pin_cfg *cfg)
3960 memset(assigned, 0, sizeof(assigned));
3961 spec->multiout.dac_nids = spec->private_dac_nids;
3963 /* check the pins hardwired to audio widget */
3964 for (i = 0; i < cfg->line_outs; i++) {
3965 nid = cfg->line_out_pins[i];
3966 if (alc880_is_fixed_pin(nid)) {
3967 int idx = alc880_fixed_pin_idx(nid);
3968 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3972 /* left pins can be connect to any audio widget */
3973 for (i = 0; i < cfg->line_outs; i++) {
3974 nid = cfg->line_out_pins[i];
3975 if (alc880_is_fixed_pin(nid))
3977 /* search for an empty channel */
3978 for (j = 0; j < cfg->line_outs; j++) {
3980 spec->multiout.dac_nids[i] =
3981 alc880_idx_to_dac(j);
3987 spec->multiout.num_dacs = cfg->line_outs;
3991 /* add playback controls from the parsed DAC table */
3992 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3993 const struct auto_pin_cfg *cfg)
3996 static const char *chname[4] = {
3997 "Front", "Surround", NULL /*CLFE*/, "Side"
4002 for (i = 0; i < cfg->line_outs; i++) {
4003 if (!spec->multiout.dac_nids[i])
4005 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4008 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4009 "Center Playback Volume",
4010 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4014 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4015 "LFE Playback Volume",
4016 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4020 err = add_control(spec, ALC_CTL_BIND_MUTE,
4021 "Center Playback Switch",
4022 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4026 err = add_control(spec, ALC_CTL_BIND_MUTE,
4027 "LFE Playback Switch",
4028 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4033 sprintf(name, "%s Playback Volume", chname[i]);
4034 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4035 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4039 sprintf(name, "%s Playback Switch", chname[i]);
4040 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4041 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4050 /* add playback controls for speaker and HP outputs */
4051 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4061 if (alc880_is_fixed_pin(pin)) {
4062 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4063 /* specify the DAC as the extra output */
4064 if (!spec->multiout.hp_nid)
4065 spec->multiout.hp_nid = nid;
4067 spec->multiout.extra_out_nid[0] = nid;
4068 /* control HP volume/switch on the output mixer amp */
4069 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4070 sprintf(name, "%s Playback Volume", pfx);
4071 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4072 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4075 sprintf(name, "%s Playback Switch", pfx);
4076 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4077 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4080 } else if (alc880_is_multi_pin(pin)) {
4081 /* set manual connection */
4082 /* we have only a switch on HP-out PIN */
4083 sprintf(name, "%s Playback Switch", pfx);
4084 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4085 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4092 /* create input playback/capture controls for the given pin */
4093 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4094 const char *ctlname,
4095 int idx, hda_nid_t mix_nid)
4100 sprintf(name, "%s Playback Volume", ctlname);
4101 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4102 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4105 sprintf(name, "%s Playback Switch", ctlname);
4106 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4107 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4113 /* create playback/capture controls for input pins */
4114 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4115 const struct auto_pin_cfg *cfg)
4117 struct hda_input_mux *imux = &spec->private_imux;
4120 for (i = 0; i < AUTO_PIN_LAST; i++) {
4121 if (alc880_is_input_pin(cfg->input_pins[i])) {
4122 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4123 err = new_analog_input(spec, cfg->input_pins[i],
4124 auto_pin_cfg_labels[i],
4128 imux->items[imux->num_items].label =
4129 auto_pin_cfg_labels[i];
4130 imux->items[imux->num_items].index =
4131 alc880_input_pin_idx(cfg->input_pins[i]);
4138 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4139 unsigned int pin_type)
4141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4144 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4148 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4149 hda_nid_t nid, int pin_type,
4152 alc_set_pin_output(codec, nid, pin_type);
4153 /* need the manual connection? */
4154 if (alc880_is_multi_pin(nid)) {
4155 struct alc_spec *spec = codec->spec;
4156 int idx = alc880_multi_pin_idx(nid);
4157 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4158 AC_VERB_SET_CONNECT_SEL,
4159 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4163 static int get_pin_type(int line_out_type)
4165 if (line_out_type == AUTO_PIN_HP_OUT)
4171 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4173 struct alc_spec *spec = codec->spec;
4176 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4177 for (i = 0; i < spec->autocfg.line_outs; i++) {
4178 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4179 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4180 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4184 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4186 struct alc_spec *spec = codec->spec;
4189 pin = spec->autocfg.speaker_pins[0];
4190 if (pin) /* connect to front */
4191 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4192 pin = spec->autocfg.hp_pins[0];
4193 if (pin) /* connect to front */
4194 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4197 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4199 struct alc_spec *spec = codec->spec;
4202 for (i = 0; i < AUTO_PIN_LAST; i++) {
4203 hda_nid_t nid = spec->autocfg.input_pins[i];
4204 if (alc880_is_input_pin(nid)) {
4205 snd_hda_codec_write(codec, nid, 0,
4206 AC_VERB_SET_PIN_WIDGET_CONTROL,
4207 i <= AUTO_PIN_FRONT_MIC ?
4208 PIN_VREF80 : PIN_IN);
4209 if (nid != ALC880_PIN_CD_NID)
4210 snd_hda_codec_write(codec, nid, 0,
4211 AC_VERB_SET_AMP_GAIN_MUTE,
4217 /* parse the BIOS configuration and set up the alc_spec */
4218 /* return 1 if successful, 0 if the proper config is not found,
4219 * or a negative error code
4221 static int alc880_parse_auto_config(struct hda_codec *codec)
4223 struct alc_spec *spec = codec->spec;
4225 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4227 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4231 if (!spec->autocfg.line_outs)
4232 return 0; /* can't find valid BIOS pin config */
4234 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4237 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4240 err = alc880_auto_create_extra_out(spec,
4241 spec->autocfg.speaker_pins[0],
4245 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4249 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4253 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4255 if (spec->autocfg.dig_out_pin)
4256 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4257 if (spec->autocfg.dig_in_pin)
4258 spec->dig_in_nid = ALC880_DIGIN_NID;
4260 if (spec->kctls.list)
4261 add_mixer(spec, spec->kctls.list);
4263 add_verb(spec, alc880_volume_init_verbs);
4265 spec->num_mux_defs = 1;
4266 spec->input_mux = &spec->private_imux;
4268 store_pin_configs(codec);
4272 /* additional initialization for auto-configuration model */
4273 static void alc880_auto_init(struct hda_codec *codec)
4275 struct alc_spec *spec = codec->spec;
4276 alc880_auto_init_multi_out(codec);
4277 alc880_auto_init_extra_out(codec);
4278 alc880_auto_init_analog_input(codec);
4279 if (spec->unsol_event)
4280 alc_inithook(codec);
4284 * OK, here we have finally the patch for ALC880
4287 static void set_capture_mixer(struct alc_spec *spec)
4289 static struct snd_kcontrol_new *caps[3] = {
4294 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4295 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4298 static int patch_alc880(struct hda_codec *codec)
4300 struct alc_spec *spec;
4304 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4310 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4313 if (board_config < 0) {
4314 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4315 "trying auto-probe from BIOS...\n");
4316 board_config = ALC880_AUTO;
4319 if (board_config == ALC880_AUTO) {
4320 /* automatic parse from the BIOS config */
4321 err = alc880_parse_auto_config(codec);
4327 "hda_codec: Cannot set up configuration "
4328 "from BIOS. Using 3-stack mode...\n");
4329 board_config = ALC880_3ST;
4333 if (board_config != ALC880_AUTO)
4334 setup_preset(spec, &alc880_presets[board_config]);
4336 spec->stream_name_analog = "ALC880 Analog";
4337 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4338 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4339 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4341 spec->stream_name_digital = "ALC880 Digital";
4342 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4343 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4345 if (!spec->adc_nids && spec->input_mux) {
4346 /* check whether NID 0x07 is valid */
4347 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4349 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4350 if (wcap != AC_WID_AUD_IN) {
4351 spec->adc_nids = alc880_adc_nids_alt;
4352 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4354 spec->adc_nids = alc880_adc_nids;
4355 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4358 set_capture_mixer(spec);
4360 spec->vmaster_nid = 0x0c;
4362 codec->patch_ops = alc_patch_ops;
4363 if (board_config == ALC880_AUTO)
4364 spec->init_hook = alc880_auto_init;
4365 #ifdef CONFIG_SND_HDA_POWER_SAVE
4366 if (!spec->loopback.amplist)
4367 spec->loopback.amplist = alc880_loopbacks;
4369 codec->proc_widget_hook = print_realtek_coef;
4379 static hda_nid_t alc260_dac_nids[1] = {
4384 static hda_nid_t alc260_adc_nids[1] = {
4389 static hda_nid_t alc260_adc_nids_alt[1] = {
4394 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4395 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4397 static hda_nid_t alc260_dual_adc_nids[2] = {
4402 #define ALC260_DIGOUT_NID 0x03
4403 #define ALC260_DIGIN_NID 0x06
4405 static struct hda_input_mux alc260_capture_source = {
4409 { "Front Mic", 0x1 },
4415 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4416 * headphone jack and the internal CD lines since these are the only pins at
4417 * which audio can appear. For flexibility, also allow the option of
4418 * recording the mixer output on the second ADC (ADC0 doesn't have a
4419 * connection to the mixer output).
4421 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4425 { "Mic/Line", 0x0 },
4427 { "Headphone", 0x2 },
4433 { "Mic/Line", 0x0 },
4435 { "Headphone", 0x2 },
4442 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4443 * the Fujitsu S702x, but jacks are marked differently.
4445 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4452 { "Headphone", 0x5 },
4461 { "Headphone", 0x6 },
4467 * This is just place-holder, so there's something for alc_build_pcms to look
4468 * at when it calculates the maximum number of channels. ALC260 has no mixer
4469 * element which allows changing the channel mode, so the verb list is
4472 static struct hda_channel_mode alc260_modes[1] = {
4477 /* Mixer combinations
4479 * basic: base_output + input + pc_beep + capture
4480 * HP: base_output + input + capture_alt
4481 * HP_3013: hp_3013 + input + capture
4482 * fujitsu: fujitsu + capture
4483 * acer: acer + capture
4486 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4487 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4488 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4489 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4490 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4491 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4492 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4496 static struct snd_kcontrol_new alc260_input_mixer[] = {
4497 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4498 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4499 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4500 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4502 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4508 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4509 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4510 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4514 /* update HP, line and mono out pins according to the master switch */
4515 static void alc260_hp_master_update(struct hda_codec *codec,
4516 hda_nid_t hp, hda_nid_t line,
4519 struct alc_spec *spec = codec->spec;
4520 unsigned int val = spec->master_sw ? PIN_HP : 0;
4521 /* change HP and line-out pins */
4522 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4524 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4526 /* mono (speaker) depending on the HP jack sense */
4527 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4528 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4532 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4533 struct snd_ctl_elem_value *ucontrol)
4535 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4536 struct alc_spec *spec = codec->spec;
4537 *ucontrol->value.integer.value = spec->master_sw;
4541 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4542 struct snd_ctl_elem_value *ucontrol)
4544 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4545 struct alc_spec *spec = codec->spec;
4546 int val = !!*ucontrol->value.integer.value;
4547 hda_nid_t hp, line, mono;
4549 if (val == spec->master_sw)
4551 spec->master_sw = val;
4552 hp = (kcontrol->private_value >> 16) & 0xff;
4553 line = (kcontrol->private_value >> 8) & 0xff;
4554 mono = kcontrol->private_value & 0xff;
4555 alc260_hp_master_update(codec, hp, line, mono);
4559 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4562 .name = "Master Playback Switch",
4563 .info = snd_ctl_boolean_mono_info,
4564 .get = alc260_hp_master_sw_get,
4565 .put = alc260_hp_master_sw_put,
4566 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4568 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4569 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4570 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4571 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4572 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4574 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4578 static struct hda_verb alc260_hp_unsol_verbs[] = {
4579 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4583 static void alc260_hp_automute(struct hda_codec *codec)
4585 struct alc_spec *spec = codec->spec;
4586 unsigned int present;
4588 present = snd_hda_codec_read(codec, 0x10, 0,
4589 AC_VERB_GET_PIN_SENSE, 0);
4590 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4591 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4594 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4596 if ((res >> 26) == ALC880_HP_EVENT)
4597 alc260_hp_automute(codec);
4600 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4602 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4603 .name = "Master Playback Switch",
4604 .info = snd_ctl_boolean_mono_info,
4605 .get = alc260_hp_master_sw_get,
4606 .put = alc260_hp_master_sw_put,
4607 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4609 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4610 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4611 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4612 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4613 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4614 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4615 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4616 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4620 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4621 .ops = &snd_hda_bind_vol,
4623 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4624 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4625 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4630 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4631 .ops = &snd_hda_bind_sw,
4633 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4634 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4639 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4640 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4641 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4642 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4643 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4647 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4648 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4652 static void alc260_hp_3013_automute(struct hda_codec *codec)
4654 struct alc_spec *spec = codec->spec;
4655 unsigned int present;
4657 present = snd_hda_codec_read(codec, 0x15, 0,
4658 AC_VERB_GET_PIN_SENSE, 0);
4659 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4660 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4663 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4666 if ((res >> 26) == ALC880_HP_EVENT)
4667 alc260_hp_3013_automute(codec);
4670 static void alc260_hp_3012_automute(struct hda_codec *codec)
4672 unsigned int present, bits;
4674 present = snd_hda_codec_read(codec, 0x10, 0,
4675 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4677 bits = present ? 0 : PIN_OUT;
4678 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4680 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4682 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4686 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4689 if ((res >> 26) == ALC880_HP_EVENT)
4690 alc260_hp_3012_automute(codec);
4693 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4694 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4696 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4697 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4698 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4699 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4700 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4701 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4702 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4703 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4704 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4705 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4706 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4707 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4708 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4712 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4713 * versions of the ALC260 don't act on requests to enable mic bias from NID
4714 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4715 * datasheet doesn't mention this restriction. At this stage it's not clear
4716 * whether this behaviour is intentional or is a hardware bug in chip
4717 * revisions available in early 2006. Therefore for now allow the
4718 * "Headphone Jack Mode" control to span all choices, but if it turns out
4719 * that the lack of mic bias for this NID is intentional we could change the
4720 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4722 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4723 * don't appear to make the mic bias available from the "line" jack, even
4724 * though the NID used for this jack (0x14) can supply it. The theory is
4725 * that perhaps Acer have included blocking capacitors between the ALC260
4726 * and the output jack. If this turns out to be the case for all such
4727 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4728 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4730 * The C20x Tablet series have a mono internal speaker which is controlled
4731 * via the chip's Mono sum widget and pin complex, so include the necessary
4732 * controls for such models. On models without a "mono speaker" the control
4733 * won't do anything.
4735 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4736 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4737 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4738 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4739 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4741 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4743 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4744 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4746 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4747 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4748 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4749 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4750 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4751 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4752 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4756 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4757 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4759 static struct snd_kcontrol_new alc260_will_mixer[] = {
4760 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4761 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4762 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4763 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4764 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4765 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4766 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4767 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4768 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4769 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4770 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4771 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4775 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4776 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4778 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4779 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4780 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4782 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4783 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4784 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4785 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4786 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4787 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4788 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4793 * initialization verbs
4795 static struct hda_verb alc260_init_verbs[] = {
4796 /* Line In pin widget for input */
4797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4798 /* CD pin widget for input */
4799 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4800 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4801 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4802 /* Mic2 (front panel) pin widget for input and vref at 80% */
4803 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4804 /* LINE-2 is used for line-out in rear */
4805 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4806 /* select line-out */
4807 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4809 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4811 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4813 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4814 /* mute capture amp left and right */
4815 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4816 /* set connection select to line in (default select for this ADC) */
4817 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4818 /* mute capture amp left and right */
4819 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4820 /* set connection select to line in (default select for this ADC) */
4821 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4822 /* set vol=0 Line-Out mixer amp left and right */
4823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4824 /* unmute pin widget amp left and right (no gain on this amp) */
4825 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4826 /* set vol=0 HP mixer amp left and right */
4827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4828 /* unmute pin widget amp left and right (no gain on this amp) */
4829 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4830 /* set vol=0 Mono mixer amp left and right */
4831 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4832 /* unmute pin widget amp left and right (no gain on this amp) */
4833 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4834 /* unmute LINE-2 out pin */
4835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4836 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4839 /* mute analog inputs */
4840 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4845 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4846 /* mute Front out path */
4847 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4848 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4849 /* mute Headphone out path */
4850 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4851 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4852 /* mute Mono out path */
4853 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4854 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4858 #if 0 /* should be identical with alc260_init_verbs? */
4859 static struct hda_verb alc260_hp_init_verbs[] = {
4860 /* Headphone and output */
4861 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4863 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4864 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4865 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4866 /* Mic2 (front panel) pin widget for input and vref at 80% */
4867 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4868 /* Line In pin widget for input */
4869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4870 /* Line-2 pin widget for output */
4871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4872 /* CD pin widget for input */
4873 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4874 /* unmute amp left and right */
4875 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4876 /* set connection select to line in (default select for this ADC) */
4877 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4878 /* unmute Line-Out mixer amp left and right (volume = 0) */
4879 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4880 /* mute pin widget amp left and right (no gain on this amp) */
4881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4882 /* unmute HP mixer amp left and right (volume = 0) */
4883 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4884 /* mute pin widget amp left and right (no gain on this amp) */
4885 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4886 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4889 /* mute analog inputs */
4890 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4891 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4893 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4895 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4896 /* Unmute Front out path */
4897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4898 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4899 /* Unmute Headphone out path */
4900 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4901 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4902 /* Unmute Mono out path */
4903 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4904 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4909 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4910 /* Line out and output */
4911 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4913 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4914 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4915 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4916 /* Mic2 (front panel) pin widget for input and vref at 80% */
4917 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4918 /* Line In pin widget for input */
4919 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4920 /* Headphone pin widget for output */
4921 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4922 /* CD pin widget for input */
4923 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4924 /* unmute amp left and right */
4925 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4926 /* set connection select to line in (default select for this ADC) */
4927 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4928 /* unmute Line-Out mixer amp left and right (volume = 0) */
4929 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4930 /* mute pin widget amp left and right (no gain on this amp) */
4931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4932 /* unmute HP mixer amp left and right (volume = 0) */
4933 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4934 /* mute pin widget amp left and right (no gain on this amp) */
4935 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4936 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4939 /* mute analog inputs */
4940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4944 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4945 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4946 /* Unmute Front out path */
4947 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4948 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4949 /* Unmute Headphone out path */
4950 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4951 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4952 /* Unmute Mono out path */
4953 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4954 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4958 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4959 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4960 * audio = 0x16, internal speaker = 0x10.
4962 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4963 /* Disable all GPIOs */
4964 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4965 /* Internal speaker is connected to headphone pin */
4966 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4967 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4968 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4969 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4970 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4971 /* Ensure all other unused pins are disabled and muted. */
4972 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4973 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4974 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4975 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4976 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4977 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4981 /* Disable digital (SPDIF) pins */
4982 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4983 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4985 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4986 * when acting as an output.
4988 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4990 /* Start with output sum widgets muted and their output gains at min */
4991 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4992 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4993 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4995 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4997 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4998 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4999 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5001 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5002 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5003 /* Unmute Line1 pin widget output buffer since it starts as an output.
5004 * If the pin mode is changed by the user the pin mode control will
5005 * take care of enabling the pin's input/output buffers as needed.
5006 * Therefore there's no need to enable the input buffer at this
5009 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5010 /* Unmute input buffer of pin widget used for Line-in (no equiv
5013 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5015 /* Mute capture amp left and right */
5016 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5017 /* Set ADC connection select to match default mixer setting - line
5020 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5022 /* Do the same for the second ADC: mute capture input amp and
5023 * set ADC connection to line in (on mic1 pin)
5025 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5026 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5028 /* Mute all inputs to mixer widget (even unconnected ones) */
5029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5034 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5035 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5036 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5041 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5042 * similar laptops (adapted from Fujitsu init verbs).
5044 static struct hda_verb alc260_acer_init_verbs[] = {
5045 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5046 * the headphone jack. Turn this on and rely on the standard mute
5047 * methods whenever the user wants to turn these outputs off.
5049 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5050 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5051 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5052 /* Internal speaker/Headphone jack is connected to Line-out pin */
5053 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5054 /* Internal microphone/Mic jack is connected to Mic1 pin */
5055 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5056 /* Line In jack is connected to Line1 pin */
5057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5058 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5059 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5060 /* Ensure all other unused pins are disabled and muted. */
5061 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5062 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5063 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5064 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5067 /* Disable digital (SPDIF) pins */
5068 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5069 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5071 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5072 * bus when acting as outputs.
5074 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5075 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5077 /* Start with output sum widgets muted and their output gains at min */
5078 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5079 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5080 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5081 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5083 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5084 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5085 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5086 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5088 /* Unmute Line-out pin widget amp left and right
5089 * (no equiv mixer ctrl)
5091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5092 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5093 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5094 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5095 * inputs. If the pin mode is changed by the user the pin mode control
5096 * will take care of enabling the pin's input/output buffers as needed.
5097 * Therefore there's no need to enable the input buffer at this
5100 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5101 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5103 /* Mute capture amp left and right */
5104 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5105 /* Set ADC connection select to match default mixer setting - mic
5108 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5110 /* Do similar with the second ADC: mute capture input amp and
5111 * set ADC connection to mic to match ALSA's default state.
5113 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5114 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5116 /* Mute all inputs to mixer widget (even unconnected ones) */
5117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5123 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5124 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5129 static struct hda_verb alc260_will_verbs[] = {
5130 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5131 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5132 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5133 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5134 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5135 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5139 static struct hda_verb alc260_replacer_672v_verbs[] = {
5140 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5141 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5142 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5144 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5145 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5146 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5148 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5152 /* toggle speaker-output according to the hp-jack state */
5153 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5155 unsigned int present;
5157 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5158 present = snd_hda_codec_read(codec, 0x0f, 0,
5159 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5161 snd_hda_codec_write_cache(codec, 0x01, 0,
5162 AC_VERB_SET_GPIO_DATA, 1);
5163 snd_hda_codec_write_cache(codec, 0x0f, 0,
5164 AC_VERB_SET_PIN_WIDGET_CONTROL,
5167 snd_hda_codec_write_cache(codec, 0x01, 0,
5168 AC_VERB_SET_GPIO_DATA, 0);
5169 snd_hda_codec_write_cache(codec, 0x0f, 0,
5170 AC_VERB_SET_PIN_WIDGET_CONTROL,
5175 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5178 if ((res >> 26) == ALC880_HP_EVENT)
5179 alc260_replacer_672v_automute(codec);
5182 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5183 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5184 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5185 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5186 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5187 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5189 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5190 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5191 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5192 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5196 /* Test configuration for debugging, modelled after the ALC880 test
5199 #ifdef CONFIG_SND_DEBUG
5200 static hda_nid_t alc260_test_dac_nids[1] = {
5203 static hda_nid_t alc260_test_adc_nids[2] = {
5206 /* For testing the ALC260, each input MUX needs its own definition since
5207 * the signal assignments are different. This assumes that the first ADC
5210 static struct hda_input_mux alc260_test_capture_sources[2] = {
5214 { "MIC1 pin", 0x0 },
5215 { "MIC2 pin", 0x1 },
5216 { "LINE1 pin", 0x2 },
5217 { "LINE2 pin", 0x3 },
5219 { "LINE-OUT pin", 0x5 },
5220 { "HP-OUT pin", 0x6 },
5226 { "MIC1 pin", 0x0 },
5227 { "MIC2 pin", 0x1 },
5228 { "LINE1 pin", 0x2 },
5229 { "LINE2 pin", 0x3 },
5232 { "LINE-OUT pin", 0x6 },
5233 { "HP-OUT pin", 0x7 },
5237 static struct snd_kcontrol_new alc260_test_mixer[] = {
5238 /* Output driver widgets */
5239 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5240 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5241 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5242 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5243 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5244 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5246 /* Modes for retasking pin widgets
5247 * Note: the ALC260 doesn't seem to act on requests to enable mic
5248 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5249 * mention this restriction. At this stage it's not clear whether
5250 * this behaviour is intentional or is a hardware bug in chip
5251 * revisions available at least up until early 2006. Therefore for
5252 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5253 * choices, but if it turns out that the lack of mic bias for these
5254 * NIDs is intentional we could change their modes from
5255 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5257 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5258 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5259 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5260 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5261 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5262 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5264 /* Loopback mixer controls */
5265 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5266 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5267 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5268 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5269 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5270 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5271 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5272 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5273 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5274 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5275 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5276 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5277 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5278 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5279 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5280 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5282 /* Controls for GPIO pins, assuming they are configured as outputs */
5283 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5284 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5285 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5286 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5288 /* Switches to allow the digital IO pins to be enabled. The datasheet
5289 * is ambigious as to which NID is which; testing on laptops which
5290 * make this output available should provide clarification.
5292 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5293 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5295 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5296 * this output to turn on an external amplifier.
5298 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5299 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5303 static struct hda_verb alc260_test_init_verbs[] = {
5304 /* Enable all GPIOs as outputs with an initial value of 0 */
5305 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5306 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5307 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5309 /* Enable retasking pins as output, initially without power amp */
5310 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5311 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5314 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5315 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5317 /* Disable digital (SPDIF) pins initially, but users can enable
5318 * them via a mixer switch. In the case of SPDIF-out, this initverb
5319 * payload also sets the generation to 0, output to be in "consumer"
5320 * PCM format, copyright asserted, no pre-emphasis and no validity
5323 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5324 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5326 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5327 * OUT1 sum bus when acting as an output.
5329 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5330 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5331 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5332 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5334 /* Start with output sum widgets muted and their output gains at min */
5335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5337 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5340 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5341 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5342 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5343 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5345 /* Unmute retasking pin widget output buffers since the default
5346 * state appears to be output. As the pin mode is changed by the
5347 * user the pin mode control will take care of enabling the pin's
5348 * input/output buffers as needed.
5350 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5352 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5353 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5354 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5355 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5356 /* Also unmute the mono-out pin widget */
5357 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5359 /* Mute capture amp left and right */
5360 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5361 /* Set ADC connection select to match default mixer setting (mic1
5364 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5366 /* Do the same for the second ADC: mute capture input amp and
5367 * set ADC connection to mic1 pin
5369 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5370 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5372 /* Mute all inputs to mixer widget (even unconnected ones) */
5373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5380 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5386 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5387 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5389 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5390 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5393 * for BIOS auto-configuration
5396 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5397 const char *pfx, int *vol_bits)
5400 unsigned long vol_val, sw_val;
5404 if (nid >= 0x0f && nid < 0x11) {
5405 nid_vol = nid - 0x7;
5406 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5407 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5408 } else if (nid == 0x11) {
5409 nid_vol = nid - 0x7;
5410 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5411 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5412 } else if (nid >= 0x12 && nid <= 0x15) {
5414 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5415 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5419 if (!(*vol_bits & (1 << nid_vol))) {
5420 /* first control for the volume widget */
5421 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5422 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5425 *vol_bits |= (1 << nid_vol);
5427 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5428 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5434 /* add playback controls from the parsed DAC table */
5435 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5436 const struct auto_pin_cfg *cfg)
5442 spec->multiout.num_dacs = 1;
5443 spec->multiout.dac_nids = spec->private_dac_nids;
5444 spec->multiout.dac_nids[0] = 0x02;
5446 nid = cfg->line_out_pins[0];
5448 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5453 nid = cfg->speaker_pins[0];
5455 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5460 nid = cfg->hp_pins[0];
5462 err = alc260_add_playback_controls(spec, nid, "Headphone",
5470 /* create playback/capture controls for input pins */
5471 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5472 const struct auto_pin_cfg *cfg)
5474 struct hda_input_mux *imux = &spec->private_imux;
5477 for (i = 0; i < AUTO_PIN_LAST; i++) {
5478 if (cfg->input_pins[i] >= 0x12) {
5479 idx = cfg->input_pins[i] - 0x12;
5480 err = new_analog_input(spec, cfg->input_pins[i],
5481 auto_pin_cfg_labels[i], idx,
5485 imux->items[imux->num_items].label =
5486 auto_pin_cfg_labels[i];
5487 imux->items[imux->num_items].index = idx;
5490 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5491 idx = cfg->input_pins[i] - 0x09;
5492 err = new_analog_input(spec, cfg->input_pins[i],
5493 auto_pin_cfg_labels[i], idx,
5497 imux->items[imux->num_items].label =
5498 auto_pin_cfg_labels[i];
5499 imux->items[imux->num_items].index = idx;
5506 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5507 hda_nid_t nid, int pin_type,
5510 alc_set_pin_output(codec, nid, pin_type);
5511 /* need the manual connection? */
5513 int idx = nid - 0x12;
5514 snd_hda_codec_write(codec, idx + 0x0b, 0,
5515 AC_VERB_SET_CONNECT_SEL, sel_idx);
5519 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5521 struct alc_spec *spec = codec->spec;
5524 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5525 nid = spec->autocfg.line_out_pins[0];
5527 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5528 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5531 nid = spec->autocfg.speaker_pins[0];
5533 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5535 nid = spec->autocfg.hp_pins[0];
5537 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5540 #define ALC260_PIN_CD_NID 0x16
5541 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5543 struct alc_spec *spec = codec->spec;
5546 for (i = 0; i < AUTO_PIN_LAST; i++) {
5547 hda_nid_t nid = spec->autocfg.input_pins[i];
5549 snd_hda_codec_write(codec, nid, 0,
5550 AC_VERB_SET_PIN_WIDGET_CONTROL,
5551 i <= AUTO_PIN_FRONT_MIC ?
5552 PIN_VREF80 : PIN_IN);
5553 if (nid != ALC260_PIN_CD_NID)
5554 snd_hda_codec_write(codec, nid, 0,
5555 AC_VERB_SET_AMP_GAIN_MUTE,
5562 * generic initialization of ADC, input mixers and output mixers
5564 static struct hda_verb alc260_volume_init_verbs[] = {
5566 * Unmute ADC0-1 and set the default input to mic-in
5568 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5569 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5570 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5571 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5573 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5575 * Note: PASD motherboards uses the Line In 2 as the input for
5576 * front panel mic (mic 2)
5578 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5579 /* mute analog inputs */
5580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5583 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5584 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5587 * Set up output mixers (0x08 - 0x0a)
5589 /* set vol=0 to output mixers */
5590 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5591 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5592 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5593 /* set up input amps for analog loopback */
5594 /* Amp Indices: DAC = 0, mixer = 1 */
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5599 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5605 static int alc260_parse_auto_config(struct hda_codec *codec)
5607 struct alc_spec *spec = codec->spec;
5609 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5611 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5615 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5618 if (!spec->kctls.list)
5619 return 0; /* can't find valid BIOS pin config */
5620 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5624 spec->multiout.max_channels = 2;
5626 if (spec->autocfg.dig_out_pin)
5627 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5628 if (spec->kctls.list)
5629 add_mixer(spec, spec->kctls.list);
5631 add_verb(spec, alc260_volume_init_verbs);
5633 spec->num_mux_defs = 1;
5634 spec->input_mux = &spec->private_imux;
5636 store_pin_configs(codec);
5640 /* additional initialization for auto-configuration model */
5641 static void alc260_auto_init(struct hda_codec *codec)
5643 struct alc_spec *spec = codec->spec;
5644 alc260_auto_init_multi_out(codec);
5645 alc260_auto_init_analog_input(codec);
5646 if (spec->unsol_event)
5647 alc_inithook(codec);
5650 #ifdef CONFIG_SND_HDA_POWER_SAVE
5651 static struct hda_amp_list alc260_loopbacks[] = {
5652 { 0x07, HDA_INPUT, 0 },
5653 { 0x07, HDA_INPUT, 1 },
5654 { 0x07, HDA_INPUT, 2 },
5655 { 0x07, HDA_INPUT, 3 },
5656 { 0x07, HDA_INPUT, 4 },
5662 * ALC260 configurations
5664 static const char *alc260_models[ALC260_MODEL_LAST] = {
5665 [ALC260_BASIC] = "basic",
5667 [ALC260_HP_3013] = "hp-3013",
5668 [ALC260_HP_DC7600] = "hp-dc7600",
5669 [ALC260_FUJITSU_S702X] = "fujitsu",
5670 [ALC260_ACER] = "acer",
5671 [ALC260_WILL] = "will",
5672 [ALC260_REPLACER_672V] = "replacer",
5673 #ifdef CONFIG_SND_DEBUG
5674 [ALC260_TEST] = "test",
5676 [ALC260_AUTO] = "auto",
5679 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5680 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5681 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5682 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5683 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5684 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5685 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5686 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5687 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5688 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5689 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5690 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5691 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5692 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5693 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5694 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5695 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5696 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5697 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5701 static struct alc_config_preset alc260_presets[] = {
5703 .mixers = { alc260_base_output_mixer,
5705 alc260_pc_beep_mixer },
5706 .init_verbs = { alc260_init_verbs },
5707 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5708 .dac_nids = alc260_dac_nids,
5709 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5710 .adc_nids = alc260_adc_nids,
5711 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5712 .channel_mode = alc260_modes,
5713 .input_mux = &alc260_capture_source,
5716 .mixers = { alc260_hp_output_mixer,
5717 alc260_input_mixer },
5718 .init_verbs = { alc260_init_verbs,
5719 alc260_hp_unsol_verbs },
5720 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5721 .dac_nids = alc260_dac_nids,
5722 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5723 .adc_nids = alc260_adc_nids_alt,
5724 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5725 .channel_mode = alc260_modes,
5726 .input_mux = &alc260_capture_source,
5727 .unsol_event = alc260_hp_unsol_event,
5728 .init_hook = alc260_hp_automute,
5730 [ALC260_HP_DC7600] = {
5731 .mixers = { alc260_hp_dc7600_mixer,
5732 alc260_input_mixer },
5733 .init_verbs = { alc260_init_verbs,
5734 alc260_hp_dc7600_verbs },
5735 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5736 .dac_nids = alc260_dac_nids,
5737 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5738 .adc_nids = alc260_adc_nids_alt,
5739 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5740 .channel_mode = alc260_modes,
5741 .input_mux = &alc260_capture_source,
5742 .unsol_event = alc260_hp_3012_unsol_event,
5743 .init_hook = alc260_hp_3012_automute,
5745 [ALC260_HP_3013] = {
5746 .mixers = { alc260_hp_3013_mixer,
5747 alc260_input_mixer },
5748 .init_verbs = { alc260_hp_3013_init_verbs,
5749 alc260_hp_3013_unsol_verbs },
5750 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5751 .dac_nids = alc260_dac_nids,
5752 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5753 .adc_nids = alc260_adc_nids_alt,
5754 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5755 .channel_mode = alc260_modes,
5756 .input_mux = &alc260_capture_source,
5757 .unsol_event = alc260_hp_3013_unsol_event,
5758 .init_hook = alc260_hp_3013_automute,
5760 [ALC260_FUJITSU_S702X] = {
5761 .mixers = { alc260_fujitsu_mixer },
5762 .init_verbs = { alc260_fujitsu_init_verbs },
5763 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5764 .dac_nids = alc260_dac_nids,
5765 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5766 .adc_nids = alc260_dual_adc_nids,
5767 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5768 .channel_mode = alc260_modes,
5769 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5770 .input_mux = alc260_fujitsu_capture_sources,
5773 .mixers = { alc260_acer_mixer },
5774 .init_verbs = { alc260_acer_init_verbs },
5775 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5776 .dac_nids = alc260_dac_nids,
5777 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5778 .adc_nids = alc260_dual_adc_nids,
5779 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5780 .channel_mode = alc260_modes,
5781 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5782 .input_mux = alc260_acer_capture_sources,
5785 .mixers = { alc260_will_mixer },
5786 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5787 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5788 .dac_nids = alc260_dac_nids,
5789 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5790 .adc_nids = alc260_adc_nids,
5791 .dig_out_nid = ALC260_DIGOUT_NID,
5792 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5793 .channel_mode = alc260_modes,
5794 .input_mux = &alc260_capture_source,
5796 [ALC260_REPLACER_672V] = {
5797 .mixers = { alc260_replacer_672v_mixer },
5798 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5799 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5800 .dac_nids = alc260_dac_nids,
5801 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5802 .adc_nids = alc260_adc_nids,
5803 .dig_out_nid = ALC260_DIGOUT_NID,
5804 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5805 .channel_mode = alc260_modes,
5806 .input_mux = &alc260_capture_source,
5807 .unsol_event = alc260_replacer_672v_unsol_event,
5808 .init_hook = alc260_replacer_672v_automute,
5810 #ifdef CONFIG_SND_DEBUG
5812 .mixers = { alc260_test_mixer },
5813 .init_verbs = { alc260_test_init_verbs },
5814 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5815 .dac_nids = alc260_test_dac_nids,
5816 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5817 .adc_nids = alc260_test_adc_nids,
5818 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5819 .channel_mode = alc260_modes,
5820 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5821 .input_mux = alc260_test_capture_sources,
5826 static int patch_alc260(struct hda_codec *codec)
5828 struct alc_spec *spec;
5829 int err, board_config;
5831 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5837 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5840 if (board_config < 0) {
5841 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5842 "trying auto-probe from BIOS...\n");
5843 board_config = ALC260_AUTO;
5846 if (board_config == ALC260_AUTO) {
5847 /* automatic parse from the BIOS config */
5848 err = alc260_parse_auto_config(codec);
5854 "hda_codec: Cannot set up configuration "
5855 "from BIOS. Using base mode...\n");
5856 board_config = ALC260_BASIC;
5860 if (board_config != ALC260_AUTO)
5861 setup_preset(spec, &alc260_presets[board_config]);
5863 spec->stream_name_analog = "ALC260 Analog";
5864 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5865 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5867 spec->stream_name_digital = "ALC260 Digital";
5868 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5869 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5871 if (!spec->adc_nids && spec->input_mux) {
5872 /* check whether NID 0x04 is valid */
5873 unsigned int wcap = get_wcaps(codec, 0x04);
5874 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5876 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5877 spec->adc_nids = alc260_adc_nids_alt;
5878 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5880 spec->adc_nids = alc260_adc_nids;
5881 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5884 set_capture_mixer(spec);
5886 spec->vmaster_nid = 0x08;
5888 codec->patch_ops = alc_patch_ops;
5889 if (board_config == ALC260_AUTO)
5890 spec->init_hook = alc260_auto_init;
5891 #ifdef CONFIG_SND_HDA_POWER_SAVE
5892 if (!spec->loopback.amplist)
5893 spec->loopback.amplist = alc260_loopbacks;
5895 codec->proc_widget_hook = print_realtek_coef;
5904 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5905 * configuration. Each pin widget can choose any input DACs and a mixer.
5906 * Each ADC is connected from a mixer of all inputs. This makes possible
5907 * 6-channel independent captures.
5909 * In addition, an independent DAC for the multi-playback (not used in this
5912 #define ALC882_DIGOUT_NID 0x06
5913 #define ALC882_DIGIN_NID 0x0a
5915 static struct hda_channel_mode alc882_ch_modes[1] = {
5919 static hda_nid_t alc882_dac_nids[4] = {
5920 /* front, rear, clfe, rear_surr */
5921 0x02, 0x03, 0x04, 0x05
5924 /* identical with ALC880 */
5925 #define alc882_adc_nids alc880_adc_nids
5926 #define alc882_adc_nids_alt alc880_adc_nids_alt
5928 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5929 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5932 /* FIXME: should be a matrix-type input source selection */
5934 static struct hda_input_mux alc882_capture_source = {
5938 { "Front Mic", 0x1 },
5946 static struct hda_verb alc882_3ST_ch2_init[] = {
5947 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5948 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5949 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5950 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5957 static struct hda_verb alc882_3ST_ch6_init[] = {
5958 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5959 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5960 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5961 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5962 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5963 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5967 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5968 { 2, alc882_3ST_ch2_init },
5969 { 6, alc882_3ST_ch6_init },
5975 static struct hda_verb alc882_sixstack_ch6_init[] = {
5976 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5977 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5978 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5979 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5986 static struct hda_verb alc882_sixstack_ch8_init[] = {
5987 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5988 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5989 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5990 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5994 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5995 { 6, alc882_sixstack_ch6_init },
5996 { 8, alc882_sixstack_ch8_init },
6000 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6006 static struct hda_verb alc885_mbp_ch2_init[] = {
6007 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6008 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6009 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6016 static struct hda_verb alc885_mbp_ch6_init[] = {
6017 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6018 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6019 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6020 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6021 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6025 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6026 { 2, alc885_mbp_ch2_init },
6027 { 6, alc885_mbp_ch6_init },
6031 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6032 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6034 static struct snd_kcontrol_new alc882_base_mixer[] = {
6035 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6036 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6037 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6038 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6039 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6040 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6041 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6042 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6043 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6044 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6045 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6046 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6047 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6048 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6049 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6050 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6051 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6052 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6053 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6054 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6055 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6056 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6057 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6061 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6062 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6063 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6064 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6065 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6066 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6067 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6068 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6069 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6070 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6071 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6074 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6075 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6076 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6077 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6078 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6079 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6080 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6082 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6084 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6085 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6089 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6090 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6091 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6093 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6094 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6099 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6100 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6101 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6102 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6106 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6107 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6109 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6110 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6111 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6113 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6114 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6115 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6116 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6117 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6118 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6119 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6122 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6126 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6128 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6137 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6138 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6142 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6144 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6145 .name = "Channel Mode",
6146 .info = alc_ch_mode_info,
6147 .get = alc_ch_mode_get,
6148 .put = alc_ch_mode_put,
6153 static struct hda_verb alc882_init_verbs[] = {
6154 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6156 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6157 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6159 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6160 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6161 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6163 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6165 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6167 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6168 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6169 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6171 /* Front Pin: output 0 (0x0c) */
6172 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6173 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6174 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6175 /* Rear Pin: output 1 (0x0d) */
6176 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6178 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6179 /* CLFE Pin: output 2 (0x0e) */
6180 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6181 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6182 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6183 /* Side Pin: output 3 (0x0f) */
6184 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6185 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6186 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6187 /* Mic (rear) pin: input vref at 80% */
6188 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6189 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6190 /* Front Mic pin: input vref at 80% */
6191 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6192 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6193 /* Line In pin: input */
6194 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6195 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6196 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6197 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6198 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6199 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6200 /* CD pin widget for input */
6201 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6203 /* FIXME: use matrix-type input source selection */
6204 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6205 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6214 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6220 /* ADC1: mute amp left and right */
6221 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6222 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6223 /* ADC2: mute amp left and right */
6224 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6225 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6226 /* ADC3: mute amp left and right */
6227 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6228 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6233 static struct hda_verb alc882_eapd_verbs[] = {
6234 /* change to EAPD mode */
6235 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6236 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6241 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6245 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6246 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6247 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6248 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6252 static struct hda_verb alc882_macpro_init_verbs[] = {
6253 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6257 /* Front Pin: output 0 (0x0c) */
6258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6260 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6261 /* Front Mic pin: input vref at 80% */
6262 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6263 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6264 /* Speaker: output */
6265 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6266 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6267 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6268 /* Headphone output (output 0 - 0x0c) */
6269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6270 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6271 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6273 /* FIXME: use matrix-type input source selection */
6274 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6275 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6290 /* ADC1: mute amp left and right */
6291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6292 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6293 /* ADC2: mute amp left and right */
6294 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6295 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6296 /* ADC3: mute amp left and right */
6297 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6298 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6303 /* Macbook Pro rev3 */
6304 static struct hda_verb alc885_mbp3_init_verbs[] = {
6305 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6313 /* Front Pin: output 0 (0x0c) */
6314 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6315 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6316 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6317 /* HP Pin: output 0 (0x0d) */
6318 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6320 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6322 /* Mic (rear) pin: input vref at 80% */
6323 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6324 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6325 /* Front Mic pin: input vref at 80% */
6326 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6327 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6328 /* Line In pin: use output 1 when in LineOut mode */
6329 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6330 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6331 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6333 /* FIXME: use matrix-type input source selection */
6334 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6335 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6341 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6342 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6348 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6350 /* ADC1: mute amp left and right */
6351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6352 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6353 /* ADC2: mute amp left and right */
6354 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6355 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6356 /* ADC3: mute amp left and right */
6357 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6358 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6363 /* iMac 24 mixer. */
6364 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6365 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6366 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6370 /* iMac 24 init verbs. */
6371 static struct hda_verb alc885_imac24_init_verbs[] = {
6372 /* Internal speakers: output 0 (0x0c) */
6373 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6375 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6376 /* Internal speakers: output 0 (0x0c) */
6377 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6379 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6380 /* Headphone: output 0 (0x0c) */
6381 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6382 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6383 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6384 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6385 /* Front Mic: input vref at 80% */
6386 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6387 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6391 /* Toggle speaker-output according to the hp-jack state */
6392 static void alc885_imac24_automute(struct hda_codec *codec)
6394 unsigned int present;
6396 present = snd_hda_codec_read(codec, 0x14, 0,
6397 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6398 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6399 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6400 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6401 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6404 /* Processes unsolicited events. */
6405 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6408 /* Headphone insertion or removal. */
6409 if ((res >> 26) == ALC880_HP_EVENT)
6410 alc885_imac24_automute(codec);
6413 static void alc885_mbp3_automute(struct hda_codec *codec)
6415 unsigned int present;
6417 present = snd_hda_codec_read(codec, 0x15, 0,
6418 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6419 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6420 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6421 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6422 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6425 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6428 /* Headphone insertion or removal. */
6429 if ((res >> 26) == ALC880_HP_EVENT)
6430 alc885_mbp3_automute(codec);
6434 static struct hda_verb alc882_targa_verbs[] = {
6435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6439 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6441 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6442 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6443 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6445 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6446 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6447 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6448 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6452 /* toggle speaker-output according to the hp-jack state */
6453 static void alc882_targa_automute(struct hda_codec *codec)
6455 unsigned int present;
6457 present = snd_hda_codec_read(codec, 0x14, 0,
6458 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6459 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6460 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6461 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6465 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6467 /* Looks like the unsol event is incompatible with the standard
6468 * definition. 4bit tag is placed at 26 bit!
6470 if (((res >> 26) == ALC880_HP_EVENT)) {
6471 alc882_targa_automute(codec);
6475 static struct hda_verb alc882_asus_a7j_verbs[] = {
6476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6480 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6481 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6483 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6484 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6485 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6487 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6488 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6489 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6493 static struct hda_verb alc882_asus_a7m_verbs[] = {
6494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6495 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6499 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6501 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6502 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6503 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6505 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6506 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6507 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6511 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6513 unsigned int gpiostate, gpiomask, gpiodir;
6515 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6516 AC_VERB_GET_GPIO_DATA, 0);
6519 gpiostate |= (1 << pin);
6521 gpiostate &= ~(1 << pin);
6523 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6524 AC_VERB_GET_GPIO_MASK, 0);
6525 gpiomask |= (1 << pin);
6527 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6528 AC_VERB_GET_GPIO_DIRECTION, 0);
6529 gpiodir |= (1 << pin);
6532 snd_hda_codec_write(codec, codec->afg, 0,
6533 AC_VERB_SET_GPIO_MASK, gpiomask);
6534 snd_hda_codec_write(codec, codec->afg, 0,
6535 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6539 snd_hda_codec_write(codec, codec->afg, 0,
6540 AC_VERB_SET_GPIO_DATA, gpiostate);
6543 /* set up GPIO at initialization */
6544 static void alc885_macpro_init_hook(struct hda_codec *codec)
6546 alc882_gpio_mute(codec, 0, 0);
6547 alc882_gpio_mute(codec, 1, 0);
6550 /* set up GPIO and update auto-muting at initialization */
6551 static void alc885_imac24_init_hook(struct hda_codec *codec)
6553 alc885_macpro_init_hook(codec);
6554 alc885_imac24_automute(codec);
6558 * generic initialization of ADC, input mixers and output mixers
6560 static struct hda_verb alc882_auto_init_verbs[] = {
6562 * Unmute ADC0-2 and set the default input to mic-in
6564 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6566 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6567 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6568 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6569 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6571 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6573 * Note: PASD motherboards uses the Line In 2 as the input for
6574 * front panel mic (mic 2)
6576 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6578 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6580 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6584 * Set up output mixers (0x0c - 0x0f)
6586 /* set vol=0 to output mixers */
6587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6589 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6590 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6591 /* set up input amps for analog loopback */
6592 /* Amp Indices: DAC = 0, mixer = 1 */
6593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6595 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6596 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6598 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6599 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6600 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6601 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6602 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6604 /* FIXME: use matrix-type input source selection */
6605 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6606 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6607 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6609 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6625 #ifdef CONFIG_SND_HDA_POWER_SAVE
6626 #define alc882_loopbacks alc880_loopbacks
6629 /* pcm configuration: identiacal with ALC880 */
6630 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6631 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6632 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6633 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6636 * configuration and preset
6638 static const char *alc882_models[ALC882_MODEL_LAST] = {
6639 [ALC882_3ST_DIG] = "3stack-dig",
6640 [ALC882_6ST_DIG] = "6stack-dig",
6641 [ALC882_ARIMA] = "arima",
6642 [ALC882_W2JC] = "w2jc",
6643 [ALC882_TARGA] = "targa",
6644 [ALC882_ASUS_A7J] = "asus-a7j",
6645 [ALC882_ASUS_A7M] = "asus-a7m",
6646 [ALC885_MACPRO] = "macpro",
6647 [ALC885_MBP3] = "mbp3",
6648 [ALC885_IMAC24] = "imac24",
6649 [ALC882_AUTO] = "auto",
6652 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6653 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6654 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6655 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6656 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6657 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6658 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6659 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6660 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6661 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6662 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6663 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6664 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6668 static struct alc_config_preset alc882_presets[] = {
6669 [ALC882_3ST_DIG] = {
6670 .mixers = { alc882_base_mixer },
6671 .init_verbs = { alc882_init_verbs },
6672 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6673 .dac_nids = alc882_dac_nids,
6674 .dig_out_nid = ALC882_DIGOUT_NID,
6675 .dig_in_nid = ALC882_DIGIN_NID,
6676 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6677 .channel_mode = alc882_ch_modes,
6679 .input_mux = &alc882_capture_source,
6681 [ALC882_6ST_DIG] = {
6682 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6683 .init_verbs = { alc882_init_verbs },
6684 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6685 .dac_nids = alc882_dac_nids,
6686 .dig_out_nid = ALC882_DIGOUT_NID,
6687 .dig_in_nid = ALC882_DIGIN_NID,
6688 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6689 .channel_mode = alc882_sixstack_modes,
6690 .input_mux = &alc882_capture_source,
6693 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6694 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6695 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6696 .dac_nids = alc882_dac_nids,
6697 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6698 .channel_mode = alc882_sixstack_modes,
6699 .input_mux = &alc882_capture_source,
6702 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6703 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6704 alc880_gpio1_init_verbs },
6705 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6706 .dac_nids = alc882_dac_nids,
6707 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6708 .channel_mode = alc880_threestack_modes,
6710 .input_mux = &alc882_capture_source,
6711 .dig_out_nid = ALC882_DIGOUT_NID,
6714 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6715 .init_verbs = { alc885_mbp3_init_verbs,
6716 alc880_gpio1_init_verbs },
6717 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6718 .dac_nids = alc882_dac_nids,
6719 .channel_mode = alc885_mbp_6ch_modes,
6720 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6721 .input_mux = &alc882_capture_source,
6722 .dig_out_nid = ALC882_DIGOUT_NID,
6723 .dig_in_nid = ALC882_DIGIN_NID,
6724 .unsol_event = alc885_mbp3_unsol_event,
6725 .init_hook = alc885_mbp3_automute,
6728 .mixers = { alc882_macpro_mixer },
6729 .init_verbs = { alc882_macpro_init_verbs },
6730 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6731 .dac_nids = alc882_dac_nids,
6732 .dig_out_nid = ALC882_DIGOUT_NID,
6733 .dig_in_nid = ALC882_DIGIN_NID,
6734 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6735 .channel_mode = alc882_ch_modes,
6736 .input_mux = &alc882_capture_source,
6737 .init_hook = alc885_macpro_init_hook,
6740 .mixers = { alc885_imac24_mixer },
6741 .init_verbs = { alc885_imac24_init_verbs },
6742 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6743 .dac_nids = alc882_dac_nids,
6744 .dig_out_nid = ALC882_DIGOUT_NID,
6745 .dig_in_nid = ALC882_DIGIN_NID,
6746 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6747 .channel_mode = alc882_ch_modes,
6748 .input_mux = &alc882_capture_source,
6749 .unsol_event = alc885_imac24_unsol_event,
6750 .init_hook = alc885_imac24_init_hook,
6753 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6754 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6755 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6756 .dac_nids = alc882_dac_nids,
6757 .dig_out_nid = ALC882_DIGOUT_NID,
6758 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6759 .adc_nids = alc882_adc_nids,
6760 .capsrc_nids = alc882_capsrc_nids,
6761 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6762 .channel_mode = alc882_3ST_6ch_modes,
6764 .input_mux = &alc882_capture_source,
6765 .unsol_event = alc882_targa_unsol_event,
6766 .init_hook = alc882_targa_automute,
6768 [ALC882_ASUS_A7J] = {
6769 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6770 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6771 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6772 .dac_nids = alc882_dac_nids,
6773 .dig_out_nid = ALC882_DIGOUT_NID,
6774 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6775 .adc_nids = alc882_adc_nids,
6776 .capsrc_nids = alc882_capsrc_nids,
6777 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6778 .channel_mode = alc882_3ST_6ch_modes,
6780 .input_mux = &alc882_capture_source,
6782 [ALC882_ASUS_A7M] = {
6783 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6784 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6785 alc880_gpio1_init_verbs,
6786 alc882_asus_a7m_verbs },
6787 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6788 .dac_nids = alc882_dac_nids,
6789 .dig_out_nid = ALC882_DIGOUT_NID,
6790 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6791 .channel_mode = alc880_threestack_modes,
6793 .input_mux = &alc882_capture_source,
6802 PINFIX_ABIT_AW9D_MAX
6805 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6806 { 0x15, 0x01080104 }, /* side */
6807 { 0x16, 0x01011012 }, /* rear */
6808 { 0x17, 0x01016011 }, /* clfe */
6812 static const struct alc_pincfg *alc882_pin_fixes[] = {
6813 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6816 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6817 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6822 * BIOS auto configuration
6824 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6825 hda_nid_t nid, int pin_type,
6829 struct alc_spec *spec = codec->spec;
6832 alc_set_pin_output(codec, nid, pin_type);
6833 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6836 idx = spec->multiout.dac_nids[dac_idx] - 2;
6837 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6841 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6843 struct alc_spec *spec = codec->spec;
6846 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6847 for (i = 0; i <= HDA_SIDE; i++) {
6848 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6849 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6851 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6856 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6858 struct alc_spec *spec = codec->spec;
6861 pin = spec->autocfg.hp_pins[0];
6862 if (pin) /* connect to front */
6864 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6865 pin = spec->autocfg.speaker_pins[0];
6867 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6870 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6871 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6873 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6875 struct alc_spec *spec = codec->spec;
6878 for (i = 0; i < AUTO_PIN_LAST; i++) {
6879 hda_nid_t nid = spec->autocfg.input_pins[i];
6884 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6885 unsigned int pincap;
6886 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6887 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6891 snd_hda_codec_write(codec, nid, 0,
6892 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6893 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6894 snd_hda_codec_write(codec, nid, 0,
6895 AC_VERB_SET_AMP_GAIN_MUTE,
6900 static void alc882_auto_init_input_src(struct hda_codec *codec)
6902 struct alc_spec *spec = codec->spec;
6903 const struct hda_input_mux *imux = spec->input_mux;
6906 for (c = 0; c < spec->num_adc_nids; c++) {
6907 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6908 hda_nid_t nid = spec->capsrc_nids[c];
6909 int conns, mute, idx, item;
6911 conns = snd_hda_get_connections(codec, nid, conn_list,
6912 ARRAY_SIZE(conn_list));
6915 for (idx = 0; idx < conns; idx++) {
6916 /* if the current connection is the selected one,
6917 * unmute it as default - otherwise mute it
6919 mute = AMP_IN_MUTE(idx);
6920 for (item = 0; item < imux->num_items; item++) {
6921 if (imux->items[item].index == idx) {
6922 if (spec->cur_mux[c] == item)
6923 mute = AMP_IN_UNMUTE(idx);
6927 snd_hda_codec_write(codec, nid, 0,
6928 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6933 /* add mic boosts if needed */
6934 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6936 struct alc_spec *spec = codec->spec;
6940 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6941 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6942 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6944 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6948 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6949 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6950 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6952 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6959 /* almost identical with ALC880 parser... */
6960 static int alc882_parse_auto_config(struct hda_codec *codec)
6962 struct alc_spec *spec = codec->spec;
6963 int err = alc880_parse_auto_config(codec);
6968 return 0; /* no config found */
6970 err = alc_auto_add_mic_boost(codec);
6974 /* hack - override the init verbs */
6975 spec->init_verbs[0] = alc882_auto_init_verbs;
6977 return 1; /* config found */
6980 /* additional initialization for auto-configuration model */
6981 static void alc882_auto_init(struct hda_codec *codec)
6983 struct alc_spec *spec = codec->spec;
6984 alc882_auto_init_multi_out(codec);
6985 alc882_auto_init_hp_out(codec);
6986 alc882_auto_init_analog_input(codec);
6987 alc882_auto_init_input_src(codec);
6988 if (spec->unsol_event)
6989 alc_inithook(codec);
6992 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6994 static int patch_alc882(struct hda_codec *codec)
6996 struct alc_spec *spec;
6997 int err, board_config;
6999 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7005 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7009 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7010 /* Pick up systems that don't supply PCI SSID */
7011 switch (codec->subsystem_id) {
7012 case 0x106b0c00: /* Mac Pro */
7013 board_config = ALC885_MACPRO;
7015 case 0x106b1000: /* iMac 24 */
7016 case 0x106b2800: /* AppleTV */
7017 case 0x106b3e00: /* iMac 24 Aluminium */
7018 board_config = ALC885_IMAC24;
7020 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7021 case 0x106b00a4: /* MacbookPro4,1 */
7022 case 0x106b2c00: /* Macbook Pro rev3 */
7023 case 0x106b3600: /* Macbook 3.1 */
7024 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7025 board_config = ALC885_MBP3;
7028 /* ALC889A is handled better as ALC888-compatible */
7029 if (codec->revision_id == 0x100101 ||
7030 codec->revision_id == 0x100103) {
7032 return patch_alc883(codec);
7034 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7035 "trying auto-probe from BIOS...\n");
7036 board_config = ALC882_AUTO;
7040 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7042 if (board_config == ALC882_AUTO) {
7043 /* automatic parse from the BIOS config */
7044 err = alc882_parse_auto_config(codec);
7050 "hda_codec: Cannot set up configuration "
7051 "from BIOS. Using base mode...\n");
7052 board_config = ALC882_3ST_DIG;
7056 if (board_config != ALC882_AUTO)
7057 setup_preset(spec, &alc882_presets[board_config]);
7059 if (codec->vendor_id == 0x10ec0885) {
7060 spec->stream_name_analog = "ALC885 Analog";
7061 spec->stream_name_digital = "ALC885 Digital";
7063 spec->stream_name_analog = "ALC882 Analog";
7064 spec->stream_name_digital = "ALC882 Digital";
7067 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7068 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7069 /* FIXME: setup DAC5 */
7070 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7071 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7073 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7074 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7076 spec->is_mix_capture = 1; /* matrix-style capture */
7077 if (!spec->adc_nids && spec->input_mux) {
7078 /* check whether NID 0x07 is valid */
7079 unsigned int wcap = get_wcaps(codec, 0x07);
7081 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7082 if (wcap != AC_WID_AUD_IN) {
7083 spec->adc_nids = alc882_adc_nids_alt;
7084 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7085 spec->capsrc_nids = alc882_capsrc_nids_alt;
7087 spec->adc_nids = alc882_adc_nids;
7088 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7089 spec->capsrc_nids = alc882_capsrc_nids;
7092 set_capture_mixer(spec);
7094 spec->vmaster_nid = 0x0c;
7096 codec->patch_ops = alc_patch_ops;
7097 if (board_config == ALC882_AUTO)
7098 spec->init_hook = alc882_auto_init;
7099 #ifdef CONFIG_SND_HDA_POWER_SAVE
7100 if (!spec->loopback.amplist)
7101 spec->loopback.amplist = alc882_loopbacks;
7103 codec->proc_widget_hook = print_realtek_coef;
7111 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7112 * configuration. Each pin widget can choose any input DACs and a mixer.
7113 * Each ADC is connected from a mixer of all inputs. This makes possible
7114 * 6-channel independent captures.
7116 * In addition, an independent DAC for the multi-playback (not used in this
7119 #define ALC883_DIGOUT_NID 0x06
7120 #define ALC883_DIGIN_NID 0x0a
7122 #define ALC1200_DIGOUT_NID 0x10
7124 static hda_nid_t alc883_dac_nids[4] = {
7125 /* front, rear, clfe, rear_surr */
7126 0x02, 0x03, 0x04, 0x05
7129 static hda_nid_t alc883_adc_nids[2] = {
7134 static hda_nid_t alc883_adc_nids_alt[1] = {
7139 static hda_nid_t alc883_adc_nids_rev[2] = {
7144 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7146 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7149 /* FIXME: should be a matrix-type input source selection */
7151 static struct hda_input_mux alc883_capture_source = {
7155 { "Front Mic", 0x1 },
7161 static struct hda_input_mux alc883_3stack_6ch_intel = {
7165 { "Front Mic", 0x0 },
7171 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7179 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7189 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7197 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7201 { "Front Mic", 0x1 },
7206 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7217 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7224 static struct hda_verb alc883_3ST_ch2_init[] = {
7225 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7226 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7227 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7228 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7235 static struct hda_verb alc883_3ST_ch4_init[] = {
7236 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7237 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7238 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7239 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7240 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7247 static struct hda_verb alc883_3ST_ch6_init[] = {
7248 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7249 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7250 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7251 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7252 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7253 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7257 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7258 { 2, alc883_3ST_ch2_init },
7259 { 4, alc883_3ST_ch4_init },
7260 { 6, alc883_3ST_ch6_init },
7266 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7267 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7268 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7269 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7270 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7277 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7278 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7279 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7280 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7281 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7282 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7289 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7290 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7291 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7292 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7293 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7294 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7295 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7299 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7300 { 2, alc883_3ST_ch2_intel_init },
7301 { 4, alc883_3ST_ch4_intel_init },
7302 { 6, alc883_3ST_ch6_intel_init },
7308 static struct hda_verb alc883_sixstack_ch6_init[] = {
7309 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7310 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7311 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7312 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7319 static struct hda_verb alc883_sixstack_ch8_init[] = {
7320 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7321 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7322 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7323 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7327 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7328 { 6, alc883_sixstack_ch6_init },
7329 { 8, alc883_sixstack_ch8_init },
7332 static struct hda_verb alc883_medion_eapd_verbs[] = {
7333 /* eanable EAPD on medion laptop */
7334 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7335 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7339 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7340 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7343 static struct snd_kcontrol_new alc883_base_mixer[] = {
7344 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7345 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7346 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7347 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7348 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7349 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7350 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7351 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7352 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7353 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7354 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7355 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7356 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7360 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7361 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7362 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7363 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7364 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7365 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7366 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7370 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7371 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7372 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7373 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7374 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7375 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7376 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7379 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7380 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7381 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7382 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7387 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7388 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7389 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7390 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7391 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7393 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7394 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7395 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7396 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7397 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7401 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7402 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7403 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7404 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7405 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7406 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7407 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7408 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7409 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7410 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7411 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7415 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7417 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7419 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7420 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7422 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7426 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7427 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7428 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7429 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7430 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7434 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7435 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7436 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7437 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7438 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7439 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7440 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7441 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7442 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7443 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7444 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7445 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7446 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7447 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7449 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7452 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7453 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7454 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7455 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7459 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7460 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7461 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7462 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7463 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7464 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7466 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7467 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7468 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7469 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7470 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7471 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7473 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7475 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7476 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7477 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7478 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7479 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7480 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7481 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7485 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7486 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7487 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7488 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7489 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7490 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7491 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7492 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7493 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7495 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7496 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7498 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7500 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7501 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7502 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7503 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7505 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7506 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7510 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7511 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7512 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7513 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7514 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7515 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7516 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7517 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7518 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7519 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7520 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7521 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7522 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7523 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7525 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7526 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7530 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7531 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7533 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7534 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7535 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7537 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7539 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7540 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7541 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7545 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7546 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7547 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7548 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7549 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7550 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7557 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7558 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7559 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7561 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7562 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7565 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7566 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7570 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7571 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7573 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7574 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7575 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7576 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7577 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7579 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7583 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7584 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7585 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7586 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7587 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7588 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7591 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7595 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7596 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7597 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7598 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7599 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7600 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7601 0x0d, 1, 0x0, HDA_OUTPUT),
7602 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7603 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7604 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7605 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7606 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7608 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7609 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7610 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7611 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7612 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7614 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7615 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7616 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7617 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7618 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7622 static struct hda_bind_ctls alc883_bind_cap_vol = {
7623 .ops = &snd_hda_bind_vol,
7625 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7626 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7631 static struct hda_bind_ctls alc883_bind_cap_switch = {
7632 .ops = &snd_hda_bind_sw,
7634 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7635 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7640 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7641 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7642 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7643 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7644 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7645 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7646 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7647 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7652 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7653 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7654 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7656 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7657 /* .name = "Capture Source", */
7658 .name = "Input Source",
7660 .info = alc_mux_enum_info,
7661 .get = alc_mux_enum_get,
7662 .put = alc_mux_enum_put,
7667 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7669 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7670 .name = "Channel Mode",
7671 .info = alc_ch_mode_info,
7672 .get = alc_ch_mode_get,
7673 .put = alc_ch_mode_put,
7678 static struct hda_verb alc883_init_verbs[] = {
7679 /* ADC1: mute amp left and right */
7680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7681 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7682 /* ADC2: mute amp left and right */
7683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7684 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7685 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7690 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7691 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7692 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7694 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7695 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7696 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7698 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7699 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7700 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7702 /* mute analog input loopbacks */
7703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7709 /* Front Pin: output 0 (0x0c) */
7710 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7711 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7712 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7713 /* Rear Pin: output 1 (0x0d) */
7714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7715 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7716 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7717 /* CLFE Pin: output 2 (0x0e) */
7718 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7719 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7720 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7721 /* Side Pin: output 3 (0x0f) */
7722 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7723 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7724 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7725 /* Mic (rear) pin: input vref at 80% */
7726 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7727 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7728 /* Front Mic pin: input vref at 80% */
7729 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7731 /* Line In pin: input */
7732 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7733 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7734 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7736 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7737 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7738 /* CD pin widget for input */
7739 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7741 /* FIXME: use matrix-type input source selection */
7742 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7745 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7746 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7747 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7750 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7752 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7756 /* toggle speaker-output according to the hp-jack state */
7757 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7759 unsigned int present;
7761 present = snd_hda_codec_read(codec, 0x15, 0,
7762 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7763 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7764 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7765 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7766 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7769 /* auto-toggle front mic */
7771 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7773 unsigned int present;
7776 present = snd_hda_codec_read(codec, 0x18, 0,
7777 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7778 bits = present ? HDA_AMP_MUTE : 0;
7779 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7783 static void alc883_mitac_automute(struct hda_codec *codec)
7785 alc883_mitac_hp_automute(codec);
7786 /* alc883_mitac_mic_automute(codec); */
7789 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7792 switch (res >> 26) {
7793 case ALC880_HP_EVENT:
7794 alc883_mitac_hp_automute(codec);
7796 case ALC880_MIC_EVENT:
7797 /* alc883_mitac_mic_automute(codec); */
7802 static struct hda_verb alc883_mitac_verbs[] = {
7804 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7805 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7807 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7808 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7810 /* enable unsolicited event */
7811 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7812 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7817 static struct hda_verb alc883_clevo_m720_verbs[] = {
7819 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7822 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7825 /* enable unsolicited event */
7826 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7827 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7832 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7834 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7837 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7840 /* enable unsolicited event */
7841 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7846 static struct hda_verb alc883_tagra_verbs[] = {
7847 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7851 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7853 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7854 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7855 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7857 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7858 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7859 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7860 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7865 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7866 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7867 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7868 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7872 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7873 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7875 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7876 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7880 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7883 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7884 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7885 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7889 static struct hda_verb alc883_haier_w66_verbs[] = {
7890 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7891 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7893 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7895 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7896 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7897 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7898 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7902 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7905 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7906 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7907 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7908 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7909 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7910 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7914 static struct hda_verb alc888_3st_hp_verbs[] = {
7915 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7916 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7917 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7921 static struct hda_verb alc888_6st_dell_verbs[] = {
7922 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7926 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7927 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7928 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7929 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7930 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7934 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7935 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7936 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7937 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7938 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7942 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7943 { 2, alc888_3st_hp_2ch_init },
7944 { 6, alc888_3st_hp_6ch_init },
7947 /* toggle front-jack and RCA according to the hp-jack state */
7948 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7950 unsigned int present;
7952 present = snd_hda_codec_read(codec, 0x1b, 0,
7953 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7954 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7955 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7956 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7957 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7960 /* toggle RCA according to the front-jack state */
7961 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7963 unsigned int present;
7965 present = snd_hda_codec_read(codec, 0x14, 0,
7966 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7967 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7968 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7971 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7974 if ((res >> 26) == ALC880_HP_EVENT)
7975 alc888_lenovo_ms7195_front_automute(codec);
7976 if ((res >> 26) == ALC880_FRONT_EVENT)
7977 alc888_lenovo_ms7195_rca_automute(codec);
7980 static struct hda_verb alc883_medion_md2_verbs[] = {
7981 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7982 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7986 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7990 /* toggle speaker-output according to the hp-jack state */
7991 static void alc883_medion_md2_automute(struct hda_codec *codec)
7993 unsigned int present;
7995 present = snd_hda_codec_read(codec, 0x14, 0,
7996 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7997 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7998 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8001 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8004 if ((res >> 26) == ALC880_HP_EVENT)
8005 alc883_medion_md2_automute(codec);
8008 /* toggle speaker-output according to the hp-jack state */
8009 static void alc883_tagra_automute(struct hda_codec *codec)
8011 unsigned int present;
8014 present = snd_hda_codec_read(codec, 0x14, 0,
8015 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8016 bits = present ? HDA_AMP_MUTE : 0;
8017 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8018 HDA_AMP_MUTE, bits);
8019 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8023 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8025 if ((res >> 26) == ALC880_HP_EVENT)
8026 alc883_tagra_automute(codec);
8029 /* toggle speaker-output according to the hp-jack state */
8030 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8032 unsigned int present;
8035 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8036 & AC_PINSENSE_PRESENCE;
8037 bits = present ? HDA_AMP_MUTE : 0;
8038 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8039 HDA_AMP_MUTE, bits);
8042 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8044 unsigned int present;
8046 present = snd_hda_codec_read(codec, 0x18, 0,
8047 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8048 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8049 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8052 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8054 alc883_clevo_m720_hp_automute(codec);
8055 alc883_clevo_m720_mic_automute(codec);
8058 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8061 switch (res >> 26) {
8062 case ALC880_HP_EVENT:
8063 alc883_clevo_m720_hp_automute(codec);
8065 case ALC880_MIC_EVENT:
8066 alc883_clevo_m720_mic_automute(codec);
8071 /* toggle speaker-output according to the hp-jack state */
8072 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8074 unsigned int present;
8077 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8078 & AC_PINSENSE_PRESENCE;
8079 bits = present ? HDA_AMP_MUTE : 0;
8080 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8081 HDA_AMP_MUTE, bits);
8084 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8087 if ((res >> 26) == ALC880_HP_EVENT)
8088 alc883_2ch_fujitsu_pi2515_automute(codec);
8091 static void alc883_haier_w66_automute(struct hda_codec *codec)
8093 unsigned int present;
8096 present = snd_hda_codec_read(codec, 0x1b, 0,
8097 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8098 bits = present ? 0x80 : 0;
8099 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8103 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8106 if ((res >> 26) == ALC880_HP_EVENT)
8107 alc883_haier_w66_automute(codec);
8110 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8112 unsigned int present;
8115 present = snd_hda_codec_read(codec, 0x14, 0,
8116 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8117 bits = present ? HDA_AMP_MUTE : 0;
8118 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8119 HDA_AMP_MUTE, bits);
8122 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8124 unsigned int present;
8127 present = snd_hda_codec_read(codec, 0x1b, 0,
8128 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8129 bits = present ? HDA_AMP_MUTE : 0;
8130 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8131 HDA_AMP_MUTE, bits);
8132 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8133 HDA_AMP_MUTE, bits);
8136 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8139 if ((res >> 26) == ALC880_HP_EVENT)
8140 alc883_lenovo_101e_all_automute(codec);
8141 if ((res >> 26) == ALC880_FRONT_EVENT)
8142 alc883_lenovo_101e_ispeaker_automute(codec);
8145 /* toggle speaker-output according to the hp-jack state */
8146 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8148 unsigned int present;
8150 present = snd_hda_codec_read(codec, 0x14, 0,
8151 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8152 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8153 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8154 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8155 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8158 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8161 if ((res >> 26) == ALC880_HP_EVENT)
8162 alc883_acer_aspire_automute(codec);
8165 static struct hda_verb alc883_acer_eapd_verbs[] = {
8166 /* HP Pin: output 0 (0x0c) */
8167 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8168 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8169 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8170 /* Front Pin: output 0 (0x0c) */
8171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8172 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8173 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8174 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8175 /* eanable EAPD on medion laptop */
8176 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8177 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8178 /* enable unsolicited event */
8179 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8183 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8185 unsigned int present;
8187 present = snd_hda_codec_read(codec, 0x1b, 0,
8188 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8189 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8190 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8191 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8192 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8193 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8194 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8195 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8196 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8199 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8202 switch (res >> 26) {
8203 case ALC880_HP_EVENT:
8204 printk("hp_event\n");
8205 alc888_6st_dell_front_automute(codec);
8210 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8213 unsigned int present;
8215 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8216 present = snd_hda_codec_read(codec, 0x1b, 0,
8217 AC_VERB_GET_PIN_SENSE, 0);
8218 present = (present & 0x80000000) != 0;
8220 /* mute internal speaker */
8221 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8222 HDA_AMP_MUTE, HDA_AMP_MUTE);
8223 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8224 HDA_AMP_MUTE, HDA_AMP_MUTE);
8225 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8226 HDA_AMP_MUTE, HDA_AMP_MUTE);
8227 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8228 HDA_AMP_MUTE, HDA_AMP_MUTE);
8229 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8230 HDA_AMP_MUTE, HDA_AMP_MUTE);
8232 /* unmute internal speaker if necessary */
8233 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8234 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8235 HDA_AMP_MUTE, mute);
8236 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8237 HDA_AMP_MUTE, mute);
8238 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8239 HDA_AMP_MUTE, mute);
8240 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8241 HDA_AMP_MUTE, mute);
8242 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8243 HDA_AMP_MUTE, mute);
8247 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8250 if ((res >> 26) == ALC880_HP_EVENT)
8251 alc888_lenovo_sky_front_automute(codec);
8255 * generic initialization of ADC, input mixers and output mixers
8257 static struct hda_verb alc883_auto_init_verbs[] = {
8259 * Unmute ADC0-2 and set the default input to mic-in
8261 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8263 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8264 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8266 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8268 * Note: PASD motherboards uses the Line In 2 as the input for
8269 * front panel mic (mic 2)
8271 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8279 * Set up output mixers (0x0c - 0x0f)
8281 /* set vol=0 to output mixers */
8282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8283 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8284 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8285 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8286 /* set up input amps for analog loopback */
8287 /* Amp Indices: DAC = 0, mixer = 1 */
8288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8290 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8291 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8293 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8294 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8295 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8296 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8297 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8299 /* FIXME: use matrix-type input source selection */
8300 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8305 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8311 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8317 static struct hda_verb alc888_asus_m90v_verbs[] = {
8318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8320 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8321 /* enable unsolicited event */
8322 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8323 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8327 static void alc883_nb_mic_automute(struct hda_codec *codec)
8329 unsigned int present;
8331 present = snd_hda_codec_read(codec, 0x18, 0,
8332 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8333 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8334 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8335 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8336 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8339 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8341 unsigned int present;
8344 present = snd_hda_codec_read(codec, 0x1b, 0,
8345 AC_VERB_GET_PIN_SENSE, 0)
8346 & AC_PINSENSE_PRESENCE;
8347 bits = present ? 0 : PIN_OUT;
8348 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8350 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8352 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8356 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8359 switch (res >> 26) {
8360 case ALC880_HP_EVENT:
8361 alc883_M90V_speaker_automute(codec);
8363 case ALC880_MIC_EVENT:
8364 alc883_nb_mic_automute(codec);
8369 static void alc883_mode2_inithook(struct hda_codec *codec)
8371 alc883_M90V_speaker_automute(codec);
8372 alc883_nb_mic_automute(codec);
8375 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8377 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8378 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8381 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8382 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8383 /* enable unsolicited event */
8384 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8388 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8390 unsigned int present;
8393 present = snd_hda_codec_read(codec, 0x14, 0,
8394 AC_VERB_GET_PIN_SENSE, 0)
8395 & AC_PINSENSE_PRESENCE;
8396 bits = present ? 0 : PIN_OUT;
8397 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8401 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8404 switch (res >> 26) {
8405 case ALC880_HP_EVENT:
8406 alc883_eee1601_speaker_automute(codec);
8411 static void alc883_eee1601_inithook(struct hda_codec *codec)
8413 alc883_eee1601_speaker_automute(codec);
8416 #ifdef CONFIG_SND_HDA_POWER_SAVE
8417 #define alc883_loopbacks alc880_loopbacks
8420 /* pcm configuration: identiacal with ALC880 */
8421 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8422 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8423 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8424 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8425 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8428 * configuration and preset
8430 static const char *alc883_models[ALC883_MODEL_LAST] = {
8431 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8432 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8433 [ALC883_3ST_6ch] = "3stack-6ch",
8434 [ALC883_6ST_DIG] = "6stack-dig",
8435 [ALC883_TARGA_DIG] = "targa-dig",
8436 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8437 [ALC883_ACER] = "acer",
8438 [ALC883_ACER_ASPIRE] = "acer-aspire",
8439 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8440 [ALC883_MEDION] = "medion",
8441 [ALC883_MEDION_MD2] = "medion-md2",
8442 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8443 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8444 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8445 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8446 [ALC888_LENOVO_SKY] = "lenovo-sky",
8447 [ALC883_HAIER_W66] = "haier-w66",
8448 [ALC888_3ST_HP] = "3stack-hp",
8449 [ALC888_6ST_DELL] = "6stack-dell",
8450 [ALC883_MITAC] = "mitac",
8451 [ALC883_CLEVO_M720] = "clevo-m720",
8452 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8453 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8454 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8455 [ALC1200_ASUS_P5Q] = "asus-p5q",
8456 [ALC883_AUTO] = "auto",
8459 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8460 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8461 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8462 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8463 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8464 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8465 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8466 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8467 ALC888_ACER_ASPIRE_4930G),
8468 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8469 ALC888_ACER_ASPIRE_4930G),
8470 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8471 ALC888_ACER_ASPIRE_4930G),
8472 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8473 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8474 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8475 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8476 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8477 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8478 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8479 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8480 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8481 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8482 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8483 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8484 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8485 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8486 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8487 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8488 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8489 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8490 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8491 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8492 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8493 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8494 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8495 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8496 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8497 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8498 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8499 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8500 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8501 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8502 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8503 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8504 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8505 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8506 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8507 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8508 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8509 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8510 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8511 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8512 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8513 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8514 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8515 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8516 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8517 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8518 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8519 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8520 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8521 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
8522 ALC883_FUJITSU_PI2515),
8523 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8524 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8525 ALC888_FUJITSU_XA3530),
8526 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8527 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8528 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8529 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8530 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8531 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8532 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8533 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8534 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8535 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8536 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8537 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8538 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8539 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8543 static struct alc_config_preset alc883_presets[] = {
8544 [ALC883_3ST_2ch_DIG] = {
8545 .mixers = { alc883_3ST_2ch_mixer },
8546 .init_verbs = { alc883_init_verbs },
8547 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8548 .dac_nids = alc883_dac_nids,
8549 .dig_out_nid = ALC883_DIGOUT_NID,
8550 .dig_in_nid = ALC883_DIGIN_NID,
8551 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8552 .channel_mode = alc883_3ST_2ch_modes,
8553 .input_mux = &alc883_capture_source,
8555 [ALC883_3ST_6ch_DIG] = {
8556 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8557 .init_verbs = { alc883_init_verbs },
8558 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8559 .dac_nids = alc883_dac_nids,
8560 .dig_out_nid = ALC883_DIGOUT_NID,
8561 .dig_in_nid = ALC883_DIGIN_NID,
8562 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8563 .channel_mode = alc883_3ST_6ch_modes,
8565 .input_mux = &alc883_capture_source,
8567 [ALC883_3ST_6ch] = {
8568 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8569 .init_verbs = { alc883_init_verbs },
8570 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8571 .dac_nids = alc883_dac_nids,
8572 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8573 .channel_mode = alc883_3ST_6ch_modes,
8575 .input_mux = &alc883_capture_source,
8577 [ALC883_3ST_6ch_INTEL] = {
8578 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8579 .init_verbs = { alc883_init_verbs },
8580 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8581 .dac_nids = alc883_dac_nids,
8582 .dig_out_nid = ALC883_DIGOUT_NID,
8583 .dig_in_nid = ALC883_DIGIN_NID,
8584 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8585 .channel_mode = alc883_3ST_6ch_intel_modes,
8587 .input_mux = &alc883_3stack_6ch_intel,
8589 [ALC883_6ST_DIG] = {
8590 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8591 .init_verbs = { alc883_init_verbs },
8592 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8593 .dac_nids = alc883_dac_nids,
8594 .dig_out_nid = ALC883_DIGOUT_NID,
8595 .dig_in_nid = ALC883_DIGIN_NID,
8596 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8597 .channel_mode = alc883_sixstack_modes,
8598 .input_mux = &alc883_capture_source,
8600 [ALC883_TARGA_DIG] = {
8601 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8602 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8603 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8604 .dac_nids = alc883_dac_nids,
8605 .dig_out_nid = ALC883_DIGOUT_NID,
8606 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8607 .channel_mode = alc883_3ST_6ch_modes,
8609 .input_mux = &alc883_capture_source,
8610 .unsol_event = alc883_tagra_unsol_event,
8611 .init_hook = alc883_tagra_automute,
8613 [ALC883_TARGA_2ch_DIG] = {
8614 .mixers = { alc883_tagra_2ch_mixer},
8615 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8616 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8617 .dac_nids = alc883_dac_nids,
8618 .adc_nids = alc883_adc_nids_alt,
8619 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8620 .dig_out_nid = ALC883_DIGOUT_NID,
8621 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8622 .channel_mode = alc883_3ST_2ch_modes,
8623 .input_mux = &alc883_capture_source,
8624 .unsol_event = alc883_tagra_unsol_event,
8625 .init_hook = alc883_tagra_automute,
8628 .mixers = { alc883_base_mixer },
8629 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8630 * and the headphone jack. Turn this on and rely on the
8631 * standard mute methods whenever the user wants to turn
8632 * these outputs off.
8634 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8635 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8636 .dac_nids = alc883_dac_nids,
8637 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8638 .channel_mode = alc883_3ST_2ch_modes,
8639 .input_mux = &alc883_capture_source,
8641 [ALC883_ACER_ASPIRE] = {
8642 .mixers = { alc883_acer_aspire_mixer },
8643 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8644 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8645 .dac_nids = alc883_dac_nids,
8646 .dig_out_nid = ALC883_DIGOUT_NID,
8647 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8648 .channel_mode = alc883_3ST_2ch_modes,
8649 .input_mux = &alc883_capture_source,
8650 .unsol_event = alc883_acer_aspire_unsol_event,
8651 .init_hook = alc883_acer_aspire_automute,
8653 [ALC888_ACER_ASPIRE_4930G] = {
8654 .mixers = { alc888_base_mixer,
8655 alc883_chmode_mixer },
8656 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8657 alc888_acer_aspire_4930g_verbs },
8658 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8659 .dac_nids = alc883_dac_nids,
8660 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8661 .adc_nids = alc883_adc_nids_rev,
8662 .capsrc_nids = alc883_capsrc_nids_rev,
8663 .dig_out_nid = ALC883_DIGOUT_NID,
8664 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8665 .channel_mode = alc883_3ST_6ch_modes,
8668 ARRAY_SIZE(alc888_2_capture_sources),
8669 .input_mux = alc888_2_capture_sources,
8670 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8671 .init_hook = alc888_acer_aspire_4930g_automute,
8674 .mixers = { alc883_fivestack_mixer,
8675 alc883_chmode_mixer },
8676 .init_verbs = { alc883_init_verbs,
8677 alc883_medion_eapd_verbs },
8678 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8679 .dac_nids = alc883_dac_nids,
8680 .adc_nids = alc883_adc_nids_alt,
8681 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8682 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8683 .channel_mode = alc883_sixstack_modes,
8684 .input_mux = &alc883_capture_source,
8686 [ALC883_MEDION_MD2] = {
8687 .mixers = { alc883_medion_md2_mixer},
8688 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8689 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8690 .dac_nids = alc883_dac_nids,
8691 .dig_out_nid = ALC883_DIGOUT_NID,
8692 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8693 .channel_mode = alc883_3ST_2ch_modes,
8694 .input_mux = &alc883_capture_source,
8695 .unsol_event = alc883_medion_md2_unsol_event,
8696 .init_hook = alc883_medion_md2_automute,
8698 [ALC883_LAPTOP_EAPD] = {
8699 .mixers = { alc883_base_mixer },
8700 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8701 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8702 .dac_nids = alc883_dac_nids,
8703 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8704 .channel_mode = alc883_3ST_2ch_modes,
8705 .input_mux = &alc883_capture_source,
8707 [ALC883_CLEVO_M720] = {
8708 .mixers = { alc883_clevo_m720_mixer },
8709 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8710 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8711 .dac_nids = alc883_dac_nids,
8712 .dig_out_nid = ALC883_DIGOUT_NID,
8713 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8714 .channel_mode = alc883_3ST_2ch_modes,
8715 .input_mux = &alc883_capture_source,
8716 .unsol_event = alc883_clevo_m720_unsol_event,
8717 .init_hook = alc883_clevo_m720_automute,
8719 [ALC883_LENOVO_101E_2ch] = {
8720 .mixers = { alc883_lenovo_101e_2ch_mixer},
8721 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8722 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8723 .dac_nids = alc883_dac_nids,
8724 .adc_nids = alc883_adc_nids_alt,
8725 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8726 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8727 .channel_mode = alc883_3ST_2ch_modes,
8728 .input_mux = &alc883_lenovo_101e_capture_source,
8729 .unsol_event = alc883_lenovo_101e_unsol_event,
8730 .init_hook = alc883_lenovo_101e_all_automute,
8732 [ALC883_LENOVO_NB0763] = {
8733 .mixers = { alc883_lenovo_nb0763_mixer },
8734 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8735 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8736 .dac_nids = alc883_dac_nids,
8737 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8738 .channel_mode = alc883_3ST_2ch_modes,
8740 .input_mux = &alc883_lenovo_nb0763_capture_source,
8741 .unsol_event = alc883_medion_md2_unsol_event,
8742 .init_hook = alc883_medion_md2_automute,
8744 [ALC888_LENOVO_MS7195_DIG] = {
8745 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8746 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8747 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8748 .dac_nids = alc883_dac_nids,
8749 .dig_out_nid = ALC883_DIGOUT_NID,
8750 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8751 .channel_mode = alc883_3ST_6ch_modes,
8753 .input_mux = &alc883_capture_source,
8754 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8755 .init_hook = alc888_lenovo_ms7195_front_automute,
8757 [ALC883_HAIER_W66] = {
8758 .mixers = { alc883_tagra_2ch_mixer},
8759 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8760 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8761 .dac_nids = alc883_dac_nids,
8762 .dig_out_nid = ALC883_DIGOUT_NID,
8763 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8764 .channel_mode = alc883_3ST_2ch_modes,
8765 .input_mux = &alc883_capture_source,
8766 .unsol_event = alc883_haier_w66_unsol_event,
8767 .init_hook = alc883_haier_w66_automute,
8770 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8771 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8772 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8773 .dac_nids = alc883_dac_nids,
8774 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8775 .channel_mode = alc888_3st_hp_modes,
8777 .input_mux = &alc883_capture_source,
8779 [ALC888_6ST_DELL] = {
8780 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8781 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8782 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8783 .dac_nids = alc883_dac_nids,
8784 .dig_out_nid = ALC883_DIGOUT_NID,
8785 .dig_in_nid = ALC883_DIGIN_NID,
8786 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8787 .channel_mode = alc883_sixstack_modes,
8788 .input_mux = &alc883_capture_source,
8789 .unsol_event = alc888_6st_dell_unsol_event,
8790 .init_hook = alc888_6st_dell_front_automute,
8793 .mixers = { alc883_mitac_mixer },
8794 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8795 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8796 .dac_nids = alc883_dac_nids,
8797 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8798 .channel_mode = alc883_3ST_2ch_modes,
8799 .input_mux = &alc883_capture_source,
8800 .unsol_event = alc883_mitac_unsol_event,
8801 .init_hook = alc883_mitac_automute,
8803 [ALC883_FUJITSU_PI2515] = {
8804 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8805 .init_verbs = { alc883_init_verbs,
8806 alc883_2ch_fujitsu_pi2515_verbs},
8807 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8808 .dac_nids = alc883_dac_nids,
8809 .dig_out_nid = ALC883_DIGOUT_NID,
8810 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8811 .channel_mode = alc883_3ST_2ch_modes,
8812 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8813 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8814 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8816 [ALC888_FUJITSU_XA3530] = {
8817 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8818 .init_verbs = { alc883_init_verbs,
8819 alc888_fujitsu_xa3530_verbs },
8820 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8821 .dac_nids = alc883_dac_nids,
8822 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8823 .adc_nids = alc883_adc_nids_rev,
8824 .capsrc_nids = alc883_capsrc_nids_rev,
8825 .dig_out_nid = ALC883_DIGOUT_NID,
8826 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8827 .channel_mode = alc888_4ST_8ch_intel_modes,
8829 ARRAY_SIZE(alc888_2_capture_sources),
8830 .input_mux = alc888_2_capture_sources,
8831 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8832 .init_hook = alc888_fujitsu_xa3530_automute,
8834 [ALC888_LENOVO_SKY] = {
8835 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8836 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8837 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8838 .dac_nids = alc883_dac_nids,
8839 .dig_out_nid = ALC883_DIGOUT_NID,
8840 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8841 .channel_mode = alc883_sixstack_modes,
8843 .input_mux = &alc883_lenovo_sky_capture_source,
8844 .unsol_event = alc883_lenovo_sky_unsol_event,
8845 .init_hook = alc888_lenovo_sky_front_automute,
8847 [ALC888_ASUS_M90V] = {
8848 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8849 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8850 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8851 .dac_nids = alc883_dac_nids,
8852 .dig_out_nid = ALC883_DIGOUT_NID,
8853 .dig_in_nid = ALC883_DIGIN_NID,
8854 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8855 .channel_mode = alc883_3ST_6ch_modes,
8857 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8858 .unsol_event = alc883_mode2_unsol_event,
8859 .init_hook = alc883_mode2_inithook,
8861 [ALC888_ASUS_EEE1601] = {
8862 .mixers = { alc883_asus_eee1601_mixer },
8863 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8864 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8865 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8866 .dac_nids = alc883_dac_nids,
8867 .dig_out_nid = ALC883_DIGOUT_NID,
8868 .dig_in_nid = ALC883_DIGIN_NID,
8869 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8870 .channel_mode = alc883_3ST_2ch_modes,
8872 .input_mux = &alc883_asus_eee1601_capture_source,
8873 .unsol_event = alc883_eee1601_unsol_event,
8874 .init_hook = alc883_eee1601_inithook,
8876 [ALC1200_ASUS_P5Q] = {
8877 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8878 .init_verbs = { alc883_init_verbs },
8879 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8880 .dac_nids = alc883_dac_nids,
8881 .dig_out_nid = ALC1200_DIGOUT_NID,
8882 .dig_in_nid = ALC883_DIGIN_NID,
8883 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8884 .channel_mode = alc883_sixstack_modes,
8885 .input_mux = &alc883_capture_source,
8891 * BIOS auto configuration
8893 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8894 hda_nid_t nid, int pin_type,
8898 struct alc_spec *spec = codec->spec;
8901 alc_set_pin_output(codec, nid, pin_type);
8902 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8905 idx = spec->multiout.dac_nids[dac_idx] - 2;
8906 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8910 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8912 struct alc_spec *spec = codec->spec;
8915 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8916 for (i = 0; i <= HDA_SIDE; i++) {
8917 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8918 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8920 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8925 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8927 struct alc_spec *spec = codec->spec;
8930 pin = spec->autocfg.hp_pins[0];
8931 if (pin) /* connect to front */
8933 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8934 pin = spec->autocfg.speaker_pins[0];
8936 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8939 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8940 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8942 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8944 struct alc_spec *spec = codec->spec;
8947 for (i = 0; i < AUTO_PIN_LAST; i++) {
8948 hda_nid_t nid = spec->autocfg.input_pins[i];
8949 if (alc883_is_input_pin(nid)) {
8950 snd_hda_codec_write(codec, nid, 0,
8951 AC_VERB_SET_PIN_WIDGET_CONTROL,
8952 (i <= AUTO_PIN_FRONT_MIC ?
8953 PIN_VREF80 : PIN_IN));
8954 if (nid != ALC883_PIN_CD_NID)
8955 snd_hda_codec_write(codec, nid, 0,
8956 AC_VERB_SET_AMP_GAIN_MUTE,
8962 #define alc883_auto_init_input_src alc882_auto_init_input_src
8964 /* almost identical with ALC880 parser... */
8965 static int alc883_parse_auto_config(struct hda_codec *codec)
8967 struct alc_spec *spec = codec->spec;
8968 int err = alc880_parse_auto_config(codec);
8973 return 0; /* no config found */
8975 err = alc_auto_add_mic_boost(codec);
8979 /* hack - override the init verbs */
8980 spec->init_verbs[0] = alc883_auto_init_verbs;
8982 return 1; /* config found */
8985 /* additional initialization for auto-configuration model */
8986 static void alc883_auto_init(struct hda_codec *codec)
8988 struct alc_spec *spec = codec->spec;
8989 alc883_auto_init_multi_out(codec);
8990 alc883_auto_init_hp_out(codec);
8991 alc883_auto_init_analog_input(codec);
8992 alc883_auto_init_input_src(codec);
8993 if (spec->unsol_event)
8994 alc_inithook(codec);
8997 static int patch_alc883(struct hda_codec *codec)
8999 struct alc_spec *spec;
9000 int err, board_config;
9002 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9008 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9010 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9013 if (board_config < 0) {
9014 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9015 "trying auto-probe from BIOS...\n");
9016 board_config = ALC883_AUTO;
9019 if (board_config == ALC883_AUTO) {
9020 /* automatic parse from the BIOS config */
9021 err = alc883_parse_auto_config(codec);
9027 "hda_codec: Cannot set up configuration "
9028 "from BIOS. Using base mode...\n");
9029 board_config = ALC883_3ST_2ch_DIG;
9033 if (board_config != ALC883_AUTO)
9034 setup_preset(spec, &alc883_presets[board_config]);
9036 switch (codec->vendor_id) {
9038 if (codec->revision_id == 0x100101) {
9039 spec->stream_name_analog = "ALC1200 Analog";
9040 spec->stream_name_digital = "ALC1200 Digital";
9042 spec->stream_name_analog = "ALC888 Analog";
9043 spec->stream_name_digital = "ALC888 Digital";
9047 spec->stream_name_analog = "ALC889 Analog";
9048 spec->stream_name_digital = "ALC889 Digital";
9051 spec->stream_name_analog = "ALC883 Analog";
9052 spec->stream_name_digital = "ALC883 Digital";
9056 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9057 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9058 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9060 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9061 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9063 if (!spec->num_adc_nids) {
9064 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9065 spec->adc_nids = alc883_adc_nids;
9067 if (!spec->capsrc_nids)
9068 spec->capsrc_nids = alc883_capsrc_nids;
9069 spec->is_mix_capture = 1; /* matrix-style capture */
9070 if (!spec->cap_mixer)
9071 set_capture_mixer(spec);
9073 spec->vmaster_nid = 0x0c;
9075 codec->patch_ops = alc_patch_ops;
9076 if (board_config == ALC883_AUTO)
9077 spec->init_hook = alc883_auto_init;
9079 #ifdef CONFIG_SND_HDA_POWER_SAVE
9080 if (!spec->loopback.amplist)
9081 spec->loopback.amplist = alc883_loopbacks;
9083 codec->proc_widget_hook = print_realtek_coef;
9092 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9093 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9095 #define alc262_dac_nids alc260_dac_nids
9096 #define alc262_adc_nids alc882_adc_nids
9097 #define alc262_adc_nids_alt alc882_adc_nids_alt
9098 #define alc262_capsrc_nids alc882_capsrc_nids
9099 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9101 #define alc262_modes alc260_modes
9102 #define alc262_capture_source alc882_capture_source
9104 static hda_nid_t alc262_dmic_adc_nids[1] = {
9109 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9111 static struct snd_kcontrol_new alc262_base_mixer[] = {
9112 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9113 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9114 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9115 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9116 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9117 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9120 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9121 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9122 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9123 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9124 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9125 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9126 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9128 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9129 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9133 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9135 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9138 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9139 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9142 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9143 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9144 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9145 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9146 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9147 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9148 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9153 /* update HP, line and mono-out pins according to the master switch */
9154 static void alc262_hp_master_update(struct hda_codec *codec)
9156 struct alc_spec *spec = codec->spec;
9157 int val = spec->master_sw;
9160 snd_hda_codec_write_cache(codec, 0x1b, 0,
9161 AC_VERB_SET_PIN_WIDGET_CONTROL,
9163 snd_hda_codec_write_cache(codec, 0x15, 0,
9164 AC_VERB_SET_PIN_WIDGET_CONTROL,
9166 /* mono (speaker) depending on the HP jack sense */
9167 val = val && !spec->jack_present;
9168 snd_hda_codec_write_cache(codec, 0x16, 0,
9169 AC_VERB_SET_PIN_WIDGET_CONTROL,
9173 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9175 struct alc_spec *spec = codec->spec;
9176 unsigned int presence;
9177 presence = snd_hda_codec_read(codec, 0x1b, 0,
9178 AC_VERB_GET_PIN_SENSE, 0);
9179 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9180 alc262_hp_master_update(codec);
9183 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9185 if ((res >> 26) != ALC880_HP_EVENT)
9187 alc262_hp_bpc_automute(codec);
9190 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9192 struct alc_spec *spec = codec->spec;
9193 unsigned int presence;
9194 presence = snd_hda_codec_read(codec, 0x15, 0,
9195 AC_VERB_GET_PIN_SENSE, 0);
9196 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9197 alc262_hp_master_update(codec);
9200 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9203 if ((res >> 26) != ALC880_HP_EVENT)
9205 alc262_hp_wildwest_automute(codec);
9208 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9209 struct snd_ctl_elem_value *ucontrol)
9211 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9212 struct alc_spec *spec = codec->spec;
9213 *ucontrol->value.integer.value = spec->master_sw;
9217 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9218 struct snd_ctl_elem_value *ucontrol)
9220 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9221 struct alc_spec *spec = codec->spec;
9222 int val = !!*ucontrol->value.integer.value;
9224 if (val == spec->master_sw)
9226 spec->master_sw = val;
9227 alc262_hp_master_update(codec);
9231 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9234 .name = "Master Playback Switch",
9235 .info = snd_ctl_boolean_mono_info,
9236 .get = alc262_hp_master_sw_get,
9237 .put = alc262_hp_master_sw_put,
9239 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9240 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9241 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9242 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9244 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9248 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9249 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9250 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9251 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9252 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9253 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9254 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9255 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9256 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9257 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9258 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9259 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9263 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9265 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9266 .name = "Master Playback Switch",
9267 .info = snd_ctl_boolean_mono_info,
9268 .get = alc262_hp_master_sw_get,
9269 .put = alc262_hp_master_sw_put,
9271 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9272 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9273 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9275 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9277 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9279 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9280 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9281 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9282 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9283 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9284 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9285 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9286 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9287 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9291 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9292 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9293 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9294 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9298 /* mute/unmute internal speaker according to the hp jack and mute state */
9299 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9301 struct alc_spec *spec = codec->spec;
9303 if (force || !spec->sense_updated) {
9304 unsigned int present;
9305 present = snd_hda_codec_read(codec, 0x15, 0,
9306 AC_VERB_GET_PIN_SENSE, 0);
9307 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9308 spec->sense_updated = 1;
9310 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9311 spec->jack_present ? HDA_AMP_MUTE : 0);
9314 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9317 if ((res >> 26) != ALC880_HP_EVENT)
9319 alc262_hp_t5735_automute(codec, 1);
9322 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9324 alc262_hp_t5735_automute(codec, 1);
9327 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9328 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9329 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9330 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9334 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9338 static struct hda_verb alc262_hp_t5735_verbs[] = {
9339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9342 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9346 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9347 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9348 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9349 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9350 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9351 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9352 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9356 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9357 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9358 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9359 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9360 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9361 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9362 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9363 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9370 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9377 /* bind hp and internal speaker mute (with plug check) */
9378 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9379 struct snd_ctl_elem_value *ucontrol)
9381 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9382 long *valp = ucontrol->value.integer.value;
9385 /* change hp mute */
9386 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9388 valp[0] ? 0 : HDA_AMP_MUTE);
9389 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9391 valp[1] ? 0 : HDA_AMP_MUTE);
9393 /* change speaker according to HP jack state */
9394 struct alc_spec *spec = codec->spec;
9396 if (spec->jack_present)
9397 mute = HDA_AMP_MUTE;
9399 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9401 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9402 HDA_AMP_MUTE, mute);
9407 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9408 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9410 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9411 .name = "Master Playback Switch",
9412 .info = snd_hda_mixer_amp_switch_info,
9413 .get = snd_hda_mixer_amp_switch_get,
9414 .put = alc262_sony_master_sw_put,
9415 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9418 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9419 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9420 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9424 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9425 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9426 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9430 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9431 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9435 #define alc262_capture_mixer alc882_capture_mixer
9436 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9439 * generic initialization of ADC, input mixers and output mixers
9441 static struct hda_verb alc262_init_verbs[] = {
9443 * Unmute ADC0-2 and set the default input to mic-in
9445 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9447 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9448 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9449 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9452 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9454 * Note: PASD motherboards uses the Line In 2 as the input for
9455 * front panel mic (mic 2)
9457 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9465 * Set up output mixers (0x0c - 0x0e)
9467 /* set vol=0 to output mixers */
9468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9471 /* set up input amps for analog loopback */
9472 /* Amp Indices: DAC = 0, mixer = 1 */
9473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9475 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9478 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9480 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9481 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9482 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9483 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9484 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9485 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9488 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9489 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9490 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9491 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9493 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9494 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9496 /* FIXME: use matrix-type input source selection */
9497 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9498 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9500 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9501 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9502 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9505 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9506 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9507 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9510 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9517 static struct hda_verb alc262_eapd_verbs[] = {
9518 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9519 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9523 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9524 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9529 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9530 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9531 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9532 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9534 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9535 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9539 static struct hda_verb alc262_sony_unsol_verbs[] = {
9540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9541 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9542 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9544 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9549 static struct hda_input_mux alc262_dmic_capture_source = {
9552 { "Int DMic", 0x9 },
9557 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9558 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9559 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9562 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9566 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9567 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9568 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9570 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9571 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9572 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9573 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9574 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9578 static void alc262_dmic_automute(struct hda_codec *codec)
9580 unsigned int present;
9582 present = snd_hda_codec_read(codec, 0x18, 0,
9583 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9584 snd_hda_codec_write(codec, 0x22, 0,
9585 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9588 /* toggle speaker-output according to the hp-jack state */
9589 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9591 unsigned int present;
9594 present = snd_hda_codec_read(codec, 0x15, 0,
9595 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9596 bits = present ? 0 : PIN_OUT;
9597 snd_hda_codec_write(codec, 0x14, 0,
9598 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9603 /* unsolicited event for HP jack sensing */
9604 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9607 if ((res >> 26) == ALC880_HP_EVENT)
9608 alc262_toshiba_s06_speaker_automute(codec);
9609 if ((res >> 26) == ALC880_MIC_EVENT)
9610 alc262_dmic_automute(codec);
9614 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9616 alc262_toshiba_s06_speaker_automute(codec);
9617 alc262_dmic_automute(codec);
9620 /* mute/unmute internal speaker according to the hp jack and mute state */
9621 static void alc262_hippo_automute(struct hda_codec *codec)
9623 struct alc_spec *spec = codec->spec;
9625 unsigned int present;
9627 /* need to execute and sync at first */
9628 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9629 present = snd_hda_codec_read(codec, 0x15, 0,
9630 AC_VERB_GET_PIN_SENSE, 0);
9631 spec->jack_present = (present & 0x80000000) != 0;
9632 if (spec->jack_present) {
9633 /* mute internal speaker */
9634 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9635 HDA_AMP_MUTE, HDA_AMP_MUTE);
9637 /* unmute internal speaker if necessary */
9638 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9639 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9640 HDA_AMP_MUTE, mute);
9644 /* unsolicited event for HP jack sensing */
9645 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9648 if ((res >> 26) != ALC880_HP_EVENT)
9650 alc262_hippo_automute(codec);
9653 static void alc262_hippo1_automute(struct hda_codec *codec)
9656 unsigned int present;
9658 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9659 present = snd_hda_codec_read(codec, 0x1b, 0,
9660 AC_VERB_GET_PIN_SENSE, 0);
9661 present = (present & 0x80000000) != 0;
9663 /* mute internal speaker */
9664 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9665 HDA_AMP_MUTE, HDA_AMP_MUTE);
9667 /* unmute internal speaker if necessary */
9668 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9669 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9670 HDA_AMP_MUTE, mute);
9674 /* unsolicited event for HP jack sensing */
9675 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9678 if ((res >> 26) != ALC880_HP_EVENT)
9680 alc262_hippo1_automute(codec);
9686 * 0x16 = internal speaker
9687 * 0x18 = external mic
9690 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9691 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9692 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9696 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9698 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9703 static struct hda_verb alc262_nec_verbs[] = {
9704 /* Unmute Speaker */
9705 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9708 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9711 /* External mic to headphone */
9712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9713 /* External mic to speaker */
9714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9720 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9721 * 0x1b = port replicator headphone out
9724 #define ALC_HP_EVENT 0x37
9726 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9727 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9729 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9730 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9734 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9735 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9736 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9740 static struct hda_input_mux alc262_fujitsu_capture_source = {
9749 static struct hda_input_mux alc262_HP_capture_source = {
9753 { "Front Mic", 0x1 },
9760 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9764 { "Front Mic", 0x2 },
9770 /* mute/unmute internal speaker according to the hp jacks and mute state */
9771 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9773 struct alc_spec *spec = codec->spec;
9776 if (force || !spec->sense_updated) {
9777 unsigned int present;
9778 /* need to execute and sync at first */
9779 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9780 /* check laptop HP jack */
9781 present = snd_hda_codec_read(codec, 0x14, 0,
9782 AC_VERB_GET_PIN_SENSE, 0);
9783 /* need to execute and sync at first */
9784 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9785 /* check docking HP jack */
9786 present |= snd_hda_codec_read(codec, 0x1b, 0,
9787 AC_VERB_GET_PIN_SENSE, 0);
9788 if (present & AC_PINSENSE_PRESENCE)
9789 spec->jack_present = 1;
9791 spec->jack_present = 0;
9792 spec->sense_updated = 1;
9794 /* unmute internal speaker only if both HPs are unplugged and
9795 * master switch is on
9797 if (spec->jack_present)
9798 mute = HDA_AMP_MUTE;
9800 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9801 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9802 HDA_AMP_MUTE, mute);
9805 /* unsolicited event for HP jack sensing */
9806 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9809 if ((res >> 26) != ALC_HP_EVENT)
9811 alc262_fujitsu_automute(codec, 1);
9814 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9816 alc262_fujitsu_automute(codec, 1);
9819 /* bind volumes of both NID 0x0c and 0x0d */
9820 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9821 .ops = &snd_hda_bind_vol,
9823 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9824 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9829 /* mute/unmute internal speaker according to the hp jack and mute state */
9830 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9832 struct alc_spec *spec = codec->spec;
9835 if (force || !spec->sense_updated) {
9836 unsigned int present_int_hp;
9837 /* need to execute and sync at first */
9838 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9839 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9840 AC_VERB_GET_PIN_SENSE, 0);
9841 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9842 spec->sense_updated = 1;
9844 if (spec->jack_present) {
9845 /* mute internal speaker */
9846 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9847 HDA_AMP_MUTE, HDA_AMP_MUTE);
9848 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9849 HDA_AMP_MUTE, HDA_AMP_MUTE);
9851 /* unmute internal speaker if necessary */
9852 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9853 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9854 HDA_AMP_MUTE, mute);
9855 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9856 HDA_AMP_MUTE, mute);
9860 /* unsolicited event for HP jack sensing */
9861 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9864 if ((res >> 26) != ALC_HP_EVENT)
9866 alc262_lenovo_3000_automute(codec, 1);
9869 /* bind hp and internal speaker mute (with plug check) */
9870 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9871 struct snd_ctl_elem_value *ucontrol)
9873 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9874 long *valp = ucontrol->value.integer.value;
9877 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9879 valp ? 0 : HDA_AMP_MUTE);
9880 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9882 valp ? 0 : HDA_AMP_MUTE);
9885 alc262_fujitsu_automute(codec, 0);
9889 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9890 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9892 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9893 .name = "Master Playback Switch",
9894 .info = snd_hda_mixer_amp_switch_info,
9895 .get = snd_hda_mixer_amp_switch_get,
9896 .put = alc262_fujitsu_master_sw_put,
9897 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9899 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9900 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9901 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9902 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9903 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9906 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9907 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9908 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9912 /* bind hp and internal speaker mute (with plug check) */
9913 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9914 struct snd_ctl_elem_value *ucontrol)
9916 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9917 long *valp = ucontrol->value.integer.value;
9920 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9922 valp ? 0 : HDA_AMP_MUTE);
9925 alc262_lenovo_3000_automute(codec, 0);
9929 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9930 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9932 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9933 .name = "Master Playback Switch",
9934 .info = snd_hda_mixer_amp_switch_info,
9935 .get = snd_hda_mixer_amp_switch_get,
9936 .put = alc262_lenovo_3000_master_sw_put,
9937 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9941 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9944 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9945 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9946 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9950 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9951 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9953 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9954 .name = "Master Playback Switch",
9955 .info = snd_hda_mixer_amp_switch_info,
9956 .get = snd_hda_mixer_amp_switch_get,
9957 .put = alc262_sony_master_sw_put,
9958 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9962 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9963 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9964 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9965 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9969 /* additional init verbs for Benq laptops */
9970 static struct hda_verb alc262_EAPD_verbs[] = {
9971 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9972 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9976 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9977 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9978 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9980 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9981 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9985 /* Samsung Q1 Ultra Vista model setup */
9986 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9987 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9988 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9991 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9992 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9996 static struct hda_verb alc262_ultra_verbs[] = {
9998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10003 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10005 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10009 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10010 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10011 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10013 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10015 /* ADC, choose mic */
10016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10019 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10020 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10021 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10022 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10023 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10024 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10025 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10029 /* mute/unmute internal speaker according to the hp jack and mute state */
10030 static void alc262_ultra_automute(struct hda_codec *codec)
10032 struct alc_spec *spec = codec->spec;
10036 /* auto-mute only when HP is used as HP */
10037 if (!spec->cur_mux[0]) {
10038 unsigned int present;
10039 /* need to execute and sync at first */
10040 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10041 present = snd_hda_codec_read(codec, 0x15, 0,
10042 AC_VERB_GET_PIN_SENSE, 0);
10043 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10044 if (spec->jack_present)
10045 mute = HDA_AMP_MUTE;
10047 /* mute/unmute internal speaker */
10048 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10049 HDA_AMP_MUTE, mute);
10050 /* mute/unmute HP */
10051 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10052 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10055 /* unsolicited event for HP jack sensing */
10056 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10059 if ((res >> 26) != ALC880_HP_EVENT)
10061 alc262_ultra_automute(codec);
10064 static struct hda_input_mux alc262_ultra_capture_source = {
10068 { "Headphone", 0x7 },
10072 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10073 struct snd_ctl_elem_value *ucontrol)
10075 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10076 struct alc_spec *spec = codec->spec;
10079 ret = alc_mux_enum_put(kcontrol, ucontrol);
10082 /* reprogram the HP pin as mic or HP according to the input source */
10083 snd_hda_codec_write_cache(codec, 0x15, 0,
10084 AC_VERB_SET_PIN_WIDGET_CONTROL,
10085 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10086 alc262_ultra_automute(codec); /* mute/unmute HP */
10090 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10091 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10092 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10094 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10095 .name = "Capture Source",
10096 .info = alc_mux_enum_info,
10097 .get = alc_mux_enum_get,
10098 .put = alc262_ultra_mux_enum_put,
10103 /* add playback controls from the parsed DAC table */
10104 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10105 const struct auto_pin_cfg *cfg)
10110 spec->multiout.num_dacs = 1; /* only use one dac */
10111 spec->multiout.dac_nids = spec->private_dac_nids;
10112 spec->multiout.dac_nids[0] = 2;
10114 nid = cfg->line_out_pins[0];
10116 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10117 "Front Playback Volume",
10118 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10121 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10122 "Front Playback Switch",
10123 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10128 nid = cfg->speaker_pins[0];
10131 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10132 "Speaker Playback Volume",
10133 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10137 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10138 "Speaker Playback Switch",
10139 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10144 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10145 "Speaker Playback Switch",
10146 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10152 nid = cfg->hp_pins[0];
10154 /* spec->multiout.hp_nid = 2; */
10156 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10157 "Headphone Playback Volume",
10158 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10162 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10163 "Headphone Playback Switch",
10164 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10169 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10170 "Headphone Playback Switch",
10171 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10180 /* identical with ALC880 */
10181 #define alc262_auto_create_analog_input_ctls \
10182 alc880_auto_create_analog_input_ctls
10185 * generic initialization of ADC, input mixers and output mixers
10187 static struct hda_verb alc262_volume_init_verbs[] = {
10189 * Unmute ADC0-2 and set the default input to mic-in
10191 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10192 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10193 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10194 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10195 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10196 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10198 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10200 * Note: PASD motherboards uses the Line In 2 as the input for
10201 * front panel mic (mic 2)
10203 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10205 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10206 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10207 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10208 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10211 * Set up output mixers (0x0c - 0x0f)
10213 /* set vol=0 to output mixers */
10214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10215 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10216 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10218 /* set up input amps for analog loopback */
10219 /* Amp Indices: DAC = 0, mixer = 1 */
10220 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10221 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10222 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10223 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10224 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10225 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10227 /* FIXME: use matrix-type input source selection */
10228 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10229 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10235 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10236 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10237 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10238 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10240 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10241 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10242 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10243 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10248 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10250 * Unmute ADC0-2 and set the default input to mic-in
10252 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10253 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10254 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10255 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10256 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10257 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10259 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10261 * Note: PASD motherboards uses the Line In 2 as the input for
10262 * front panel mic (mic 2)
10264 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10266 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10274 * Set up output mixers (0x0c - 0x0e)
10276 /* set vol=0 to output mixers */
10277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10278 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10279 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10281 /* set up input amps for analog loopback */
10282 /* Amp Indices: DAC = 0, mixer = 1 */
10283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10285 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10286 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10287 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10290 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10291 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10292 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10294 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10295 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10297 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10301 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10302 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10304 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10307 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10308 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10309 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10310 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10311 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10314 /* FIXME: use matrix-type input source selection */
10315 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10316 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10320 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10322 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10327 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10332 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10337 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10339 * Unmute ADC0-2 and set the default input to mic-in
10341 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10343 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10344 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10345 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10346 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10348 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10350 * Note: PASD motherboards uses the Line In 2 as the input for front
10351 * panel mic (mic 2)
10353 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10358 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10359 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10360 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10361 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10363 * Set up output mixers (0x0c - 0x0e)
10365 /* set vol=0 to output mixers */
10366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10370 /* set up input amps for analog loopback */
10371 /* Amp Indices: DAC = 0, mixer = 1 */
10372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10375 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10377 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10380 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10381 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10382 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10383 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10384 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10386 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10388 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10389 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10391 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10392 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10394 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10395 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10396 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10397 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10398 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10399 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10401 /* FIXME: use matrix-type input source selection */
10402 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10403 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10408 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10409 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10410 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10414 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10415 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10416 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10417 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10425 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10426 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10428 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10433 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10435 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10436 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10437 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10439 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10441 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10442 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10444 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10446 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10451 #ifdef CONFIG_SND_HDA_POWER_SAVE
10452 #define alc262_loopbacks alc880_loopbacks
10455 /* pcm configuration: identiacal with ALC880 */
10456 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10457 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10458 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10459 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10462 * BIOS auto configuration
10464 static int alc262_parse_auto_config(struct hda_codec *codec)
10466 struct alc_spec *spec = codec->spec;
10468 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10470 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10474 if (!spec->autocfg.line_outs)
10475 return 0; /* can't find valid BIOS pin config */
10476 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10479 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10483 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10485 if (spec->autocfg.dig_out_pin)
10486 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10487 if (spec->autocfg.dig_in_pin)
10488 spec->dig_in_nid = ALC262_DIGIN_NID;
10490 if (spec->kctls.list)
10491 add_mixer(spec, spec->kctls.list);
10493 add_verb(spec, alc262_volume_init_verbs);
10494 spec->num_mux_defs = 1;
10495 spec->input_mux = &spec->private_imux;
10497 err = alc_auto_add_mic_boost(codec);
10501 store_pin_configs(codec);
10505 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10506 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10507 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10508 #define alc262_auto_init_input_src alc882_auto_init_input_src
10511 /* init callback for auto-configuration model -- overriding the default init */
10512 static void alc262_auto_init(struct hda_codec *codec)
10514 struct alc_spec *spec = codec->spec;
10515 alc262_auto_init_multi_out(codec);
10516 alc262_auto_init_hp_out(codec);
10517 alc262_auto_init_analog_input(codec);
10518 alc262_auto_init_input_src(codec);
10519 if (spec->unsol_event)
10520 alc_inithook(codec);
10524 * configuration and preset
10526 static const char *alc262_models[ALC262_MODEL_LAST] = {
10527 [ALC262_BASIC] = "basic",
10528 [ALC262_HIPPO] = "hippo",
10529 [ALC262_HIPPO_1] = "hippo_1",
10530 [ALC262_FUJITSU] = "fujitsu",
10531 [ALC262_HP_BPC] = "hp-bpc",
10532 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10533 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10534 [ALC262_HP_RP5700] = "hp-rp5700",
10535 [ALC262_BENQ_ED8] = "benq",
10536 [ALC262_BENQ_T31] = "benq-t31",
10537 [ALC262_SONY_ASSAMD] = "sony-assamd",
10538 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10539 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10540 [ALC262_ULTRA] = "ultra",
10541 [ALC262_LENOVO_3000] = "lenovo-3000",
10542 [ALC262_NEC] = "nec",
10543 [ALC262_AUTO] = "auto",
10546 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10547 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10548 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10549 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10550 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10551 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10552 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10553 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10554 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10555 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10556 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10557 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10558 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10559 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10560 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10561 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10562 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10563 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10564 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10565 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10566 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10567 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10568 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10569 ALC262_HP_TC_T5735),
10570 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10571 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10572 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10573 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10574 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10575 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10576 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10577 ALC262_SONY_ASSAMD),
10578 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10579 ALC262_TOSHIBA_RX1),
10580 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10581 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10582 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10583 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10584 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10585 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10586 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10587 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10588 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10589 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10593 static struct alc_config_preset alc262_presets[] = {
10595 .mixers = { alc262_base_mixer },
10596 .init_verbs = { alc262_init_verbs },
10597 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10598 .dac_nids = alc262_dac_nids,
10600 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10601 .channel_mode = alc262_modes,
10602 .input_mux = &alc262_capture_source,
10605 .mixers = { alc262_base_mixer },
10606 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10607 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10608 .dac_nids = alc262_dac_nids,
10610 .dig_out_nid = ALC262_DIGOUT_NID,
10611 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10612 .channel_mode = alc262_modes,
10613 .input_mux = &alc262_capture_source,
10614 .unsol_event = alc262_hippo_unsol_event,
10615 .init_hook = alc262_hippo_automute,
10617 [ALC262_HIPPO_1] = {
10618 .mixers = { alc262_hippo1_mixer },
10619 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10620 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10621 .dac_nids = alc262_dac_nids,
10623 .dig_out_nid = ALC262_DIGOUT_NID,
10624 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10625 .channel_mode = alc262_modes,
10626 .input_mux = &alc262_capture_source,
10627 .unsol_event = alc262_hippo1_unsol_event,
10628 .init_hook = alc262_hippo1_automute,
10630 [ALC262_FUJITSU] = {
10631 .mixers = { alc262_fujitsu_mixer },
10632 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10633 alc262_fujitsu_unsol_verbs },
10634 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10635 .dac_nids = alc262_dac_nids,
10637 .dig_out_nid = ALC262_DIGOUT_NID,
10638 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10639 .channel_mode = alc262_modes,
10640 .input_mux = &alc262_fujitsu_capture_source,
10641 .unsol_event = alc262_fujitsu_unsol_event,
10642 .init_hook = alc262_fujitsu_init_hook,
10644 [ALC262_HP_BPC] = {
10645 .mixers = { alc262_HP_BPC_mixer },
10646 .init_verbs = { alc262_HP_BPC_init_verbs },
10647 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10648 .dac_nids = alc262_dac_nids,
10650 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10651 .channel_mode = alc262_modes,
10652 .input_mux = &alc262_HP_capture_source,
10653 .unsol_event = alc262_hp_bpc_unsol_event,
10654 .init_hook = alc262_hp_bpc_automute,
10656 [ALC262_HP_BPC_D7000_WF] = {
10657 .mixers = { alc262_HP_BPC_WildWest_mixer },
10658 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10659 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10660 .dac_nids = alc262_dac_nids,
10662 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10663 .channel_mode = alc262_modes,
10664 .input_mux = &alc262_HP_D7000_capture_source,
10665 .unsol_event = alc262_hp_wildwest_unsol_event,
10666 .init_hook = alc262_hp_wildwest_automute,
10668 [ALC262_HP_BPC_D7000_WL] = {
10669 .mixers = { alc262_HP_BPC_WildWest_mixer,
10670 alc262_HP_BPC_WildWest_option_mixer },
10671 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10672 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10673 .dac_nids = alc262_dac_nids,
10675 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10676 .channel_mode = alc262_modes,
10677 .input_mux = &alc262_HP_D7000_capture_source,
10678 .unsol_event = alc262_hp_wildwest_unsol_event,
10679 .init_hook = alc262_hp_wildwest_automute,
10681 [ALC262_HP_TC_T5735] = {
10682 .mixers = { alc262_hp_t5735_mixer },
10683 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10684 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10685 .dac_nids = alc262_dac_nids,
10687 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10688 .channel_mode = alc262_modes,
10689 .input_mux = &alc262_capture_source,
10690 .unsol_event = alc262_hp_t5735_unsol_event,
10691 .init_hook = alc262_hp_t5735_init_hook,
10693 [ALC262_HP_RP5700] = {
10694 .mixers = { alc262_hp_rp5700_mixer },
10695 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10696 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10697 .dac_nids = alc262_dac_nids,
10698 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10699 .channel_mode = alc262_modes,
10700 .input_mux = &alc262_hp_rp5700_capture_source,
10702 [ALC262_BENQ_ED8] = {
10703 .mixers = { alc262_base_mixer },
10704 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10705 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10706 .dac_nids = alc262_dac_nids,
10708 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10709 .channel_mode = alc262_modes,
10710 .input_mux = &alc262_capture_source,
10712 [ALC262_SONY_ASSAMD] = {
10713 .mixers = { alc262_sony_mixer },
10714 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10715 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10716 .dac_nids = alc262_dac_nids,
10718 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10719 .channel_mode = alc262_modes,
10720 .input_mux = &alc262_capture_source,
10721 .unsol_event = alc262_hippo_unsol_event,
10722 .init_hook = alc262_hippo_automute,
10724 [ALC262_BENQ_T31] = {
10725 .mixers = { alc262_benq_t31_mixer },
10726 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10727 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10728 .dac_nids = alc262_dac_nids,
10730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10731 .channel_mode = alc262_modes,
10732 .input_mux = &alc262_capture_source,
10733 .unsol_event = alc262_hippo_unsol_event,
10734 .init_hook = alc262_hippo_automute,
10737 .mixers = { alc262_ultra_mixer },
10738 .cap_mixer = alc262_ultra_capture_mixer,
10739 .init_verbs = { alc262_ultra_verbs },
10740 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10741 .dac_nids = alc262_dac_nids,
10742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10743 .channel_mode = alc262_modes,
10744 .input_mux = &alc262_ultra_capture_source,
10745 .adc_nids = alc262_adc_nids, /* ADC0 */
10746 .capsrc_nids = alc262_capsrc_nids,
10747 .num_adc_nids = 1, /* single ADC */
10748 .unsol_event = alc262_ultra_unsol_event,
10749 .init_hook = alc262_ultra_automute,
10751 [ALC262_LENOVO_3000] = {
10752 .mixers = { alc262_lenovo_3000_mixer },
10753 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10754 alc262_lenovo_3000_unsol_verbs },
10755 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10756 .dac_nids = alc262_dac_nids,
10758 .dig_out_nid = ALC262_DIGOUT_NID,
10759 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10760 .channel_mode = alc262_modes,
10761 .input_mux = &alc262_fujitsu_capture_source,
10762 .unsol_event = alc262_lenovo_3000_unsol_event,
10765 .mixers = { alc262_nec_mixer },
10766 .init_verbs = { alc262_nec_verbs },
10767 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10768 .dac_nids = alc262_dac_nids,
10770 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10771 .channel_mode = alc262_modes,
10772 .input_mux = &alc262_capture_source,
10774 [ALC262_TOSHIBA_S06] = {
10775 .mixers = { alc262_toshiba_s06_mixer },
10776 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10777 alc262_eapd_verbs },
10778 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10779 .capsrc_nids = alc262_dmic_capsrc_nids,
10780 .dac_nids = alc262_dac_nids,
10781 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10782 .dig_out_nid = ALC262_DIGOUT_NID,
10783 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10784 .channel_mode = alc262_modes,
10785 .input_mux = &alc262_dmic_capture_source,
10786 .unsol_event = alc262_toshiba_s06_unsol_event,
10787 .init_hook = alc262_toshiba_s06_init_hook,
10789 [ALC262_TOSHIBA_RX1] = {
10790 .mixers = { alc262_toshiba_rx1_mixer },
10791 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10792 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10793 .dac_nids = alc262_dac_nids,
10795 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10796 .channel_mode = alc262_modes,
10797 .input_mux = &alc262_capture_source,
10798 .unsol_event = alc262_hippo_unsol_event,
10799 .init_hook = alc262_hippo_automute,
10803 static int patch_alc262(struct hda_codec *codec)
10805 struct alc_spec *spec;
10809 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10813 codec->spec = spec;
10815 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10820 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10821 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10822 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10823 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10827 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10829 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10833 if (board_config < 0) {
10834 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10835 "trying auto-probe from BIOS...\n");
10836 board_config = ALC262_AUTO;
10839 if (board_config == ALC262_AUTO) {
10840 /* automatic parse from the BIOS config */
10841 err = alc262_parse_auto_config(codec);
10847 "hda_codec: Cannot set up configuration "
10848 "from BIOS. Using base mode...\n");
10849 board_config = ALC262_BASIC;
10853 if (board_config != ALC262_AUTO)
10854 setup_preset(spec, &alc262_presets[board_config]);
10856 spec->stream_name_analog = "ALC262 Analog";
10857 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10858 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10860 spec->stream_name_digital = "ALC262 Digital";
10861 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10862 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10864 spec->is_mix_capture = 1;
10865 if (!spec->adc_nids && spec->input_mux) {
10866 /* check whether NID 0x07 is valid */
10867 unsigned int wcap = get_wcaps(codec, 0x07);
10870 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10871 if (wcap != AC_WID_AUD_IN) {
10872 spec->adc_nids = alc262_adc_nids_alt;
10873 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10874 spec->capsrc_nids = alc262_capsrc_nids_alt;
10876 spec->adc_nids = alc262_adc_nids;
10877 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10878 spec->capsrc_nids = alc262_capsrc_nids;
10881 if (!spec->cap_mixer)
10882 set_capture_mixer(spec);
10884 spec->vmaster_nid = 0x0c;
10886 codec->patch_ops = alc_patch_ops;
10887 if (board_config == ALC262_AUTO)
10888 spec->init_hook = alc262_auto_init;
10889 #ifdef CONFIG_SND_HDA_POWER_SAVE
10890 if (!spec->loopback.amplist)
10891 spec->loopback.amplist = alc262_loopbacks;
10893 codec->proc_widget_hook = print_realtek_coef;
10899 * ALC268 channel source setting (2 channel)
10901 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10902 #define alc268_modes alc260_modes
10904 static hda_nid_t alc268_dac_nids[2] = {
10909 static hda_nid_t alc268_adc_nids[2] = {
10914 static hda_nid_t alc268_adc_nids_alt[1] = {
10919 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10921 static struct snd_kcontrol_new alc268_base_mixer[] = {
10922 /* output mixer control */
10923 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10924 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10925 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10926 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10927 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10928 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10929 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10933 /* bind Beep switches of both NID 0x0f and 0x10 */
10934 static struct hda_bind_ctls alc268_bind_beep_sw = {
10935 .ops = &snd_hda_bind_sw,
10937 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10938 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10943 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10944 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10945 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10949 static struct hda_verb alc268_eapd_verbs[] = {
10950 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10951 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10955 /* Toshiba specific */
10956 #define alc268_toshiba_automute alc262_hippo_automute
10958 static struct hda_verb alc268_toshiba_verbs[] = {
10959 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10963 static struct hda_input_mux alc268_acer_lc_capture_source = {
10971 /* Acer specific */
10972 /* bind volumes of both NID 0x02 and 0x03 */
10973 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10974 .ops = &snd_hda_bind_vol,
10976 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10977 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10982 /* mute/unmute internal speaker according to the hp jack and mute state */
10983 static void alc268_acer_automute(struct hda_codec *codec, int force)
10985 struct alc_spec *spec = codec->spec;
10988 if (force || !spec->sense_updated) {
10989 unsigned int present;
10990 present = snd_hda_codec_read(codec, 0x14, 0,
10991 AC_VERB_GET_PIN_SENSE, 0);
10992 spec->jack_present = (present & 0x80000000) != 0;
10993 spec->sense_updated = 1;
10995 if (spec->jack_present)
10996 mute = HDA_AMP_MUTE; /* mute internal speaker */
10997 else /* unmute internal speaker if necessary */
10998 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10999 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11000 HDA_AMP_MUTE, mute);
11004 /* bind hp and internal speaker mute (with plug check) */
11005 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11006 struct snd_ctl_elem_value *ucontrol)
11008 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11009 long *valp = ucontrol->value.integer.value;
11012 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11014 valp[0] ? 0 : HDA_AMP_MUTE);
11015 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11017 valp[1] ? 0 : HDA_AMP_MUTE);
11019 alc268_acer_automute(codec, 0);
11023 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11024 /* output mixer control */
11025 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11028 .name = "Master Playback Switch",
11029 .info = snd_hda_mixer_amp_switch_info,
11030 .get = snd_hda_mixer_amp_switch_get,
11031 .put = alc268_acer_master_sw_put,
11032 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11034 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11038 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11039 /* output mixer control */
11040 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11042 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11043 .name = "Master Playback Switch",
11044 .info = snd_hda_mixer_amp_switch_info,
11045 .get = snd_hda_mixer_amp_switch_get,
11046 .put = alc268_acer_master_sw_put,
11047 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11050 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11051 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11055 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11056 /* output mixer control */
11057 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11060 .name = "Master Playback Switch",
11061 .info = snd_hda_mixer_amp_switch_info,
11062 .get = snd_hda_mixer_amp_switch_get,
11063 .put = alc268_acer_master_sw_put,
11064 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11066 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11067 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11071 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11072 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11073 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11074 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11075 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11076 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11077 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11081 static struct hda_verb alc268_acer_verbs[] = {
11082 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11083 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11085 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11086 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11087 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11088 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11092 /* unsolicited event for HP jack sensing */
11093 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11096 if ((res >> 26) != ALC880_HP_EVENT)
11098 alc268_toshiba_automute(codec);
11101 static void alc268_acer_unsol_event(struct hda_codec *codec,
11104 if ((res >> 26) != ALC880_HP_EVENT)
11106 alc268_acer_automute(codec, 1);
11109 static void alc268_acer_init_hook(struct hda_codec *codec)
11111 alc268_acer_automute(codec, 1);
11114 /* toggle speaker-output according to the hp-jack state */
11115 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11117 unsigned int present;
11118 unsigned char bits;
11120 present = snd_hda_codec_read(codec, 0x15, 0,
11121 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11122 bits = present ? AMP_IN_MUTE(0) : 0;
11123 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11124 AMP_IN_MUTE(0), bits);
11125 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11126 AMP_IN_MUTE(0), bits);
11130 static void alc268_acer_mic_automute(struct hda_codec *codec)
11132 unsigned int present;
11134 present = snd_hda_codec_read(codec, 0x18, 0,
11135 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11136 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11137 present ? 0x0 : 0x6);
11140 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11143 if ((res >> 26) == ALC880_HP_EVENT)
11144 alc268_aspire_one_speaker_automute(codec);
11145 if ((res >> 26) == ALC880_MIC_EVENT)
11146 alc268_acer_mic_automute(codec);
11149 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11151 alc268_aspire_one_speaker_automute(codec);
11152 alc268_acer_mic_automute(codec);
11155 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11156 /* output mixer control */
11157 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11158 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11159 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11161 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11162 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11166 static struct hda_verb alc268_dell_verbs[] = {
11167 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11168 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11169 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11173 /* mute/unmute internal speaker according to the hp jack and mute state */
11174 static void alc268_dell_automute(struct hda_codec *codec)
11176 unsigned int present;
11179 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11180 if (present & 0x80000000)
11181 mute = HDA_AMP_MUTE;
11183 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11184 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11185 HDA_AMP_MUTE, mute);
11188 static void alc268_dell_unsol_event(struct hda_codec *codec,
11191 if ((res >> 26) != ALC880_HP_EVENT)
11193 alc268_dell_automute(codec);
11196 #define alc268_dell_init_hook alc268_dell_automute
11198 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11199 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11200 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11201 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11203 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11204 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11205 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11206 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11210 static struct hda_verb alc267_quanta_il1_verbs[] = {
11211 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11212 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11216 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11218 unsigned int present;
11220 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11221 & AC_PINSENSE_PRESENCE;
11222 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11223 present ? 0 : PIN_OUT);
11226 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11228 unsigned int present;
11230 present = snd_hda_codec_read(codec, 0x18, 0,
11231 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11232 snd_hda_codec_write(codec, 0x23, 0,
11233 AC_VERB_SET_CONNECT_SEL,
11234 present ? 0x00 : 0x01);
11237 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11239 alc267_quanta_il1_hp_automute(codec);
11240 alc267_quanta_il1_mic_automute(codec);
11243 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11246 switch (res >> 26) {
11247 case ALC880_HP_EVENT:
11248 alc267_quanta_il1_hp_automute(codec);
11250 case ALC880_MIC_EVENT:
11251 alc267_quanta_il1_mic_automute(codec);
11257 * generic initialization of ADC, input mixers and output mixers
11259 static struct hda_verb alc268_base_init_verbs[] = {
11260 /* Unmute DAC0-1 and set vol = 0 */
11261 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11262 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11263 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11264 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11265 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11266 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11269 * Set up output mixers (0x0c - 0x0e)
11271 /* set vol=0 to output mixers */
11272 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11273 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11274 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11275 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11277 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11278 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11280 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11281 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11282 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11283 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11284 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11286 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11287 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11289 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11290 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11291 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11293 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11294 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11295 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11297 /* set PCBEEP vol = 0, mute connections */
11298 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11299 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11300 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11302 /* Unmute Selector 23h,24h and set the default input to mic-in */
11304 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11306 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11307 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11313 * generic initialization of ADC, input mixers and output mixers
11315 static struct hda_verb alc268_volume_init_verbs[] = {
11316 /* set output DAC */
11317 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11318 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11319 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11320 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11322 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11323 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11324 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11325 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11326 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11329 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11330 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11331 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11332 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11334 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11335 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11336 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11337 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11339 /* set PCBEEP vol = 0, mute connections */
11340 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11341 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11342 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11347 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11348 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11349 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11351 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11352 /* The multiple "Capture Source" controls confuse alsamixer
11353 * So call somewhat different..
11355 /* .name = "Capture Source", */
11356 .name = "Input Source",
11358 .info = alc_mux_enum_info,
11359 .get = alc_mux_enum_get,
11360 .put = alc_mux_enum_put,
11365 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11366 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11367 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11368 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11369 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11372 /* The multiple "Capture Source" controls confuse alsamixer
11373 * So call somewhat different..
11375 /* .name = "Capture Source", */
11376 .name = "Input Source",
11378 .info = alc_mux_enum_info,
11379 .get = alc_mux_enum_get,
11380 .put = alc_mux_enum_put,
11385 static struct hda_input_mux alc268_capture_source = {
11389 { "Front Mic", 0x1 },
11395 static struct hda_input_mux alc268_acer_capture_source = {
11399 { "Internal Mic", 0x1 },
11404 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11408 { "Internal Mic", 0x6 },
11413 #ifdef CONFIG_SND_DEBUG
11414 static struct snd_kcontrol_new alc268_test_mixer[] = {
11415 /* Volume widgets */
11416 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11417 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11418 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11419 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11420 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11421 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11422 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11423 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11424 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11425 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11426 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11427 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11428 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11429 /* The below appears problematic on some hardwares */
11430 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11431 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11432 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11433 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11434 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11436 /* Modes for retasking pin widgets */
11437 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11438 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11439 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11440 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11442 /* Controls for GPIO pins, assuming they are configured as outputs */
11443 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11444 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11445 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11446 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11448 /* Switches to allow the digital SPDIF output pin to be enabled.
11449 * The ALC268 does not have an SPDIF input.
11451 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11453 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11454 * this output to turn on an external amplifier.
11456 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11457 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11463 /* create input playback/capture controls for the given pin */
11464 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11465 const char *ctlname, int idx)
11470 sprintf(name, "%s Playback Volume", ctlname);
11472 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11473 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11477 } else if (nid == 0x15) {
11478 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11479 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11485 sprintf(name, "%s Playback Switch", ctlname);
11486 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11487 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11493 /* add playback controls from the parsed DAC table */
11494 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11495 const struct auto_pin_cfg *cfg)
11500 spec->multiout.num_dacs = 2; /* only use one dac */
11501 spec->multiout.dac_nids = spec->private_dac_nids;
11502 spec->multiout.dac_nids[0] = 2;
11503 spec->multiout.dac_nids[1] = 3;
11505 nid = cfg->line_out_pins[0];
11507 alc268_new_analog_output(spec, nid, "Front", 0);
11509 nid = cfg->speaker_pins[0];
11511 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11512 "Speaker Playback Volume",
11513 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11517 nid = cfg->hp_pins[0];
11519 alc268_new_analog_output(spec, nid, "Headphone", 0);
11521 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11523 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11524 "Mono Playback Switch",
11525 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11532 /* create playback/capture controls for input pins */
11533 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11534 const struct auto_pin_cfg *cfg)
11536 struct hda_input_mux *imux = &spec->private_imux;
11539 for (i = 0; i < AUTO_PIN_LAST; i++) {
11540 switch(cfg->input_pins[i]) {
11542 idx1 = 0; /* Mic 1 */
11545 idx1 = 1; /* Mic 2 */
11548 idx1 = 2; /* Line In */
11555 idx1 = 6; /* digital mics */
11560 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11561 imux->items[imux->num_items].index = idx1;
11567 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11569 struct alc_spec *spec = codec->spec;
11570 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11571 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11572 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11573 unsigned int dac_vol1, dac_vol2;
11576 snd_hda_codec_write(codec, speaker_nid, 0,
11577 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11578 snd_hda_codec_write(codec, 0x0f, 0,
11579 AC_VERB_SET_AMP_GAIN_MUTE,
11581 snd_hda_codec_write(codec, 0x10, 0,
11582 AC_VERB_SET_AMP_GAIN_MUTE,
11585 snd_hda_codec_write(codec, 0x0f, 0,
11586 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11587 snd_hda_codec_write(codec, 0x10, 0,
11588 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11591 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11592 if (line_nid == 0x14)
11593 dac_vol2 = AMP_OUT_ZERO;
11594 else if (line_nid == 0x15)
11595 dac_vol1 = AMP_OUT_ZERO;
11596 if (hp_nid == 0x14)
11597 dac_vol2 = AMP_OUT_ZERO;
11598 else if (hp_nid == 0x15)
11599 dac_vol1 = AMP_OUT_ZERO;
11600 if (line_nid != 0x16 || hp_nid != 0x16 ||
11601 spec->autocfg.line_out_pins[1] != 0x16 ||
11602 spec->autocfg.line_out_pins[2] != 0x16)
11603 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11605 snd_hda_codec_write(codec, 0x02, 0,
11606 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11607 snd_hda_codec_write(codec, 0x03, 0,
11608 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11611 /* pcm configuration: identiacal with ALC880 */
11612 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11613 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11614 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11615 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11618 * BIOS auto configuration
11620 static int alc268_parse_auto_config(struct hda_codec *codec)
11622 struct alc_spec *spec = codec->spec;
11624 static hda_nid_t alc268_ignore[] = { 0 };
11626 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11630 if (!spec->autocfg.line_outs)
11631 return 0; /* can't find valid BIOS pin config */
11633 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11636 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11640 spec->multiout.max_channels = 2;
11642 /* digital only support output */
11643 if (spec->autocfg.dig_out_pin)
11644 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11646 if (spec->kctls.list)
11647 add_mixer(spec, spec->kctls.list);
11649 if (spec->autocfg.speaker_pins[0] != 0x1d)
11650 add_mixer(spec, alc268_beep_mixer);
11652 add_verb(spec, alc268_volume_init_verbs);
11653 spec->num_mux_defs = 1;
11654 spec->input_mux = &spec->private_imux;
11656 err = alc_auto_add_mic_boost(codec);
11660 store_pin_configs(codec);
11664 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11665 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11666 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11668 /* init callback for auto-configuration model -- overriding the default init */
11669 static void alc268_auto_init(struct hda_codec *codec)
11671 struct alc_spec *spec = codec->spec;
11672 alc268_auto_init_multi_out(codec);
11673 alc268_auto_init_hp_out(codec);
11674 alc268_auto_init_mono_speaker_out(codec);
11675 alc268_auto_init_analog_input(codec);
11676 if (spec->unsol_event)
11677 alc_inithook(codec);
11681 * configuration and preset
11683 static const char *alc268_models[ALC268_MODEL_LAST] = {
11684 [ALC267_QUANTA_IL1] = "quanta-il1",
11685 [ALC268_3ST] = "3stack",
11686 [ALC268_TOSHIBA] = "toshiba",
11687 [ALC268_ACER] = "acer",
11688 [ALC268_ACER_DMIC] = "acer-dmic",
11689 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11690 [ALC268_DELL] = "dell",
11691 [ALC268_ZEPTO] = "zepto",
11692 #ifdef CONFIG_SND_DEBUG
11693 [ALC268_TEST] = "test",
11695 [ALC268_AUTO] = "auto",
11698 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11699 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11700 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11701 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11702 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11703 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11704 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11705 ALC268_ACER_ASPIRE_ONE),
11706 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11707 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11708 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11709 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11710 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11711 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11712 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11713 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11714 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11715 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11716 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11720 static struct alc_config_preset alc268_presets[] = {
11721 [ALC267_QUANTA_IL1] = {
11722 .mixers = { alc267_quanta_il1_mixer },
11723 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11724 alc267_quanta_il1_verbs },
11725 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11726 .dac_nids = alc268_dac_nids,
11727 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11728 .adc_nids = alc268_adc_nids_alt,
11730 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11731 .channel_mode = alc268_modes,
11732 .input_mux = &alc268_capture_source,
11733 .unsol_event = alc267_quanta_il1_unsol_event,
11734 .init_hook = alc267_quanta_il1_automute,
11737 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11738 alc268_beep_mixer },
11739 .init_verbs = { alc268_base_init_verbs },
11740 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11741 .dac_nids = alc268_dac_nids,
11742 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11743 .adc_nids = alc268_adc_nids_alt,
11744 .capsrc_nids = alc268_capsrc_nids,
11746 .dig_out_nid = ALC268_DIGOUT_NID,
11747 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11748 .channel_mode = alc268_modes,
11749 .input_mux = &alc268_capture_source,
11751 [ALC268_TOSHIBA] = {
11752 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11753 alc268_beep_mixer },
11754 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11755 alc268_toshiba_verbs },
11756 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11757 .dac_nids = alc268_dac_nids,
11758 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11759 .adc_nids = alc268_adc_nids_alt,
11760 .capsrc_nids = alc268_capsrc_nids,
11762 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11763 .channel_mode = alc268_modes,
11764 .input_mux = &alc268_capture_source,
11765 .unsol_event = alc268_toshiba_unsol_event,
11766 .init_hook = alc268_toshiba_automute,
11769 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11770 alc268_beep_mixer },
11771 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11772 alc268_acer_verbs },
11773 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11774 .dac_nids = alc268_dac_nids,
11775 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11776 .adc_nids = alc268_adc_nids_alt,
11777 .capsrc_nids = alc268_capsrc_nids,
11779 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11780 .channel_mode = alc268_modes,
11781 .input_mux = &alc268_acer_capture_source,
11782 .unsol_event = alc268_acer_unsol_event,
11783 .init_hook = alc268_acer_init_hook,
11785 [ALC268_ACER_DMIC] = {
11786 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11787 alc268_beep_mixer },
11788 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11789 alc268_acer_verbs },
11790 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11791 .dac_nids = alc268_dac_nids,
11792 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11793 .adc_nids = alc268_adc_nids_alt,
11794 .capsrc_nids = alc268_capsrc_nids,
11796 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11797 .channel_mode = alc268_modes,
11798 .input_mux = &alc268_acer_dmic_capture_source,
11799 .unsol_event = alc268_acer_unsol_event,
11800 .init_hook = alc268_acer_init_hook,
11802 [ALC268_ACER_ASPIRE_ONE] = {
11803 .mixers = { alc268_acer_aspire_one_mixer,
11804 alc268_capture_alt_mixer },
11805 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11806 alc268_acer_aspire_one_verbs },
11807 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11808 .dac_nids = alc268_dac_nids,
11809 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11810 .adc_nids = alc268_adc_nids_alt,
11811 .capsrc_nids = alc268_capsrc_nids,
11813 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11814 .channel_mode = alc268_modes,
11815 .input_mux = &alc268_acer_lc_capture_source,
11816 .unsol_event = alc268_acer_lc_unsol_event,
11817 .init_hook = alc268_acer_lc_init_hook,
11820 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11821 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11822 alc268_dell_verbs },
11823 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11824 .dac_nids = alc268_dac_nids,
11826 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11827 .channel_mode = alc268_modes,
11828 .unsol_event = alc268_dell_unsol_event,
11829 .init_hook = alc268_dell_init_hook,
11830 .input_mux = &alc268_capture_source,
11833 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11834 alc268_beep_mixer },
11835 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11836 alc268_toshiba_verbs },
11837 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11838 .dac_nids = alc268_dac_nids,
11839 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11840 .adc_nids = alc268_adc_nids_alt,
11841 .capsrc_nids = alc268_capsrc_nids,
11843 .dig_out_nid = ALC268_DIGOUT_NID,
11844 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11845 .channel_mode = alc268_modes,
11846 .input_mux = &alc268_capture_source,
11847 .unsol_event = alc268_toshiba_unsol_event,
11848 .init_hook = alc268_toshiba_automute
11850 #ifdef CONFIG_SND_DEBUG
11852 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11853 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11854 alc268_volume_init_verbs },
11855 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11856 .dac_nids = alc268_dac_nids,
11857 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11858 .adc_nids = alc268_adc_nids_alt,
11859 .capsrc_nids = alc268_capsrc_nids,
11861 .dig_out_nid = ALC268_DIGOUT_NID,
11862 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11863 .channel_mode = alc268_modes,
11864 .input_mux = &alc268_capture_source,
11869 static int patch_alc268(struct hda_codec *codec)
11871 struct alc_spec *spec;
11875 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11879 codec->spec = spec;
11881 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11885 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11886 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11887 "trying auto-probe from BIOS...\n");
11888 board_config = ALC268_AUTO;
11891 if (board_config == ALC268_AUTO) {
11892 /* automatic parse from the BIOS config */
11893 err = alc268_parse_auto_config(codec);
11899 "hda_codec: Cannot set up configuration "
11900 "from BIOS. Using base mode...\n");
11901 board_config = ALC268_3ST;
11905 if (board_config != ALC268_AUTO)
11906 setup_preset(spec, &alc268_presets[board_config]);
11908 if (codec->vendor_id == 0x10ec0267) {
11909 spec->stream_name_analog = "ALC267 Analog";
11910 spec->stream_name_digital = "ALC267 Digital";
11912 spec->stream_name_analog = "ALC268 Analog";
11913 spec->stream_name_digital = "ALC268 Digital";
11916 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11917 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11918 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11920 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11922 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11923 /* override the amp caps for beep generator */
11924 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11925 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11926 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11927 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11928 (0 << AC_AMPCAP_MUTE_SHIFT));
11930 if (!spec->adc_nids && spec->input_mux) {
11931 /* check whether NID 0x07 is valid */
11932 unsigned int wcap = get_wcaps(codec, 0x07);
11936 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11937 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11938 spec->adc_nids = alc268_adc_nids_alt;
11939 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11940 add_mixer(spec, alc268_capture_alt_mixer);
11942 spec->adc_nids = alc268_adc_nids;
11943 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11944 add_mixer(spec, alc268_capture_mixer);
11946 spec->capsrc_nids = alc268_capsrc_nids;
11947 /* set default input source */
11948 for (i = 0; i < spec->num_adc_nids; i++)
11949 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11950 0, AC_VERB_SET_CONNECT_SEL,
11951 spec->input_mux->items[0].index);
11954 spec->vmaster_nid = 0x02;
11956 codec->patch_ops = alc_patch_ops;
11957 if (board_config == ALC268_AUTO)
11958 spec->init_hook = alc268_auto_init;
11960 codec->proc_widget_hook = print_realtek_coef;
11966 * ALC269 channel source setting (2 channel)
11968 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11970 #define alc269_dac_nids alc260_dac_nids
11972 static hda_nid_t alc269_adc_nids[1] = {
11977 static hda_nid_t alc269_capsrc_nids[1] = {
11981 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11985 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11993 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12001 #define alc269_modes alc260_modes
12002 #define alc269_capture_source alc880_lg_lw_capture_source
12004 static struct snd_kcontrol_new alc269_base_mixer[] = {
12005 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12006 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12007 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12008 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12011 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12012 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12013 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12014 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12015 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12016 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12017 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12018 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12022 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12023 /* output mixer control */
12024 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12026 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12027 .name = "Master Playback Switch",
12028 .info = snd_hda_mixer_amp_switch_info,
12029 .get = snd_hda_mixer_amp_switch_get,
12030 .put = alc268_acer_master_sw_put,
12031 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12036 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12037 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12038 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12039 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12040 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12044 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12045 /* output mixer control */
12046 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12048 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12049 .name = "Master Playback Switch",
12050 .info = snd_hda_mixer_amp_switch_info,
12051 .get = snd_hda_mixer_amp_switch_get,
12052 .put = alc268_acer_master_sw_put,
12053 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12057 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12058 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12059 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12060 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12061 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12062 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12063 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12064 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12065 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12069 /* bind volumes of both NID 0x0c and 0x0d */
12070 static struct hda_bind_ctls alc269_epc_bind_vol = {
12071 .ops = &snd_hda_bind_vol,
12073 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12074 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12079 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12080 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12081 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12082 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12086 /* capture mixer elements */
12087 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12088 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12089 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12090 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12095 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12096 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12097 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12098 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12103 static struct snd_kcontrol_new alc269_beep_mixer[] = {
12104 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12105 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12109 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12110 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12111 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12113 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12114 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12115 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12119 static struct hda_verb alc269_lifebook_verbs[] = {
12120 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12121 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12122 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12123 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12124 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12125 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12126 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12127 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12128 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12129 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12133 /* toggle speaker-output according to the hp-jack state */
12134 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12136 unsigned int present;
12137 unsigned char bits;
12139 present = snd_hda_codec_read(codec, 0x15, 0,
12140 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12141 bits = present ? AMP_IN_MUTE(0) : 0;
12142 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12143 AMP_IN_MUTE(0), bits);
12144 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12145 AMP_IN_MUTE(0), bits);
12147 snd_hda_codec_write(codec, 0x20, 0,
12148 AC_VERB_SET_COEF_INDEX, 0x0c);
12149 snd_hda_codec_write(codec, 0x20, 0,
12150 AC_VERB_SET_PROC_COEF, 0x680);
12152 snd_hda_codec_write(codec, 0x20, 0,
12153 AC_VERB_SET_COEF_INDEX, 0x0c);
12154 snd_hda_codec_write(codec, 0x20, 0,
12155 AC_VERB_SET_PROC_COEF, 0x480);
12158 /* toggle speaker-output according to the hp-jacks state */
12159 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12161 unsigned int present;
12162 unsigned char bits;
12164 /* Check laptop headphone socket */
12165 present = snd_hda_codec_read(codec, 0x15, 0,
12166 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12168 /* Check port replicator headphone socket */
12169 present |= snd_hda_codec_read(codec, 0x1a, 0,
12170 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12172 bits = present ? AMP_IN_MUTE(0) : 0;
12173 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12174 AMP_IN_MUTE(0), bits);
12175 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12176 AMP_IN_MUTE(0), bits);
12178 snd_hda_codec_write(codec, 0x20, 0,
12179 AC_VERB_SET_COEF_INDEX, 0x0c);
12180 snd_hda_codec_write(codec, 0x20, 0,
12181 AC_VERB_SET_PROC_COEF, 0x680);
12183 snd_hda_codec_write(codec, 0x20, 0,
12184 AC_VERB_SET_COEF_INDEX, 0x0c);
12185 snd_hda_codec_write(codec, 0x20, 0,
12186 AC_VERB_SET_PROC_COEF, 0x480);
12189 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12191 unsigned int present;
12193 present = snd_hda_codec_read(codec, 0x18, 0,
12194 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12195 snd_hda_codec_write(codec, 0x23, 0,
12196 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12199 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12201 unsigned int present_laptop;
12202 unsigned int present_dock;
12204 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12205 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12207 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12208 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12210 /* Laptop mic port overrides dock mic port, design decision */
12212 snd_hda_codec_write(codec, 0x23, 0,
12213 AC_VERB_SET_CONNECT_SEL, 0x3);
12214 if (present_laptop)
12215 snd_hda_codec_write(codec, 0x23, 0,
12216 AC_VERB_SET_CONNECT_SEL, 0x0);
12217 if (!present_dock && !present_laptop)
12218 snd_hda_codec_write(codec, 0x23, 0,
12219 AC_VERB_SET_CONNECT_SEL, 0x1);
12222 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12225 if ((res >> 26) == ALC880_HP_EVENT)
12226 alc269_quanta_fl1_speaker_automute(codec);
12227 if ((res >> 26) == ALC880_MIC_EVENT)
12228 alc269_quanta_fl1_mic_automute(codec);
12231 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12234 if ((res >> 26) == ALC880_HP_EVENT)
12235 alc269_lifebook_speaker_automute(codec);
12236 if ((res >> 26) == ALC880_MIC_EVENT)
12237 alc269_lifebook_mic_autoswitch(codec);
12240 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12242 alc269_quanta_fl1_speaker_automute(codec);
12243 alc269_quanta_fl1_mic_automute(codec);
12246 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12248 alc269_lifebook_speaker_automute(codec);
12249 alc269_lifebook_mic_autoswitch(codec);
12252 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12253 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12254 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12255 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12256 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12257 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12258 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12259 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12263 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12264 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12265 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12266 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12268 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12269 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12273 /* toggle speaker-output according to the hp-jack state */
12274 static void alc269_speaker_automute(struct hda_codec *codec)
12276 unsigned int present;
12277 unsigned char bits;
12279 present = snd_hda_codec_read(codec, 0x15, 0,
12280 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12281 bits = present ? AMP_IN_MUTE(0) : 0;
12282 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12283 AMP_IN_MUTE(0), bits);
12284 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12285 AMP_IN_MUTE(0), bits);
12288 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12290 unsigned int present;
12292 present = snd_hda_codec_read(codec, 0x18, 0,
12293 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12294 snd_hda_codec_write(codec, 0x23, 0,
12295 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12298 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12300 unsigned int present;
12302 present = snd_hda_codec_read(codec, 0x18, 0,
12303 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12304 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12305 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12306 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12307 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12310 /* unsolicited event for HP jack sensing */
12311 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12314 if ((res >> 26) == ALC880_HP_EVENT)
12315 alc269_speaker_automute(codec);
12317 if ((res >> 26) == ALC880_MIC_EVENT)
12318 alc269_eeepc_dmic_automute(codec);
12321 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12323 alc269_speaker_automute(codec);
12324 alc269_eeepc_dmic_automute(codec);
12327 /* unsolicited event for HP jack sensing */
12328 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12331 if ((res >> 26) == ALC880_HP_EVENT)
12332 alc269_speaker_automute(codec);
12334 if ((res >> 26) == ALC880_MIC_EVENT)
12335 alc269_eeepc_amic_automute(codec);
12338 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12340 alc269_speaker_automute(codec);
12341 alc269_eeepc_amic_automute(codec);
12345 * generic initialization of ADC, input mixers and output mixers
12347 static struct hda_verb alc269_init_verbs[] = {
12349 * Unmute ADC0 and set the default input to mic-in
12351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12353 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12354 * analog-loopback mixer widget
12355 * Note: PASD motherboards uses the Line In 2 as the input for
12356 * front panel mic (mic 2)
12358 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12359 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12360 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12361 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12362 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12363 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12366 * Set up output mixers (0x0c - 0x0e)
12368 /* set vol=0 to output mixers */
12369 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12370 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12372 /* set up input amps for analog loopback */
12373 /* Amp Indices: DAC = 0, mixer = 1 */
12374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12376 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12377 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12378 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12379 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12381 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12383 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12384 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12385 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12386 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12387 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12389 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12390 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12391 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12392 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12393 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12394 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12395 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12397 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12400 /* FIXME: use matrix-type input source selection */
12401 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12402 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12409 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12410 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12414 /* add playback controls from the parsed DAC table */
12415 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12416 const struct auto_pin_cfg *cfg)
12421 spec->multiout.num_dacs = 1; /* only use one dac */
12422 spec->multiout.dac_nids = spec->private_dac_nids;
12423 spec->multiout.dac_nids[0] = 2;
12425 nid = cfg->line_out_pins[0];
12427 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12428 "Front Playback Volume",
12429 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12432 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12433 "Front Playback Switch",
12434 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12439 nid = cfg->speaker_pins[0];
12441 if (!cfg->line_out_pins[0]) {
12442 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12443 "Speaker Playback Volume",
12444 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12450 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12451 "Speaker Playback Switch",
12452 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12457 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12458 "Speaker Playback Switch",
12459 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12465 nid = cfg->hp_pins[0];
12467 /* spec->multiout.hp_nid = 2; */
12468 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12469 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12470 "Headphone Playback Volume",
12471 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12477 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12478 "Headphone Playback Switch",
12479 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12484 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12485 "Headphone Playback Switch",
12486 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12495 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12496 const struct auto_pin_cfg *cfg)
12500 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12503 /* digital-mic input pin is excluded in alc880_auto_create..()
12504 * because it's under 0x18
12506 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12507 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12508 struct hda_input_mux *imux = &spec->private_imux;
12509 imux->items[imux->num_items].label = "Int Mic";
12510 imux->items[imux->num_items].index = 0x05;
12516 #ifdef CONFIG_SND_HDA_POWER_SAVE
12517 #define alc269_loopbacks alc880_loopbacks
12520 /* pcm configuration: identiacal with ALC880 */
12521 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12522 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12523 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12524 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12527 * BIOS auto configuration
12529 static int alc269_parse_auto_config(struct hda_codec *codec)
12531 struct alc_spec *spec = codec->spec;
12533 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12535 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12540 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12543 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12547 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12549 if (spec->autocfg.dig_out_pin)
12550 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12552 if (spec->kctls.list)
12553 add_mixer(spec, spec->kctls.list);
12555 /* create a beep mixer control if the pin 0x1d isn't assigned */
12556 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12557 if (spec->autocfg.input_pins[i] == 0x1d)
12559 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12560 add_mixer(spec, alc269_beep_mixer);
12562 add_verb(spec, alc269_init_verbs);
12563 spec->num_mux_defs = 1;
12564 spec->input_mux = &spec->private_imux;
12565 /* set default input source */
12566 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12567 0, AC_VERB_SET_CONNECT_SEL,
12568 spec->input_mux->items[0].index);
12570 err = alc_auto_add_mic_boost(codec);
12574 if (!spec->cap_mixer)
12575 set_capture_mixer(spec);
12577 store_pin_configs(codec);
12581 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12582 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12583 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12586 /* init callback for auto-configuration model -- overriding the default init */
12587 static void alc269_auto_init(struct hda_codec *codec)
12589 struct alc_spec *spec = codec->spec;
12590 alc269_auto_init_multi_out(codec);
12591 alc269_auto_init_hp_out(codec);
12592 alc269_auto_init_analog_input(codec);
12593 if (spec->unsol_event)
12594 alc_inithook(codec);
12598 * configuration and preset
12600 static const char *alc269_models[ALC269_MODEL_LAST] = {
12601 [ALC269_BASIC] = "basic",
12602 [ALC269_QUANTA_FL1] = "quanta",
12603 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12604 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12605 [ALC269_FUJITSU] = "fujitsu",
12606 [ALC269_LIFEBOOK] = "lifebook"
12609 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12610 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12611 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12612 ALC269_ASUS_EEEPC_P703),
12613 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12614 ALC269_ASUS_EEEPC_P901),
12615 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12616 ALC269_ASUS_EEEPC_P901),
12617 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12618 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12622 static struct alc_config_preset alc269_presets[] = {
12624 .mixers = { alc269_base_mixer },
12625 .init_verbs = { alc269_init_verbs },
12626 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12627 .dac_nids = alc269_dac_nids,
12629 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12630 .channel_mode = alc269_modes,
12631 .input_mux = &alc269_capture_source,
12633 [ALC269_QUANTA_FL1] = {
12634 .mixers = { alc269_quanta_fl1_mixer },
12635 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12636 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12637 .dac_nids = alc269_dac_nids,
12639 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12640 .channel_mode = alc269_modes,
12641 .input_mux = &alc269_capture_source,
12642 .unsol_event = alc269_quanta_fl1_unsol_event,
12643 .init_hook = alc269_quanta_fl1_init_hook,
12645 [ALC269_ASUS_EEEPC_P703] = {
12646 .mixers = { alc269_eeepc_mixer },
12647 .cap_mixer = alc269_epc_capture_mixer,
12648 .init_verbs = { alc269_init_verbs,
12649 alc269_eeepc_amic_init_verbs },
12650 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12651 .dac_nids = alc269_dac_nids,
12653 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12654 .channel_mode = alc269_modes,
12655 .input_mux = &alc269_eeepc_amic_capture_source,
12656 .unsol_event = alc269_eeepc_amic_unsol_event,
12657 .init_hook = alc269_eeepc_amic_inithook,
12659 [ALC269_ASUS_EEEPC_P901] = {
12660 .mixers = { alc269_eeepc_mixer },
12661 .cap_mixer = alc269_epc_capture_mixer,
12662 .init_verbs = { alc269_init_verbs,
12663 alc269_eeepc_dmic_init_verbs },
12664 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12665 .dac_nids = alc269_dac_nids,
12667 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12668 .channel_mode = alc269_modes,
12669 .input_mux = &alc269_eeepc_dmic_capture_source,
12670 .unsol_event = alc269_eeepc_dmic_unsol_event,
12671 .init_hook = alc269_eeepc_dmic_inithook,
12673 [ALC269_FUJITSU] = {
12674 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12675 .cap_mixer = alc269_epc_capture_mixer,
12676 .init_verbs = { alc269_init_verbs,
12677 alc269_eeepc_dmic_init_verbs },
12678 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12679 .dac_nids = alc269_dac_nids,
12681 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12682 .channel_mode = alc269_modes,
12683 .input_mux = &alc269_eeepc_dmic_capture_source,
12684 .unsol_event = alc269_eeepc_dmic_unsol_event,
12685 .init_hook = alc269_eeepc_dmic_inithook,
12687 [ALC269_LIFEBOOK] = {
12688 .mixers = { alc269_lifebook_mixer },
12689 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12690 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12691 .dac_nids = alc269_dac_nids,
12693 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12694 .channel_mode = alc269_modes,
12695 .input_mux = &alc269_capture_source,
12696 .unsol_event = alc269_lifebook_unsol_event,
12697 .init_hook = alc269_lifebook_init_hook,
12701 static int patch_alc269(struct hda_codec *codec)
12703 struct alc_spec *spec;
12707 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12711 codec->spec = spec;
12713 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12715 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12719 if (board_config < 0) {
12720 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12721 "trying auto-probe from BIOS...\n");
12722 board_config = ALC269_AUTO;
12725 if (board_config == ALC269_AUTO) {
12726 /* automatic parse from the BIOS config */
12727 err = alc269_parse_auto_config(codec);
12733 "hda_codec: Cannot set up configuration "
12734 "from BIOS. Using base mode...\n");
12735 board_config = ALC269_BASIC;
12739 if (board_config != ALC269_AUTO)
12740 setup_preset(spec, &alc269_presets[board_config]);
12742 spec->stream_name_analog = "ALC269 Analog";
12743 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12744 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12746 spec->stream_name_digital = "ALC269 Digital";
12747 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12748 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12750 spec->adc_nids = alc269_adc_nids;
12751 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12752 spec->capsrc_nids = alc269_capsrc_nids;
12753 if (!spec->cap_mixer)
12754 set_capture_mixer(spec);
12756 codec->patch_ops = alc_patch_ops;
12757 if (board_config == ALC269_AUTO)
12758 spec->init_hook = alc269_auto_init;
12759 #ifdef CONFIG_SND_HDA_POWER_SAVE
12760 if (!spec->loopback.amplist)
12761 spec->loopback.amplist = alc269_loopbacks;
12763 codec->proc_widget_hook = print_realtek_coef;
12769 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12773 * set the path ways for 2 channel output
12774 * need to set the codec line out and mic 1 pin widgets to inputs
12776 static struct hda_verb alc861_threestack_ch2_init[] = {
12777 /* set pin widget 1Ah (line in) for input */
12778 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12779 /* set pin widget 18h (mic1/2) for input, for mic also enable
12782 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12784 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12786 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12787 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12793 * need to set the codec line out and mic 1 pin widgets to outputs
12795 static struct hda_verb alc861_threestack_ch6_init[] = {
12796 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12797 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12798 /* set pin widget 18h (mic1) for output (CLFE)*/
12799 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12801 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12802 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12804 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12806 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12807 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12812 static struct hda_channel_mode alc861_threestack_modes[2] = {
12813 { 2, alc861_threestack_ch2_init },
12814 { 6, alc861_threestack_ch6_init },
12816 /* Set mic1 as input and unmute the mixer */
12817 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12818 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12819 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12822 /* Set mic1 as output and mute mixer */
12823 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12824 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12825 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12829 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12830 { 2, alc861_uniwill_m31_ch2_init },
12831 { 4, alc861_uniwill_m31_ch4_init },
12834 /* Set mic1 and line-in as input and unmute the mixer */
12835 static struct hda_verb alc861_asus_ch2_init[] = {
12836 /* set pin widget 1Ah (line in) for input */
12837 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12838 /* set pin widget 18h (mic1/2) for input, for mic also enable
12841 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12843 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12845 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12846 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12850 /* Set mic1 nad line-in as output and mute mixer */
12851 static struct hda_verb alc861_asus_ch6_init[] = {
12852 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12853 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12854 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12855 /* set pin widget 18h (mic1) for output (CLFE)*/
12856 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12857 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12858 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12859 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12861 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12863 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12864 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12869 static struct hda_channel_mode alc861_asus_modes[2] = {
12870 { 2, alc861_asus_ch2_init },
12871 { 6, alc861_asus_ch6_init },
12876 static struct snd_kcontrol_new alc861_base_mixer[] = {
12877 /* output mixer control */
12878 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12879 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12880 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12881 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12882 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12884 /*Input mixer control */
12885 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12886 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12887 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12888 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12889 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12890 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12892 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12893 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12894 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12899 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12900 /* output mixer control */
12901 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12902 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12903 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12904 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12905 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12907 /* Input mixer control */
12908 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12909 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12910 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12911 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12912 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12913 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12914 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12915 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12916 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12917 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12921 .name = "Channel Mode",
12922 .info = alc_ch_mode_info,
12923 .get = alc_ch_mode_get,
12924 .put = alc_ch_mode_put,
12925 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12930 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12931 /* output mixer control */
12932 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12934 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12939 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12940 /* output mixer control */
12941 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12942 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12943 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12944 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12945 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12947 /* Input mixer control */
12948 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12949 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12950 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12951 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12952 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12953 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12955 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12956 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12957 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12961 .name = "Channel Mode",
12962 .info = alc_ch_mode_info,
12963 .get = alc_ch_mode_get,
12964 .put = alc_ch_mode_put,
12965 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12970 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12971 /* output mixer control */
12972 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12973 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12974 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12975 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12976 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12978 /* Input mixer control */
12979 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12980 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12981 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12982 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12983 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12984 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12986 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12987 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12991 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12992 .name = "Channel Mode",
12993 .info = alc_ch_mode_info,
12994 .get = alc_ch_mode_get,
12995 .put = alc_ch_mode_put,
12996 .private_value = ARRAY_SIZE(alc861_asus_modes),
13001 /* additional mixer */
13002 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13003 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13004 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13005 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
13006 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
13011 * generic initialization of ADC, input mixers and output mixers
13013 static struct hda_verb alc861_base_init_verbs[] = {
13015 * Unmute ADC0 and set the default input to mic-in
13017 /* port-A for surround (rear panel) */
13018 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13019 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13020 /* port-B for mic-in (rear panel) with vref */
13021 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13022 /* port-C for line-in (rear panel) */
13023 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13024 /* port-D for Front */
13025 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13026 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13027 /* port-E for HP out (front panel) */
13028 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13029 /* route front PCM to HP */
13030 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13031 /* port-F for mic-in (front panel) with vref */
13032 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13033 /* port-G for CLFE (rear panel) */
13034 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13035 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13036 /* port-H for side (rear panel) */
13037 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13038 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13040 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13041 /* route front mic to ADC1*/
13042 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13043 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13045 /* Unmute DAC0~3 & spdif out*/
13046 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13047 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13048 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13049 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13052 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13053 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13054 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13055 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13056 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13058 /* Unmute Stereo Mixer 15 */
13059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13061 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13064 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13065 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13066 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13067 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13068 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13070 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13072 /* hp used DAC 3 (Front) */
13073 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13074 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13079 static struct hda_verb alc861_threestack_init_verbs[] = {
13081 * Unmute ADC0 and set the default input to mic-in
13083 /* port-A for surround (rear panel) */
13084 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13085 /* port-B for mic-in (rear panel) with vref */
13086 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13087 /* port-C for line-in (rear panel) */
13088 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13089 /* port-D for Front */
13090 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13091 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13092 /* port-E for HP out (front panel) */
13093 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13094 /* route front PCM to HP */
13095 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13096 /* port-F for mic-in (front panel) with vref */
13097 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13098 /* port-G for CLFE (rear panel) */
13099 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13100 /* port-H for side (rear panel) */
13101 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13103 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13104 /* route front mic to ADC1*/
13105 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13106 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13107 /* Unmute DAC0~3 & spdif out*/
13108 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13109 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13110 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13111 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13114 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13115 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13116 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13117 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13118 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13120 /* Unmute Stereo Mixer 15 */
13121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13122 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13123 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13124 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13126 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13127 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13128 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13129 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13130 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13131 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13132 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13134 /* hp used DAC 3 (Front) */
13135 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13136 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13140 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13142 * Unmute ADC0 and set the default input to mic-in
13144 /* port-A for surround (rear panel) */
13145 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13146 /* port-B for mic-in (rear panel) with vref */
13147 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13148 /* port-C for line-in (rear panel) */
13149 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13150 /* port-D for Front */
13151 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13152 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13153 /* port-E for HP out (front panel) */
13154 /* this has to be set to VREF80 */
13155 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13156 /* route front PCM to HP */
13157 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13158 /* port-F for mic-in (front panel) with vref */
13159 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13160 /* port-G for CLFE (rear panel) */
13161 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13162 /* port-H for side (rear panel) */
13163 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13165 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13166 /* route front mic to ADC1*/
13167 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13168 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13169 /* Unmute DAC0~3 & spdif out*/
13170 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13171 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13172 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13173 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13174 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13176 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13177 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13178 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13179 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13180 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13182 /* Unmute Stereo Mixer 15 */
13183 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13184 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13185 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13188 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13189 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13190 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13191 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13192 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13193 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13194 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13195 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13196 /* hp used DAC 3 (Front) */
13197 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13198 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13202 static struct hda_verb alc861_asus_init_verbs[] = {
13204 * Unmute ADC0 and set the default input to mic-in
13206 /* port-A for surround (rear panel)
13207 * according to codec#0 this is the HP jack
13209 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13210 /* route front PCM to HP */
13211 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13212 /* port-B for mic-in (rear panel) with vref */
13213 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13214 /* port-C for line-in (rear panel) */
13215 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13216 /* port-D for Front */
13217 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13218 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13219 /* port-E for HP out (front panel) */
13220 /* this has to be set to VREF80 */
13221 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13222 /* route front PCM to HP */
13223 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13224 /* port-F for mic-in (front panel) with vref */
13225 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13226 /* port-G for CLFE (rear panel) */
13227 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13228 /* port-H for side (rear panel) */
13229 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13231 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13232 /* route front mic to ADC1*/
13233 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13235 /* Unmute DAC0~3 & spdif out*/
13236 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13237 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13238 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13239 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13241 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13242 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13243 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13244 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13245 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13247 /* Unmute Stereo Mixer 15 */
13248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13250 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13251 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13253 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13254 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13255 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13256 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13257 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13258 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13259 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13260 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13261 /* hp used DAC 3 (Front) */
13262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13263 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13267 /* additional init verbs for ASUS laptops */
13268 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13269 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13270 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13275 * generic initialization of ADC, input mixers and output mixers
13277 static struct hda_verb alc861_auto_init_verbs[] = {
13279 * Unmute ADC0 and set the default input to mic-in
13281 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13282 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13284 /* Unmute DAC0~3 & spdif out*/
13285 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13286 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13287 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13288 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13291 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13292 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13293 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13294 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13295 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13297 /* Unmute Stereo Mixer 15 */
13298 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13299 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13300 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13303 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13304 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13305 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13306 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13307 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13309 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13310 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13312 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13313 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13314 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13315 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13316 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13317 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13318 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13319 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13321 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13326 static struct hda_verb alc861_toshiba_init_verbs[] = {
13327 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13332 /* toggle speaker-output according to the hp-jack state */
13333 static void alc861_toshiba_automute(struct hda_codec *codec)
13335 unsigned int present;
13337 present = snd_hda_codec_read(codec, 0x0f, 0,
13338 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13339 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13340 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13341 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13342 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13345 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13348 if ((res >> 26) == ALC880_HP_EVENT)
13349 alc861_toshiba_automute(codec);
13352 /* pcm configuration: identiacal with ALC880 */
13353 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13354 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13355 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13356 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13359 #define ALC861_DIGOUT_NID 0x07
13361 static struct hda_channel_mode alc861_8ch_modes[1] = {
13365 static hda_nid_t alc861_dac_nids[4] = {
13366 /* front, surround, clfe, side */
13367 0x03, 0x06, 0x05, 0x04
13370 static hda_nid_t alc660_dac_nids[3] = {
13371 /* front, clfe, surround */
13375 static hda_nid_t alc861_adc_nids[1] = {
13380 static struct hda_input_mux alc861_capture_source = {
13384 { "Front Mic", 0x3 },
13391 /* fill in the dac_nids table from the parsed pin configuration */
13392 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13393 const struct auto_pin_cfg *cfg)
13398 spec->multiout.dac_nids = spec->private_dac_nids;
13399 for (i = 0; i < cfg->line_outs; i++) {
13400 nid = cfg->line_out_pins[i];
13402 if (i >= ARRAY_SIZE(alc861_dac_nids))
13404 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13407 spec->multiout.num_dacs = cfg->line_outs;
13411 /* add playback controls from the parsed DAC table */
13412 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13413 const struct auto_pin_cfg *cfg)
13416 static const char *chname[4] = {
13417 "Front", "Surround", NULL /*CLFE*/, "Side"
13422 for (i = 0; i < cfg->line_outs; i++) {
13423 nid = spec->multiout.dac_nids[i];
13428 err = add_control(spec, ALC_CTL_BIND_MUTE,
13429 "Center Playback Switch",
13430 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13434 err = add_control(spec, ALC_CTL_BIND_MUTE,
13435 "LFE Playback Switch",
13436 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13441 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13443 if (nid == alc861_dac_nids[idx])
13445 sprintf(name, "%s Playback Switch", chname[idx]);
13446 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13447 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13456 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13464 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13466 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13467 "Headphone Playback Switch",
13468 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13471 spec->multiout.hp_nid = nid;
13476 /* create playback/capture controls for input pins */
13477 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13478 const struct auto_pin_cfg *cfg)
13480 struct hda_input_mux *imux = &spec->private_imux;
13481 int i, err, idx, idx1;
13483 for (i = 0; i < AUTO_PIN_LAST; i++) {
13484 switch (cfg->input_pins[i]) {
13487 idx = 2; /* Line In */
13491 idx = 2; /* Line In */
13495 idx = 1; /* Mic In */
13499 idx = 1; /* Mic In */
13509 err = new_analog_input(spec, cfg->input_pins[i],
13510 auto_pin_cfg_labels[i], idx, 0x15);
13514 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13515 imux->items[imux->num_items].index = idx1;
13521 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13523 int pin_type, int dac_idx)
13525 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13527 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13531 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13533 struct alc_spec *spec = codec->spec;
13536 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13537 for (i = 0; i < spec->autocfg.line_outs; i++) {
13538 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13539 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13541 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13542 spec->multiout.dac_nids[i]);
13546 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13548 struct alc_spec *spec = codec->spec;
13551 pin = spec->autocfg.hp_pins[0];
13552 if (pin) /* connect to front */
13553 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13554 spec->multiout.dac_nids[0]);
13555 pin = spec->autocfg.speaker_pins[0];
13557 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13560 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13562 struct alc_spec *spec = codec->spec;
13565 for (i = 0; i < AUTO_PIN_LAST; i++) {
13566 hda_nid_t nid = spec->autocfg.input_pins[i];
13567 if (nid >= 0x0c && nid <= 0x11) {
13568 snd_hda_codec_write(codec, nid, 0,
13569 AC_VERB_SET_PIN_WIDGET_CONTROL,
13570 i <= AUTO_PIN_FRONT_MIC ?
13571 PIN_VREF80 : PIN_IN);
13576 /* parse the BIOS configuration and set up the alc_spec */
13577 /* return 1 if successful, 0 if the proper config is not found,
13578 * or a negative error code
13580 static int alc861_parse_auto_config(struct hda_codec *codec)
13582 struct alc_spec *spec = codec->spec;
13584 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13586 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13590 if (!spec->autocfg.line_outs)
13591 return 0; /* can't find valid BIOS pin config */
13593 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13596 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13599 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13602 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13606 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13608 if (spec->autocfg.dig_out_pin)
13609 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13611 if (spec->kctls.list)
13612 add_mixer(spec, spec->kctls.list);
13614 add_verb(spec, alc861_auto_init_verbs);
13616 spec->num_mux_defs = 1;
13617 spec->input_mux = &spec->private_imux;
13619 spec->adc_nids = alc861_adc_nids;
13620 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13621 set_capture_mixer(spec);
13623 store_pin_configs(codec);
13627 /* additional initialization for auto-configuration model */
13628 static void alc861_auto_init(struct hda_codec *codec)
13630 struct alc_spec *spec = codec->spec;
13631 alc861_auto_init_multi_out(codec);
13632 alc861_auto_init_hp_out(codec);
13633 alc861_auto_init_analog_input(codec);
13634 if (spec->unsol_event)
13635 alc_inithook(codec);
13638 #ifdef CONFIG_SND_HDA_POWER_SAVE
13639 static struct hda_amp_list alc861_loopbacks[] = {
13640 { 0x15, HDA_INPUT, 0 },
13641 { 0x15, HDA_INPUT, 1 },
13642 { 0x15, HDA_INPUT, 2 },
13643 { 0x15, HDA_INPUT, 3 },
13650 * configuration and preset
13652 static const char *alc861_models[ALC861_MODEL_LAST] = {
13653 [ALC861_3ST] = "3stack",
13654 [ALC660_3ST] = "3stack-660",
13655 [ALC861_3ST_DIG] = "3stack-dig",
13656 [ALC861_6ST_DIG] = "6stack-dig",
13657 [ALC861_UNIWILL_M31] = "uniwill-m31",
13658 [ALC861_TOSHIBA] = "toshiba",
13659 [ALC861_ASUS] = "asus",
13660 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13661 [ALC861_AUTO] = "auto",
13664 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13665 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13666 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13667 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13668 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13669 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13670 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13671 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13672 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13673 * Any other models that need this preset?
13675 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13676 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13677 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13678 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13679 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13680 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13681 /* FIXME: the below seems conflict */
13682 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13683 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13684 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13688 static struct alc_config_preset alc861_presets[] = {
13690 .mixers = { alc861_3ST_mixer },
13691 .init_verbs = { alc861_threestack_init_verbs },
13692 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13693 .dac_nids = alc861_dac_nids,
13694 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13695 .channel_mode = alc861_threestack_modes,
13697 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13698 .adc_nids = alc861_adc_nids,
13699 .input_mux = &alc861_capture_source,
13701 [ALC861_3ST_DIG] = {
13702 .mixers = { alc861_base_mixer },
13703 .init_verbs = { alc861_threestack_init_verbs },
13704 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13705 .dac_nids = alc861_dac_nids,
13706 .dig_out_nid = ALC861_DIGOUT_NID,
13707 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13708 .channel_mode = alc861_threestack_modes,
13710 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13711 .adc_nids = alc861_adc_nids,
13712 .input_mux = &alc861_capture_source,
13714 [ALC861_6ST_DIG] = {
13715 .mixers = { alc861_base_mixer },
13716 .init_verbs = { alc861_base_init_verbs },
13717 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13718 .dac_nids = alc861_dac_nids,
13719 .dig_out_nid = ALC861_DIGOUT_NID,
13720 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13721 .channel_mode = alc861_8ch_modes,
13722 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13723 .adc_nids = alc861_adc_nids,
13724 .input_mux = &alc861_capture_source,
13727 .mixers = { alc861_3ST_mixer },
13728 .init_verbs = { alc861_threestack_init_verbs },
13729 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13730 .dac_nids = alc660_dac_nids,
13731 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13732 .channel_mode = alc861_threestack_modes,
13734 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13735 .adc_nids = alc861_adc_nids,
13736 .input_mux = &alc861_capture_source,
13738 [ALC861_UNIWILL_M31] = {
13739 .mixers = { alc861_uniwill_m31_mixer },
13740 .init_verbs = { alc861_uniwill_m31_init_verbs },
13741 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13742 .dac_nids = alc861_dac_nids,
13743 .dig_out_nid = ALC861_DIGOUT_NID,
13744 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13745 .channel_mode = alc861_uniwill_m31_modes,
13747 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13748 .adc_nids = alc861_adc_nids,
13749 .input_mux = &alc861_capture_source,
13751 [ALC861_TOSHIBA] = {
13752 .mixers = { alc861_toshiba_mixer },
13753 .init_verbs = { alc861_base_init_verbs,
13754 alc861_toshiba_init_verbs },
13755 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13756 .dac_nids = alc861_dac_nids,
13757 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13758 .channel_mode = alc883_3ST_2ch_modes,
13759 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13760 .adc_nids = alc861_adc_nids,
13761 .input_mux = &alc861_capture_source,
13762 .unsol_event = alc861_toshiba_unsol_event,
13763 .init_hook = alc861_toshiba_automute,
13766 .mixers = { alc861_asus_mixer },
13767 .init_verbs = { alc861_asus_init_verbs },
13768 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13769 .dac_nids = alc861_dac_nids,
13770 .dig_out_nid = ALC861_DIGOUT_NID,
13771 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13772 .channel_mode = alc861_asus_modes,
13775 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13776 .adc_nids = alc861_adc_nids,
13777 .input_mux = &alc861_capture_source,
13779 [ALC861_ASUS_LAPTOP] = {
13780 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13781 .init_verbs = { alc861_asus_init_verbs,
13782 alc861_asus_laptop_init_verbs },
13783 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13784 .dac_nids = alc861_dac_nids,
13785 .dig_out_nid = ALC861_DIGOUT_NID,
13786 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13787 .channel_mode = alc883_3ST_2ch_modes,
13789 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13790 .adc_nids = alc861_adc_nids,
13791 .input_mux = &alc861_capture_source,
13796 static int patch_alc861(struct hda_codec *codec)
13798 struct alc_spec *spec;
13802 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13806 codec->spec = spec;
13808 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13812 if (board_config < 0) {
13813 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13814 "trying auto-probe from BIOS...\n");
13815 board_config = ALC861_AUTO;
13818 if (board_config == ALC861_AUTO) {
13819 /* automatic parse from the BIOS config */
13820 err = alc861_parse_auto_config(codec);
13826 "hda_codec: Cannot set up configuration "
13827 "from BIOS. Using base mode...\n");
13828 board_config = ALC861_3ST_DIG;
13832 if (board_config != ALC861_AUTO)
13833 setup_preset(spec, &alc861_presets[board_config]);
13835 spec->stream_name_analog = "ALC861 Analog";
13836 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13837 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13839 spec->stream_name_digital = "ALC861 Digital";
13840 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13841 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13843 spec->vmaster_nid = 0x03;
13845 codec->patch_ops = alc_patch_ops;
13846 if (board_config == ALC861_AUTO)
13847 spec->init_hook = alc861_auto_init;
13848 #ifdef CONFIG_SND_HDA_POWER_SAVE
13849 if (!spec->loopback.amplist)
13850 spec->loopback.amplist = alc861_loopbacks;
13852 codec->proc_widget_hook = print_realtek_coef;
13858 * ALC861-VD support
13862 * In addition, an independent DAC
13864 #define ALC861VD_DIGOUT_NID 0x06
13866 static hda_nid_t alc861vd_dac_nids[4] = {
13867 /* front, surr, clfe, side surr */
13868 0x02, 0x03, 0x04, 0x05
13871 /* dac_nids for ALC660vd are in a different order - according to
13872 * Realtek's driver.
13873 * This should probably tesult in a different mixer for 6stack models
13874 * of ALC660vd codecs, but for now there is only 3stack mixer
13875 * - and it is the same as in 861vd.
13876 * adc_nids in ALC660vd are (is) the same as in 861vd
13878 static hda_nid_t alc660vd_dac_nids[3] = {
13879 /* front, rear, clfe, rear_surr */
13883 static hda_nid_t alc861vd_adc_nids[1] = {
13888 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13891 /* FIXME: should be a matrix-type input source selection */
13892 static struct hda_input_mux alc861vd_capture_source = {
13896 { "Front Mic", 0x1 },
13902 static struct hda_input_mux alc861vd_dallas_capture_source = {
13905 { "Ext Mic", 0x0 },
13906 { "Int Mic", 0x1 },
13910 static struct hda_input_mux alc861vd_hp_capture_source = {
13913 { "Front Mic", 0x0 },
13914 { "ATAPI Mic", 0x1 },
13921 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13928 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13929 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13930 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13931 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13932 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13939 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13940 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13941 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13942 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13943 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13947 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13948 { 6, alc861vd_6stack_ch6_init },
13949 { 8, alc861vd_6stack_ch8_init },
13952 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13954 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13955 .name = "Channel Mode",
13956 .info = alc_ch_mode_info,
13957 .get = alc_ch_mode_get,
13958 .put = alc_ch_mode_put,
13963 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13964 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13966 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13967 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13968 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13970 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13971 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13973 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13975 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13977 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13978 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13980 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13981 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13985 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13986 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13987 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13989 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13990 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13991 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13996 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13997 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13999 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14000 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14005 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14006 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14015 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14016 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14019 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14020 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14022 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14023 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14025 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14026 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14031 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14032 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14033 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14034 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14036 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14038 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14040 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14042 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14043 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14044 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14046 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14047 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14052 /* Pin assignment: Speaker=0x14, HP = 0x15,
14053 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14055 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14056 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14057 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14058 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14059 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14060 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14061 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14062 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14063 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14064 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14065 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14066 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
14067 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
14071 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14072 * Front Mic=0x18, ATAPI Mic = 0x19,
14074 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14075 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14076 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14077 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14078 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14079 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14080 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14081 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14082 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14088 * generic initialization of ADC, input mixers and output mixers
14090 static struct hda_verb alc861vd_volume_init_verbs[] = {
14092 * Unmute ADC0 and set the default input to mic-in
14094 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14095 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14097 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14098 * the analog-loopback mixer widget
14100 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14107 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14114 * Set up output mixers (0x02 - 0x05)
14116 /* set vol=0 to output mixers */
14117 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14118 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14119 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14120 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14122 /* set up input amps for analog loopback */
14123 /* Amp Indices: DAC = 0, mixer = 1 */
14124 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14126 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14127 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14128 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14129 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14130 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14131 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14137 * 3-stack pin configuration:
14138 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14140 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14142 * Set pin mode and muting
14144 /* set front pin widgets 0x14 for output */
14145 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14146 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14147 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14149 /* Mic (rear) pin: input vref at 80% */
14150 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14151 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14152 /* Front Mic pin: input vref at 80% */
14153 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14154 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14155 /* Line In pin: input */
14156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14157 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14158 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14159 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14160 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14161 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14162 /* CD pin widget for input */
14163 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14169 * 6-stack pin configuration:
14171 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14173 * Set pin mode and muting
14175 /* set front pin widgets 0x14 for output */
14176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14178 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14180 /* Rear Pin: output 1 (0x0d) */
14181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14183 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14184 /* CLFE Pin: output 2 (0x0e) */
14185 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14186 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14187 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14188 /* Side Pin: output 3 (0x0f) */
14189 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14190 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14191 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14193 /* Mic (rear) pin: input vref at 80% */
14194 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14195 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14196 /* Front Mic pin: input vref at 80% */
14197 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14198 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14199 /* Line In pin: input */
14200 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14201 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14202 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14203 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14204 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14205 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14206 /* CD pin widget for input */
14207 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14212 static struct hda_verb alc861vd_eapd_verbs[] = {
14213 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14217 static struct hda_verb alc660vd_eapd_verbs[] = {
14218 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14219 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14223 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14224 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14225 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14226 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14227 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14228 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14232 /* toggle speaker-output according to the hp-jack state */
14233 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14235 unsigned int present;
14236 unsigned char bits;
14238 present = snd_hda_codec_read(codec, 0x1b, 0,
14239 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14240 bits = present ? HDA_AMP_MUTE : 0;
14241 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14242 HDA_AMP_MUTE, bits);
14245 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14247 unsigned int present;
14248 unsigned char bits;
14250 present = snd_hda_codec_read(codec, 0x18, 0,
14251 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14252 bits = present ? HDA_AMP_MUTE : 0;
14253 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14254 HDA_AMP_MUTE, bits);
14257 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14259 alc861vd_lenovo_hp_automute(codec);
14260 alc861vd_lenovo_mic_automute(codec);
14263 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14266 switch (res >> 26) {
14267 case ALC880_HP_EVENT:
14268 alc861vd_lenovo_hp_automute(codec);
14270 case ALC880_MIC_EVENT:
14271 alc861vd_lenovo_mic_automute(codec);
14276 static struct hda_verb alc861vd_dallas_verbs[] = {
14277 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14278 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14279 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14280 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14284 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14285 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14287 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14288 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14289 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14292 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14295 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14296 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14297 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14298 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14302 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14303 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14305 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14306 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14307 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14314 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14315 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14316 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14321 /* toggle speaker-output according to the hp-jack state */
14322 static void alc861vd_dallas_automute(struct hda_codec *codec)
14324 unsigned int present;
14326 present = snd_hda_codec_read(codec, 0x15, 0,
14327 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14328 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14329 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14332 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14334 if ((res >> 26) == ALC880_HP_EVENT)
14335 alc861vd_dallas_automute(codec);
14338 #ifdef CONFIG_SND_HDA_POWER_SAVE
14339 #define alc861vd_loopbacks alc880_loopbacks
14342 /* pcm configuration: identiacal with ALC880 */
14343 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14344 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14345 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14346 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14349 * configuration and preset
14351 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14352 [ALC660VD_3ST] = "3stack-660",
14353 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14354 [ALC660VD_ASUS_V1S] = "asus-v1s",
14355 [ALC861VD_3ST] = "3stack",
14356 [ALC861VD_3ST_DIG] = "3stack-digout",
14357 [ALC861VD_6ST_DIG] = "6stack-digout",
14358 [ALC861VD_LENOVO] = "lenovo",
14359 [ALC861VD_DALLAS] = "dallas",
14360 [ALC861VD_HP] = "hp",
14361 [ALC861VD_AUTO] = "auto",
14364 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14365 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14366 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14367 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14368 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14369 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14370 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14371 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14372 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14373 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14374 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14375 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14376 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14377 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14378 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14379 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14380 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14381 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14385 static struct alc_config_preset alc861vd_presets[] = {
14387 .mixers = { alc861vd_3st_mixer },
14388 .init_verbs = { alc861vd_volume_init_verbs,
14389 alc861vd_3stack_init_verbs },
14390 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14391 .dac_nids = alc660vd_dac_nids,
14392 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14393 .channel_mode = alc861vd_3stack_2ch_modes,
14394 .input_mux = &alc861vd_capture_source,
14396 [ALC660VD_3ST_DIG] = {
14397 .mixers = { alc861vd_3st_mixer },
14398 .init_verbs = { alc861vd_volume_init_verbs,
14399 alc861vd_3stack_init_verbs },
14400 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14401 .dac_nids = alc660vd_dac_nids,
14402 .dig_out_nid = ALC861VD_DIGOUT_NID,
14403 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14404 .channel_mode = alc861vd_3stack_2ch_modes,
14405 .input_mux = &alc861vd_capture_source,
14408 .mixers = { alc861vd_3st_mixer },
14409 .init_verbs = { alc861vd_volume_init_verbs,
14410 alc861vd_3stack_init_verbs },
14411 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14412 .dac_nids = alc861vd_dac_nids,
14413 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14414 .channel_mode = alc861vd_3stack_2ch_modes,
14415 .input_mux = &alc861vd_capture_source,
14417 [ALC861VD_3ST_DIG] = {
14418 .mixers = { alc861vd_3st_mixer },
14419 .init_verbs = { alc861vd_volume_init_verbs,
14420 alc861vd_3stack_init_verbs },
14421 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14422 .dac_nids = alc861vd_dac_nids,
14423 .dig_out_nid = ALC861VD_DIGOUT_NID,
14424 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14425 .channel_mode = alc861vd_3stack_2ch_modes,
14426 .input_mux = &alc861vd_capture_source,
14428 [ALC861VD_6ST_DIG] = {
14429 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14430 .init_verbs = { alc861vd_volume_init_verbs,
14431 alc861vd_6stack_init_verbs },
14432 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14433 .dac_nids = alc861vd_dac_nids,
14434 .dig_out_nid = ALC861VD_DIGOUT_NID,
14435 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14436 .channel_mode = alc861vd_6stack_modes,
14437 .input_mux = &alc861vd_capture_source,
14439 [ALC861VD_LENOVO] = {
14440 .mixers = { alc861vd_lenovo_mixer },
14441 .init_verbs = { alc861vd_volume_init_verbs,
14442 alc861vd_3stack_init_verbs,
14443 alc861vd_eapd_verbs,
14444 alc861vd_lenovo_unsol_verbs },
14445 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14446 .dac_nids = alc660vd_dac_nids,
14447 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14448 .channel_mode = alc861vd_3stack_2ch_modes,
14449 .input_mux = &alc861vd_capture_source,
14450 .unsol_event = alc861vd_lenovo_unsol_event,
14451 .init_hook = alc861vd_lenovo_automute,
14453 [ALC861VD_DALLAS] = {
14454 .mixers = { alc861vd_dallas_mixer },
14455 .init_verbs = { alc861vd_dallas_verbs },
14456 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14457 .dac_nids = alc861vd_dac_nids,
14458 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14459 .channel_mode = alc861vd_3stack_2ch_modes,
14460 .input_mux = &alc861vd_dallas_capture_source,
14461 .unsol_event = alc861vd_dallas_unsol_event,
14462 .init_hook = alc861vd_dallas_automute,
14465 .mixers = { alc861vd_hp_mixer },
14466 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14467 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14468 .dac_nids = alc861vd_dac_nids,
14469 .dig_out_nid = ALC861VD_DIGOUT_NID,
14470 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14471 .channel_mode = alc861vd_3stack_2ch_modes,
14472 .input_mux = &alc861vd_hp_capture_source,
14473 .unsol_event = alc861vd_dallas_unsol_event,
14474 .init_hook = alc861vd_dallas_automute,
14476 [ALC660VD_ASUS_V1S] = {
14477 .mixers = { alc861vd_lenovo_mixer },
14478 .init_verbs = { alc861vd_volume_init_verbs,
14479 alc861vd_3stack_init_verbs,
14480 alc861vd_eapd_verbs,
14481 alc861vd_lenovo_unsol_verbs },
14482 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14483 .dac_nids = alc660vd_dac_nids,
14484 .dig_out_nid = ALC861VD_DIGOUT_NID,
14485 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14486 .channel_mode = alc861vd_3stack_2ch_modes,
14487 .input_mux = &alc861vd_capture_source,
14488 .unsol_event = alc861vd_lenovo_unsol_event,
14489 .init_hook = alc861vd_lenovo_automute,
14494 * BIOS auto configuration
14496 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14497 hda_nid_t nid, int pin_type, int dac_idx)
14499 alc_set_pin_output(codec, nid, pin_type);
14502 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14504 struct alc_spec *spec = codec->spec;
14507 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14508 for (i = 0; i <= HDA_SIDE; i++) {
14509 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14510 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14512 alc861vd_auto_set_output_and_unmute(codec, nid,
14518 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14520 struct alc_spec *spec = codec->spec;
14523 pin = spec->autocfg.hp_pins[0];
14524 if (pin) /* connect to front and use dac 0 */
14525 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14526 pin = spec->autocfg.speaker_pins[0];
14528 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14531 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14532 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14534 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14536 struct alc_spec *spec = codec->spec;
14539 for (i = 0; i < AUTO_PIN_LAST; i++) {
14540 hda_nid_t nid = spec->autocfg.input_pins[i];
14541 if (alc861vd_is_input_pin(nid)) {
14542 snd_hda_codec_write(codec, nid, 0,
14543 AC_VERB_SET_PIN_WIDGET_CONTROL,
14544 i <= AUTO_PIN_FRONT_MIC ?
14545 PIN_VREF80 : PIN_IN);
14546 if (nid != ALC861VD_PIN_CD_NID)
14547 snd_hda_codec_write(codec, nid, 0,
14548 AC_VERB_SET_AMP_GAIN_MUTE,
14554 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14556 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14557 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14559 /* add playback controls from the parsed DAC table */
14560 /* Based on ALC880 version. But ALC861VD has separate,
14561 * different NIDs for mute/unmute switch and volume control */
14562 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14563 const struct auto_pin_cfg *cfg)
14566 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14567 hda_nid_t nid_v, nid_s;
14570 for (i = 0; i < cfg->line_outs; i++) {
14571 if (!spec->multiout.dac_nids[i])
14573 nid_v = alc861vd_idx_to_mixer_vol(
14575 spec->multiout.dac_nids[i]));
14576 nid_s = alc861vd_idx_to_mixer_switch(
14578 spec->multiout.dac_nids[i]));
14582 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14583 "Center Playback Volume",
14584 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14588 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14589 "LFE Playback Volume",
14590 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14594 err = add_control(spec, ALC_CTL_BIND_MUTE,
14595 "Center Playback Switch",
14596 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14600 err = add_control(spec, ALC_CTL_BIND_MUTE,
14601 "LFE Playback Switch",
14602 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14607 sprintf(name, "%s Playback Volume", chname[i]);
14608 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14609 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14613 sprintf(name, "%s Playback Switch", chname[i]);
14614 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14615 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14624 /* add playback controls for speaker and HP outputs */
14625 /* Based on ALC880 version. But ALC861VD has separate,
14626 * different NIDs for mute/unmute switch and volume control */
14627 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14628 hda_nid_t pin, const char *pfx)
14630 hda_nid_t nid_v, nid_s;
14637 if (alc880_is_fixed_pin(pin)) {
14638 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14639 /* specify the DAC as the extra output */
14640 if (!spec->multiout.hp_nid)
14641 spec->multiout.hp_nid = nid_v;
14643 spec->multiout.extra_out_nid[0] = nid_v;
14644 /* control HP volume/switch on the output mixer amp */
14645 nid_v = alc861vd_idx_to_mixer_vol(
14646 alc880_fixed_pin_idx(pin));
14647 nid_s = alc861vd_idx_to_mixer_switch(
14648 alc880_fixed_pin_idx(pin));
14650 sprintf(name, "%s Playback Volume", pfx);
14651 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14652 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14655 sprintf(name, "%s Playback Switch", pfx);
14656 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14657 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14660 } else if (alc880_is_multi_pin(pin)) {
14661 /* set manual connection */
14662 /* we have only a switch on HP-out PIN */
14663 sprintf(name, "%s Playback Switch", pfx);
14664 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14665 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14672 /* parse the BIOS configuration and set up the alc_spec
14673 * return 1 if successful, 0 if the proper config is not found,
14674 * or a negative error code
14675 * Based on ALC880 version - had to change it to override
14676 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14677 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14679 struct alc_spec *spec = codec->spec;
14681 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14683 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14687 if (!spec->autocfg.line_outs)
14688 return 0; /* can't find valid BIOS pin config */
14690 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14693 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14696 err = alc861vd_auto_create_extra_out(spec,
14697 spec->autocfg.speaker_pins[0],
14701 err = alc861vd_auto_create_extra_out(spec,
14702 spec->autocfg.hp_pins[0],
14706 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14710 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14712 if (spec->autocfg.dig_out_pin)
14713 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14715 if (spec->kctls.list)
14716 add_mixer(spec, spec->kctls.list);
14718 add_verb(spec, alc861vd_volume_init_verbs);
14720 spec->num_mux_defs = 1;
14721 spec->input_mux = &spec->private_imux;
14723 err = alc_auto_add_mic_boost(codec);
14727 store_pin_configs(codec);
14731 /* additional initialization for auto-configuration model */
14732 static void alc861vd_auto_init(struct hda_codec *codec)
14734 struct alc_spec *spec = codec->spec;
14735 alc861vd_auto_init_multi_out(codec);
14736 alc861vd_auto_init_hp_out(codec);
14737 alc861vd_auto_init_analog_input(codec);
14738 alc861vd_auto_init_input_src(codec);
14739 if (spec->unsol_event)
14740 alc_inithook(codec);
14743 static int patch_alc861vd(struct hda_codec *codec)
14745 struct alc_spec *spec;
14746 int err, board_config;
14748 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14752 codec->spec = spec;
14754 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14758 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14759 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14760 "ALC861VD, trying auto-probe from BIOS...\n");
14761 board_config = ALC861VD_AUTO;
14764 if (board_config == ALC861VD_AUTO) {
14765 /* automatic parse from the BIOS config */
14766 err = alc861vd_parse_auto_config(codec);
14772 "hda_codec: Cannot set up configuration "
14773 "from BIOS. Using base mode...\n");
14774 board_config = ALC861VD_3ST;
14778 if (board_config != ALC861VD_AUTO)
14779 setup_preset(spec, &alc861vd_presets[board_config]);
14781 if (codec->vendor_id == 0x10ec0660) {
14782 spec->stream_name_analog = "ALC660-VD Analog";
14783 spec->stream_name_digital = "ALC660-VD Digital";
14784 /* always turn on EAPD */
14785 add_verb(spec, alc660vd_eapd_verbs);
14787 spec->stream_name_analog = "ALC861VD Analog";
14788 spec->stream_name_digital = "ALC861VD Digital";
14791 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14792 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14794 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14795 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14797 spec->adc_nids = alc861vd_adc_nids;
14798 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14799 spec->capsrc_nids = alc861vd_capsrc_nids;
14800 spec->is_mix_capture = 1;
14802 set_capture_mixer(spec);
14804 spec->vmaster_nid = 0x02;
14806 codec->patch_ops = alc_patch_ops;
14808 if (board_config == ALC861VD_AUTO)
14809 spec->init_hook = alc861vd_auto_init;
14810 #ifdef CONFIG_SND_HDA_POWER_SAVE
14811 if (!spec->loopback.amplist)
14812 spec->loopback.amplist = alc861vd_loopbacks;
14814 codec->proc_widget_hook = print_realtek_coef;
14822 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14823 * configuration. Each pin widget can choose any input DACs and a mixer.
14824 * Each ADC is connected from a mixer of all inputs. This makes possible
14825 * 6-channel independent captures.
14827 * In addition, an independent DAC for the multi-playback (not used in this
14830 #define ALC662_DIGOUT_NID 0x06
14831 #define ALC662_DIGIN_NID 0x0a
14833 static hda_nid_t alc662_dac_nids[4] = {
14834 /* front, rear, clfe, rear_surr */
14838 static hda_nid_t alc662_adc_nids[1] = {
14843 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14846 /* FIXME: should be a matrix-type input source selection */
14847 static struct hda_input_mux alc662_capture_source = {
14851 { "Front Mic", 0x1 },
14857 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14865 static struct hda_input_mux alc662_eeepc_capture_source = {
14873 static struct hda_input_mux alc663_capture_source = {
14877 { "Front Mic", 0x1 },
14882 static struct hda_input_mux alc663_m51va_capture_source = {
14885 { "Ext-Mic", 0x0 },
14893 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14900 static struct hda_verb alc662_3ST_ch2_init[] = {
14901 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14902 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14903 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14904 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14911 static struct hda_verb alc662_3ST_ch6_init[] = {
14912 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14913 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14914 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14915 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14916 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14917 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14921 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14922 { 2, alc662_3ST_ch2_init },
14923 { 6, alc662_3ST_ch6_init },
14929 static struct hda_verb alc662_sixstack_ch6_init[] = {
14930 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14931 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14932 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14939 static struct hda_verb alc662_sixstack_ch8_init[] = {
14940 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14941 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14942 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14946 static struct hda_channel_mode alc662_5stack_modes[2] = {
14947 { 2, alc662_sixstack_ch6_init },
14948 { 6, alc662_sixstack_ch8_init },
14951 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14952 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14955 static struct snd_kcontrol_new alc662_base_mixer[] = {
14956 /* output mixer control */
14957 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14958 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14959 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14960 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14961 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14962 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14963 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14964 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14967 /*Input mixer control */
14968 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14969 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14970 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14971 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14972 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14973 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14974 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14975 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14979 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14980 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14981 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14983 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14984 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14985 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14986 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14989 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14990 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14991 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14992 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14996 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14997 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14998 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14999 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15000 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15001 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15002 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15003 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15004 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15005 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15006 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15007 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15008 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15009 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15012 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15013 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15014 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
15015 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15019 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15020 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15021 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15022 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15023 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15026 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15032 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15033 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15035 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15036 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15038 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15039 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15040 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15042 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15043 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15044 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15048 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15049 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15050 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15051 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15052 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15053 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15054 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15055 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15056 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15057 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15058 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15059 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15060 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15066 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15067 .ops = &snd_hda_bind_vol,
15069 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15070 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15075 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15076 .ops = &snd_hda_bind_sw,
15078 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15079 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15084 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15085 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15086 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15087 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15088 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15092 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15093 .ops = &snd_hda_bind_sw,
15095 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15096 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15097 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15102 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15103 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15104 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15107 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15108 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15113 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15114 .ops = &snd_hda_bind_sw,
15116 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15117 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15118 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15123 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15124 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15125 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15128 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15129 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15133 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15134 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15135 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15136 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15137 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15139 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15140 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15144 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15145 .ops = &snd_hda_bind_vol,
15147 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15148 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15153 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15154 .ops = &snd_hda_bind_sw,
15156 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15157 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15162 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15163 HDA_BIND_VOL("Master Playback Volume",
15164 &alc663_asus_two_bind_master_vol),
15165 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15166 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15167 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15173 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15174 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15175 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15176 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15183 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15184 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15185 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15186 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15187 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15188 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15192 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15193 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15197 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15198 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15199 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15200 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15204 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15205 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15207 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15211 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15213 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15214 .name = "Channel Mode",
15215 .info = alc_ch_mode_info,
15216 .get = alc_ch_mode_get,
15217 .put = alc_ch_mode_put,
15222 static struct hda_verb alc662_init_verbs[] = {
15223 /* ADC: mute amp left and right */
15224 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15225 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15226 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15236 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15238 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15239 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15241 /* Front Pin: output 0 (0x0c) */
15242 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15243 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15245 /* Rear Pin: output 1 (0x0d) */
15246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15249 /* CLFE Pin: output 2 (0x0e) */
15250 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15253 /* Mic (rear) pin: input vref at 80% */
15254 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15255 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15256 /* Front Mic pin: input vref at 80% */
15257 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15258 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15259 /* Line In pin: input */
15260 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15261 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15262 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15263 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15265 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15266 /* CD pin widget for input */
15267 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15269 /* FIXME: use matrix-type input source selection */
15270 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15272 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15275 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15277 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15282 /* always trun on EAPD */
15283 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15284 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15289 static struct hda_verb alc662_sue_init_verbs[] = {
15290 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15291 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15295 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15296 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15297 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15301 /* Set Unsolicited Event*/
15302 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15303 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15304 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15309 * generic initialization of ADC, input mixers and output mixers
15311 static struct hda_verb alc662_auto_init_verbs[] = {
15313 * Unmute ADC and set the default input to mic-in
15315 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15318 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15320 * Note: PASD motherboards uses the Line In 2 as the input for front
15321 * panel mic (mic 2)
15323 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15331 * Set up output mixers (0x0c - 0x0f)
15333 /* set vol=0 to output mixers */
15334 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15335 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15336 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15338 /* set up input amps for analog loopback */
15339 /* Amp Indices: DAC = 0, mixer = 1 */
15340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15341 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15348 /* FIXME: use matrix-type input source selection */
15349 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15352 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15356 /* additional verbs for ALC663 */
15357 static struct hda_verb alc663_auto_init_verbs[] = {
15358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15363 static struct hda_verb alc663_m51va_init_verbs[] = {
15364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15366 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15367 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15368 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15371 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15372 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15376 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15377 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15378 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15379 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15382 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15383 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15387 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15388 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15389 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15390 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15391 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15392 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15394 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15395 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15399 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15400 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15401 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15402 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15405 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15406 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15410 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15411 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15412 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15413 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15414 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15417 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15418 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15420 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15421 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15422 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15426 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15427 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15428 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15429 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15430 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15431 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15432 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15433 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15434 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15435 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15436 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15437 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15438 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15442 static struct hda_verb alc663_g71v_init_verbs[] = {
15443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15444 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15445 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15447 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15448 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15449 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15451 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15452 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15453 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15457 static struct hda_verb alc663_g50v_init_verbs[] = {
15458 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15459 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15460 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15462 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15463 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15467 static struct hda_verb alc662_ecs_init_verbs[] = {
15468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15470 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15471 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15475 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15476 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15477 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15481 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15483 unsigned int present;
15484 unsigned char bits;
15486 present = snd_hda_codec_read(codec, 0x14, 0,
15487 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15488 bits = present ? HDA_AMP_MUTE : 0;
15489 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15490 HDA_AMP_MUTE, bits);
15493 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15495 unsigned int present;
15496 unsigned char bits;
15498 present = snd_hda_codec_read(codec, 0x1b, 0,
15499 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15500 bits = present ? HDA_AMP_MUTE : 0;
15501 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15502 HDA_AMP_MUTE, bits);
15503 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15504 HDA_AMP_MUTE, bits);
15507 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15510 if ((res >> 26) == ALC880_HP_EVENT)
15511 alc662_lenovo_101e_all_automute(codec);
15512 if ((res >> 26) == ALC880_FRONT_EVENT)
15513 alc662_lenovo_101e_ispeaker_automute(codec);
15516 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15518 unsigned int present;
15520 present = snd_hda_codec_read(codec, 0x18, 0,
15521 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15522 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15523 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15524 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15525 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15526 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15527 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15528 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15529 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15532 /* unsolicited event for HP jack sensing */
15533 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15536 if ((res >> 26) == ALC880_HP_EVENT)
15537 alc262_hippo1_automute( codec );
15539 if ((res >> 26) == ALC880_MIC_EVENT)
15540 alc662_eeepc_mic_automute(codec);
15543 static void alc662_eeepc_inithook(struct hda_codec *codec)
15545 alc262_hippo1_automute( codec );
15546 alc662_eeepc_mic_automute(codec);
15549 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15552 unsigned int present;
15554 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15555 present = snd_hda_codec_read(codec, 0x14, 0,
15556 AC_VERB_GET_PIN_SENSE, 0);
15557 present = (present & 0x80000000) != 0;
15559 /* mute internal speaker */
15560 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15561 HDA_AMP_MUTE, HDA_AMP_MUTE);
15563 /* unmute internal speaker if necessary */
15564 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15565 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15566 HDA_AMP_MUTE, mute);
15570 /* unsolicited event for HP jack sensing */
15571 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15574 if ((res >> 26) == ALC880_HP_EVENT)
15575 alc662_eeepc_ep20_automute(codec);
15578 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15580 alc662_eeepc_ep20_automute(codec);
15583 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15585 unsigned int present;
15586 unsigned char bits;
15588 present = snd_hda_codec_read(codec, 0x21, 0,
15589 AC_VERB_GET_PIN_SENSE, 0)
15590 & AC_PINSENSE_PRESENCE;
15591 bits = present ? HDA_AMP_MUTE : 0;
15592 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15593 AMP_IN_MUTE(0), bits);
15594 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15595 AMP_IN_MUTE(0), bits);
15598 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15600 unsigned int present;
15601 unsigned char bits;
15603 present = snd_hda_codec_read(codec, 0x21, 0,
15604 AC_VERB_GET_PIN_SENSE, 0)
15605 & AC_PINSENSE_PRESENCE;
15606 bits = present ? HDA_AMP_MUTE : 0;
15607 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15608 AMP_IN_MUTE(0), bits);
15609 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15610 AMP_IN_MUTE(0), bits);
15611 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15612 AMP_IN_MUTE(0), bits);
15613 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15614 AMP_IN_MUTE(0), bits);
15617 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15619 unsigned int present;
15620 unsigned char bits;
15622 present = snd_hda_codec_read(codec, 0x15, 0,
15623 AC_VERB_GET_PIN_SENSE, 0)
15624 & AC_PINSENSE_PRESENCE;
15625 bits = present ? HDA_AMP_MUTE : 0;
15626 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15627 AMP_IN_MUTE(0), bits);
15628 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15629 AMP_IN_MUTE(0), bits);
15630 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15631 AMP_IN_MUTE(0), bits);
15632 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15633 AMP_IN_MUTE(0), bits);
15636 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15638 unsigned int present;
15639 unsigned char bits;
15641 present = snd_hda_codec_read(codec, 0x1b, 0,
15642 AC_VERB_GET_PIN_SENSE, 0)
15643 & AC_PINSENSE_PRESENCE;
15644 bits = present ? 0 : PIN_OUT;
15645 snd_hda_codec_write(codec, 0x14, 0,
15646 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15649 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15651 unsigned int present1, present2;
15653 present1 = snd_hda_codec_read(codec, 0x21, 0,
15654 AC_VERB_GET_PIN_SENSE, 0)
15655 & AC_PINSENSE_PRESENCE;
15656 present2 = snd_hda_codec_read(codec, 0x15, 0,
15657 AC_VERB_GET_PIN_SENSE, 0)
15658 & AC_PINSENSE_PRESENCE;
15660 if (present1 || present2) {
15661 snd_hda_codec_write_cache(codec, 0x14, 0,
15662 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15664 snd_hda_codec_write_cache(codec, 0x14, 0,
15665 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15669 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15671 unsigned int present1, present2;
15673 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15674 AC_VERB_GET_PIN_SENSE, 0)
15675 & AC_PINSENSE_PRESENCE;
15676 present2 = snd_hda_codec_read(codec, 0x15, 0,
15677 AC_VERB_GET_PIN_SENSE, 0)
15678 & AC_PINSENSE_PRESENCE;
15680 if (present1 || present2) {
15681 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15682 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15683 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15684 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15686 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15687 AMP_IN_MUTE(0), 0);
15688 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15689 AMP_IN_MUTE(0), 0);
15693 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15695 unsigned int present;
15697 present = snd_hda_codec_read(codec, 0x18, 0,
15698 AC_VERB_GET_PIN_SENSE, 0)
15699 & AC_PINSENSE_PRESENCE;
15700 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15701 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15702 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15703 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15704 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15705 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15706 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15707 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15710 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15713 switch (res >> 26) {
15714 case ALC880_HP_EVENT:
15715 alc663_m51va_speaker_automute(codec);
15717 case ALC880_MIC_EVENT:
15718 alc663_m51va_mic_automute(codec);
15723 static void alc663_m51va_inithook(struct hda_codec *codec)
15725 alc663_m51va_speaker_automute(codec);
15726 alc663_m51va_mic_automute(codec);
15729 /* ***************** Mode1 ******************************/
15730 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15733 switch (res >> 26) {
15734 case ALC880_HP_EVENT:
15735 alc663_m51va_speaker_automute(codec);
15737 case ALC880_MIC_EVENT:
15738 alc662_eeepc_mic_automute(codec);
15743 static void alc663_mode1_inithook(struct hda_codec *codec)
15745 alc663_m51va_speaker_automute(codec);
15746 alc662_eeepc_mic_automute(codec);
15748 /* ***************** Mode2 ******************************/
15749 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15752 switch (res >> 26) {
15753 case ALC880_HP_EVENT:
15754 alc662_f5z_speaker_automute(codec);
15756 case ALC880_MIC_EVENT:
15757 alc662_eeepc_mic_automute(codec);
15762 static void alc662_mode2_inithook(struct hda_codec *codec)
15764 alc662_f5z_speaker_automute(codec);
15765 alc662_eeepc_mic_automute(codec);
15767 /* ***************** Mode3 ******************************/
15768 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15771 switch (res >> 26) {
15772 case ALC880_HP_EVENT:
15773 alc663_two_hp_m1_speaker_automute(codec);
15775 case ALC880_MIC_EVENT:
15776 alc662_eeepc_mic_automute(codec);
15781 static void alc663_mode3_inithook(struct hda_codec *codec)
15783 alc663_two_hp_m1_speaker_automute(codec);
15784 alc662_eeepc_mic_automute(codec);
15786 /* ***************** Mode4 ******************************/
15787 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15790 switch (res >> 26) {
15791 case ALC880_HP_EVENT:
15792 alc663_21jd_two_speaker_automute(codec);
15794 case ALC880_MIC_EVENT:
15795 alc662_eeepc_mic_automute(codec);
15800 static void alc663_mode4_inithook(struct hda_codec *codec)
15802 alc663_21jd_two_speaker_automute(codec);
15803 alc662_eeepc_mic_automute(codec);
15805 /* ***************** Mode5 ******************************/
15806 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15809 switch (res >> 26) {
15810 case ALC880_HP_EVENT:
15811 alc663_15jd_two_speaker_automute(codec);
15813 case ALC880_MIC_EVENT:
15814 alc662_eeepc_mic_automute(codec);
15819 static void alc663_mode5_inithook(struct hda_codec *codec)
15821 alc663_15jd_two_speaker_automute(codec);
15822 alc662_eeepc_mic_automute(codec);
15824 /* ***************** Mode6 ******************************/
15825 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15828 switch (res >> 26) {
15829 case ALC880_HP_EVENT:
15830 alc663_two_hp_m2_speaker_automute(codec);
15832 case ALC880_MIC_EVENT:
15833 alc662_eeepc_mic_automute(codec);
15838 static void alc663_mode6_inithook(struct hda_codec *codec)
15840 alc663_two_hp_m2_speaker_automute(codec);
15841 alc662_eeepc_mic_automute(codec);
15844 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15846 unsigned int present;
15847 unsigned char bits;
15849 present = snd_hda_codec_read(codec, 0x21, 0,
15850 AC_VERB_GET_PIN_SENSE, 0)
15851 & AC_PINSENSE_PRESENCE;
15852 bits = present ? HDA_AMP_MUTE : 0;
15853 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15854 HDA_AMP_MUTE, bits);
15855 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15856 HDA_AMP_MUTE, bits);
15859 static void alc663_g71v_front_automute(struct hda_codec *codec)
15861 unsigned int present;
15862 unsigned char bits;
15864 present = snd_hda_codec_read(codec, 0x15, 0,
15865 AC_VERB_GET_PIN_SENSE, 0)
15866 & AC_PINSENSE_PRESENCE;
15867 bits = present ? HDA_AMP_MUTE : 0;
15868 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15869 HDA_AMP_MUTE, bits);
15872 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15875 switch (res >> 26) {
15876 case ALC880_HP_EVENT:
15877 alc663_g71v_hp_automute(codec);
15879 case ALC880_FRONT_EVENT:
15880 alc663_g71v_front_automute(codec);
15882 case ALC880_MIC_EVENT:
15883 alc662_eeepc_mic_automute(codec);
15888 static void alc663_g71v_inithook(struct hda_codec *codec)
15890 alc663_g71v_front_automute(codec);
15891 alc663_g71v_hp_automute(codec);
15892 alc662_eeepc_mic_automute(codec);
15895 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15898 switch (res >> 26) {
15899 case ALC880_HP_EVENT:
15900 alc663_m51va_speaker_automute(codec);
15902 case ALC880_MIC_EVENT:
15903 alc662_eeepc_mic_automute(codec);
15908 static void alc663_g50v_inithook(struct hda_codec *codec)
15910 alc663_m51va_speaker_automute(codec);
15911 alc662_eeepc_mic_automute(codec);
15914 /* bind hp and internal speaker mute (with plug check) */
15915 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15916 struct snd_ctl_elem_value *ucontrol)
15918 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15919 long *valp = ucontrol->value.integer.value;
15922 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15924 valp[0] ? 0 : HDA_AMP_MUTE);
15925 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15927 valp[1] ? 0 : HDA_AMP_MUTE);
15929 alc262_hippo1_automute(codec);
15933 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15934 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15937 .name = "Master Playback Switch",
15938 .info = snd_hda_mixer_amp_switch_info,
15939 .get = snd_hda_mixer_amp_switch_get,
15940 .put = alc662_ecs_master_sw_put,
15941 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15944 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15945 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15946 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15948 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15949 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15950 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15954 #ifdef CONFIG_SND_HDA_POWER_SAVE
15955 #define alc662_loopbacks alc880_loopbacks
15959 /* pcm configuration: identiacal with ALC880 */
15960 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15961 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15962 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15963 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15966 * configuration and preset
15968 static const char *alc662_models[ALC662_MODEL_LAST] = {
15969 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15970 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15971 [ALC662_3ST_6ch] = "3stack-6ch",
15972 [ALC662_5ST_DIG] = "6stack-dig",
15973 [ALC662_LENOVO_101E] = "lenovo-101e",
15974 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15975 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15976 [ALC662_ECS] = "ecs",
15977 [ALC663_ASUS_M51VA] = "m51va",
15978 [ALC663_ASUS_G71V] = "g71v",
15979 [ALC663_ASUS_H13] = "h13",
15980 [ALC663_ASUS_G50V] = "g50v",
15981 [ALC663_ASUS_MODE1] = "asus-mode1",
15982 [ALC662_ASUS_MODE2] = "asus-mode2",
15983 [ALC663_ASUS_MODE3] = "asus-mode3",
15984 [ALC663_ASUS_MODE4] = "asus-mode4",
15985 [ALC663_ASUS_MODE5] = "asus-mode5",
15986 [ALC663_ASUS_MODE6] = "asus-mode6",
15987 [ALC662_AUTO] = "auto",
15990 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15991 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15992 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15993 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15994 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15995 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15996 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15997 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15998 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15999 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16000 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16001 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
16002 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16003 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16004 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16005 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16006 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16007 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16008 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16009 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16010 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16011 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16012 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16013 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16014 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16015 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16016 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16017 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16018 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16019 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16020 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16021 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16022 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16023 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16024 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16025 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16026 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16027 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16028 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16029 ALC662_3ST_6ch_DIG),
16030 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16031 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16032 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16033 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16034 ALC662_3ST_6ch_DIG),
16035 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16036 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16037 ALC662_3ST_6ch_DIG),
16038 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
16039 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
16040 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
16044 static struct alc_config_preset alc662_presets[] = {
16045 [ALC662_3ST_2ch_DIG] = {
16046 .mixers = { alc662_3ST_2ch_mixer },
16047 .init_verbs = { alc662_init_verbs },
16048 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16049 .dac_nids = alc662_dac_nids,
16050 .dig_out_nid = ALC662_DIGOUT_NID,
16051 .dig_in_nid = ALC662_DIGIN_NID,
16052 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16053 .channel_mode = alc662_3ST_2ch_modes,
16054 .input_mux = &alc662_capture_source,
16056 [ALC662_3ST_6ch_DIG] = {
16057 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16058 .init_verbs = { alc662_init_verbs },
16059 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16060 .dac_nids = alc662_dac_nids,
16061 .dig_out_nid = ALC662_DIGOUT_NID,
16062 .dig_in_nid = ALC662_DIGIN_NID,
16063 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16064 .channel_mode = alc662_3ST_6ch_modes,
16066 .input_mux = &alc662_capture_source,
16068 [ALC662_3ST_6ch] = {
16069 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16070 .init_verbs = { alc662_init_verbs },
16071 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16072 .dac_nids = alc662_dac_nids,
16073 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16074 .channel_mode = alc662_3ST_6ch_modes,
16076 .input_mux = &alc662_capture_source,
16078 [ALC662_5ST_DIG] = {
16079 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16080 .init_verbs = { alc662_init_verbs },
16081 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16082 .dac_nids = alc662_dac_nids,
16083 .dig_out_nid = ALC662_DIGOUT_NID,
16084 .dig_in_nid = ALC662_DIGIN_NID,
16085 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16086 .channel_mode = alc662_5stack_modes,
16087 .input_mux = &alc662_capture_source,
16089 [ALC662_LENOVO_101E] = {
16090 .mixers = { alc662_lenovo_101e_mixer },
16091 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16092 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16093 .dac_nids = alc662_dac_nids,
16094 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16095 .channel_mode = alc662_3ST_2ch_modes,
16096 .input_mux = &alc662_lenovo_101e_capture_source,
16097 .unsol_event = alc662_lenovo_101e_unsol_event,
16098 .init_hook = alc662_lenovo_101e_all_automute,
16100 [ALC662_ASUS_EEEPC_P701] = {
16101 .mixers = { alc662_eeepc_p701_mixer },
16102 .init_verbs = { alc662_init_verbs,
16103 alc662_eeepc_sue_init_verbs },
16104 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16105 .dac_nids = alc662_dac_nids,
16106 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16107 .channel_mode = alc662_3ST_2ch_modes,
16108 .input_mux = &alc662_eeepc_capture_source,
16109 .unsol_event = alc662_eeepc_unsol_event,
16110 .init_hook = alc662_eeepc_inithook,
16112 [ALC662_ASUS_EEEPC_EP20] = {
16113 .mixers = { alc662_eeepc_ep20_mixer,
16114 alc662_chmode_mixer },
16115 .init_verbs = { alc662_init_verbs,
16116 alc662_eeepc_ep20_sue_init_verbs },
16117 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16118 .dac_nids = alc662_dac_nids,
16119 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16120 .channel_mode = alc662_3ST_6ch_modes,
16121 .input_mux = &alc662_lenovo_101e_capture_source,
16122 .unsol_event = alc662_eeepc_ep20_unsol_event,
16123 .init_hook = alc662_eeepc_ep20_inithook,
16126 .mixers = { alc662_ecs_mixer },
16127 .init_verbs = { alc662_init_verbs,
16128 alc662_ecs_init_verbs },
16129 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16130 .dac_nids = alc662_dac_nids,
16131 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16132 .channel_mode = alc662_3ST_2ch_modes,
16133 .input_mux = &alc662_eeepc_capture_source,
16134 .unsol_event = alc662_eeepc_unsol_event,
16135 .init_hook = alc662_eeepc_inithook,
16137 [ALC663_ASUS_M51VA] = {
16138 .mixers = { alc663_m51va_mixer },
16139 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16140 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16141 .dac_nids = alc662_dac_nids,
16142 .dig_out_nid = ALC662_DIGOUT_NID,
16143 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16144 .channel_mode = alc662_3ST_2ch_modes,
16145 .input_mux = &alc663_m51va_capture_source,
16146 .unsol_event = alc663_m51va_unsol_event,
16147 .init_hook = alc663_m51va_inithook,
16149 [ALC663_ASUS_G71V] = {
16150 .mixers = { alc663_g71v_mixer },
16151 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16152 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16153 .dac_nids = alc662_dac_nids,
16154 .dig_out_nid = ALC662_DIGOUT_NID,
16155 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16156 .channel_mode = alc662_3ST_2ch_modes,
16157 .input_mux = &alc662_eeepc_capture_source,
16158 .unsol_event = alc663_g71v_unsol_event,
16159 .init_hook = alc663_g71v_inithook,
16161 [ALC663_ASUS_H13] = {
16162 .mixers = { alc663_m51va_mixer },
16163 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16164 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16165 .dac_nids = alc662_dac_nids,
16166 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16167 .channel_mode = alc662_3ST_2ch_modes,
16168 .input_mux = &alc663_m51va_capture_source,
16169 .unsol_event = alc663_m51va_unsol_event,
16170 .init_hook = alc663_m51va_inithook,
16172 [ALC663_ASUS_G50V] = {
16173 .mixers = { alc663_g50v_mixer },
16174 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16175 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16176 .dac_nids = alc662_dac_nids,
16177 .dig_out_nid = ALC662_DIGOUT_NID,
16178 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16179 .channel_mode = alc662_3ST_6ch_modes,
16180 .input_mux = &alc663_capture_source,
16181 .unsol_event = alc663_g50v_unsol_event,
16182 .init_hook = alc663_g50v_inithook,
16184 [ALC663_ASUS_MODE1] = {
16185 .mixers = { alc663_m51va_mixer },
16186 .cap_mixer = alc662_auto_capture_mixer,
16187 .init_verbs = { alc662_init_verbs,
16188 alc663_21jd_amic_init_verbs },
16189 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16191 .dac_nids = alc662_dac_nids,
16192 .dig_out_nid = ALC662_DIGOUT_NID,
16193 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16194 .channel_mode = alc662_3ST_2ch_modes,
16195 .input_mux = &alc662_eeepc_capture_source,
16196 .unsol_event = alc663_mode1_unsol_event,
16197 .init_hook = alc663_mode1_inithook,
16199 [ALC662_ASUS_MODE2] = {
16200 .mixers = { alc662_1bjd_mixer },
16201 .cap_mixer = alc662_auto_capture_mixer,
16202 .init_verbs = { alc662_init_verbs,
16203 alc662_1bjd_amic_init_verbs },
16204 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16205 .dac_nids = alc662_dac_nids,
16206 .dig_out_nid = ALC662_DIGOUT_NID,
16207 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16208 .channel_mode = alc662_3ST_2ch_modes,
16209 .input_mux = &alc662_eeepc_capture_source,
16210 .unsol_event = alc662_mode2_unsol_event,
16211 .init_hook = alc662_mode2_inithook,
16213 [ALC663_ASUS_MODE3] = {
16214 .mixers = { alc663_two_hp_m1_mixer },
16215 .cap_mixer = alc662_auto_capture_mixer,
16216 .init_verbs = { alc662_init_verbs,
16217 alc663_two_hp_amic_m1_init_verbs },
16218 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16220 .dac_nids = alc662_dac_nids,
16221 .dig_out_nid = ALC662_DIGOUT_NID,
16222 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16223 .channel_mode = alc662_3ST_2ch_modes,
16224 .input_mux = &alc662_eeepc_capture_source,
16225 .unsol_event = alc663_mode3_unsol_event,
16226 .init_hook = alc663_mode3_inithook,
16228 [ALC663_ASUS_MODE4] = {
16229 .mixers = { alc663_asus_21jd_clfe_mixer },
16230 .cap_mixer = alc662_auto_capture_mixer,
16231 .init_verbs = { alc662_init_verbs,
16232 alc663_21jd_amic_init_verbs},
16233 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16235 .dac_nids = alc662_dac_nids,
16236 .dig_out_nid = ALC662_DIGOUT_NID,
16237 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16238 .channel_mode = alc662_3ST_2ch_modes,
16239 .input_mux = &alc662_eeepc_capture_source,
16240 .unsol_event = alc663_mode4_unsol_event,
16241 .init_hook = alc663_mode4_inithook,
16243 [ALC663_ASUS_MODE5] = {
16244 .mixers = { alc663_asus_15jd_clfe_mixer },
16245 .cap_mixer = alc662_auto_capture_mixer,
16246 .init_verbs = { alc662_init_verbs,
16247 alc663_15jd_amic_init_verbs },
16248 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16250 .dac_nids = alc662_dac_nids,
16251 .dig_out_nid = ALC662_DIGOUT_NID,
16252 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16253 .channel_mode = alc662_3ST_2ch_modes,
16254 .input_mux = &alc662_eeepc_capture_source,
16255 .unsol_event = alc663_mode5_unsol_event,
16256 .init_hook = alc663_mode5_inithook,
16258 [ALC663_ASUS_MODE6] = {
16259 .mixers = { alc663_two_hp_m2_mixer },
16260 .cap_mixer = alc662_auto_capture_mixer,
16261 .init_verbs = { alc662_init_verbs,
16262 alc663_two_hp_amic_m2_init_verbs },
16263 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16265 .dac_nids = alc662_dac_nids,
16266 .dig_out_nid = ALC662_DIGOUT_NID,
16267 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16268 .channel_mode = alc662_3ST_2ch_modes,
16269 .input_mux = &alc662_eeepc_capture_source,
16270 .unsol_event = alc663_mode6_unsol_event,
16271 .init_hook = alc663_mode6_inithook,
16277 * BIOS auto configuration
16280 /* add playback controls from the parsed DAC table */
16281 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16282 const struct auto_pin_cfg *cfg)
16285 static const char *chname[4] = {
16286 "Front", "Surround", NULL /*CLFE*/, "Side"
16291 for (i = 0; i < cfg->line_outs; i++) {
16292 if (!spec->multiout.dac_nids[i])
16294 nid = alc880_idx_to_dac(i);
16297 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16298 "Center Playback Volume",
16299 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16303 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16304 "LFE Playback Volume",
16305 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16309 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16310 "Center Playback Switch",
16311 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16315 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16316 "LFE Playback Switch",
16317 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16322 sprintf(name, "%s Playback Volume", chname[i]);
16323 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16324 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16328 sprintf(name, "%s Playback Switch", chname[i]);
16329 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16330 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16339 /* add playback controls for speaker and HP outputs */
16340 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16351 /* ALC663 has a mono output pin on 0x17 */
16352 sprintf(name, "%s Playback Switch", pfx);
16353 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16354 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16358 if (alc880_is_fixed_pin(pin)) {
16359 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16360 /* printk("DAC nid=%x\n",nid); */
16361 /* specify the DAC as the extra output */
16362 if (!spec->multiout.hp_nid)
16363 spec->multiout.hp_nid = nid;
16365 spec->multiout.extra_out_nid[0] = nid;
16366 /* control HP volume/switch on the output mixer amp */
16367 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16368 sprintf(name, "%s Playback Volume", pfx);
16369 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16370 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16373 sprintf(name, "%s Playback Switch", pfx);
16374 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16375 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16378 } else if (alc880_is_multi_pin(pin)) {
16379 /* set manual connection */
16380 /* we have only a switch on HP-out PIN */
16381 sprintf(name, "%s Playback Switch", pfx);
16382 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16383 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16390 /* create playback/capture controls for input pins */
16391 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16392 const struct auto_pin_cfg *cfg)
16394 struct hda_input_mux *imux = &spec->private_imux;
16397 for (i = 0; i < AUTO_PIN_LAST; i++) {
16398 if (alc880_is_input_pin(cfg->input_pins[i])) {
16399 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16400 err = new_analog_input(spec, cfg->input_pins[i],
16401 auto_pin_cfg_labels[i],
16405 imux->items[imux->num_items].label =
16406 auto_pin_cfg_labels[i];
16407 imux->items[imux->num_items].index =
16408 alc880_input_pin_idx(cfg->input_pins[i]);
16415 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16416 hda_nid_t nid, int pin_type,
16419 alc_set_pin_output(codec, nid, pin_type);
16420 /* need the manual connection? */
16421 if (alc880_is_multi_pin(nid)) {
16422 struct alc_spec *spec = codec->spec;
16423 int idx = alc880_multi_pin_idx(nid);
16424 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16425 AC_VERB_SET_CONNECT_SEL,
16426 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16430 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16432 struct alc_spec *spec = codec->spec;
16435 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16436 for (i = 0; i <= HDA_SIDE; i++) {
16437 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16438 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16440 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16445 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16447 struct alc_spec *spec = codec->spec;
16450 pin = spec->autocfg.hp_pins[0];
16451 if (pin) /* connect to front */
16453 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16454 pin = spec->autocfg.speaker_pins[0];
16456 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16459 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16460 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16462 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16464 struct alc_spec *spec = codec->spec;
16467 for (i = 0; i < AUTO_PIN_LAST; i++) {
16468 hda_nid_t nid = spec->autocfg.input_pins[i];
16469 if (alc662_is_input_pin(nid)) {
16470 snd_hda_codec_write(codec, nid, 0,
16471 AC_VERB_SET_PIN_WIDGET_CONTROL,
16472 (i <= AUTO_PIN_FRONT_MIC ?
16473 PIN_VREF80 : PIN_IN));
16474 if (nid != ALC662_PIN_CD_NID)
16475 snd_hda_codec_write(codec, nid, 0,
16476 AC_VERB_SET_AMP_GAIN_MUTE,
16482 #define alc662_auto_init_input_src alc882_auto_init_input_src
16484 static int alc662_parse_auto_config(struct hda_codec *codec)
16486 struct alc_spec *spec = codec->spec;
16488 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16490 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16494 if (!spec->autocfg.line_outs)
16495 return 0; /* can't find valid BIOS pin config */
16497 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16500 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16503 err = alc662_auto_create_extra_out(spec,
16504 spec->autocfg.speaker_pins[0],
16508 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16512 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16516 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16518 if (spec->autocfg.dig_out_pin)
16519 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16521 if (spec->kctls.list)
16522 add_mixer(spec, spec->kctls.list);
16524 spec->num_mux_defs = 1;
16525 spec->input_mux = &spec->private_imux;
16527 add_verb(spec, alc662_auto_init_verbs);
16528 if (codec->vendor_id == 0x10ec0663)
16529 add_verb(spec, alc663_auto_init_verbs);
16531 err = alc_auto_add_mic_boost(codec);
16535 store_pin_configs(codec);
16539 /* additional initialization for auto-configuration model */
16540 static void alc662_auto_init(struct hda_codec *codec)
16542 struct alc_spec *spec = codec->spec;
16543 alc662_auto_init_multi_out(codec);
16544 alc662_auto_init_hp_out(codec);
16545 alc662_auto_init_analog_input(codec);
16546 alc662_auto_init_input_src(codec);
16547 if (spec->unsol_event)
16548 alc_inithook(codec);
16551 static int patch_alc662(struct hda_codec *codec)
16553 struct alc_spec *spec;
16554 int err, board_config;
16556 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16560 codec->spec = spec;
16562 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16564 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16567 if (board_config < 0) {
16568 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16569 "trying auto-probe from BIOS...\n");
16570 board_config = ALC662_AUTO;
16573 if (board_config == ALC662_AUTO) {
16574 /* automatic parse from the BIOS config */
16575 err = alc662_parse_auto_config(codec);
16581 "hda_codec: Cannot set up configuration "
16582 "from BIOS. Using base mode...\n");
16583 board_config = ALC662_3ST_2ch_DIG;
16587 if (board_config != ALC662_AUTO)
16588 setup_preset(spec, &alc662_presets[board_config]);
16590 if (codec->vendor_id == 0x10ec0663) {
16591 spec->stream_name_analog = "ALC663 Analog";
16592 spec->stream_name_digital = "ALC663 Digital";
16593 } else if (codec->vendor_id == 0x10ec0272) {
16594 spec->stream_name_analog = "ALC272 Analog";
16595 spec->stream_name_digital = "ALC272 Digital";
16597 spec->stream_name_analog = "ALC662 Analog";
16598 spec->stream_name_digital = "ALC662 Digital";
16601 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16602 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16604 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16605 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16607 spec->adc_nids = alc662_adc_nids;
16608 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16609 spec->capsrc_nids = alc662_capsrc_nids;
16610 spec->is_mix_capture = 1;
16612 if (!spec->cap_mixer)
16613 set_capture_mixer(spec);
16615 spec->vmaster_nid = 0x02;
16617 codec->patch_ops = alc_patch_ops;
16618 if (board_config == ALC662_AUTO)
16619 spec->init_hook = alc662_auto_init;
16620 #ifdef CONFIG_SND_HDA_POWER_SAVE
16621 if (!spec->loopback.amplist)
16622 spec->loopback.amplist = alc662_loopbacks;
16624 codec->proc_widget_hook = print_realtek_coef;
16632 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16633 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16634 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16635 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16636 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16637 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16638 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16639 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16640 .patch = patch_alc861 },
16641 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16642 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16643 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16644 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16645 .patch = patch_alc883 },
16646 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16647 .patch = patch_alc662 },
16648 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16649 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16650 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16651 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16652 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16653 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16654 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16655 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16656 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16657 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16658 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16659 .patch = patch_alc883 },
16660 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16661 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16662 {} /* terminator */
16665 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16667 MODULE_LICENSE("GPL");
16668 MODULE_DESCRIPTION("Realtek HD-audio codec");
16670 static struct hda_codec_preset_list realtek_list = {
16671 .preset = snd_hda_preset_realtek,
16672 .owner = THIS_MODULE,
16675 static int __init patch_realtek_init(void)
16677 return snd_hda_add_codec_preset(&realtek_list);
16680 static void __exit patch_realtek_exit(void)
16682 snd_hda_delete_codec_preset(&realtek_list);
16685 module_init(patch_realtek_init)
16686 module_exit(patch_realtek_exit)