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"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
81 #ifdef CONFIG_SND_DEBUG
85 ALC260_MODEL_LAST /* last tag */
95 ALC262_HP_BPC_D7000_WL,
96 ALC262_HP_BPC_D7000_WF,
108 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,
134 ALC269_MODEL_LAST /* last tag */
151 /* ALC861-VD models */
172 ALC662_ASUS_EEEPC_P701,
173 ALC662_ASUS_EEEPC_EP20,
212 ALC883_TARGA_2ch_DIG,
218 ALC883_LENOVO_101E_2ch,
219 ALC883_LENOVO_NB0763,
220 ALC888_LENOVO_MS7195_DIG,
227 ALC883_FUJITSU_PI2515,
228 ALC883_3ST_6ch_INTEL,
236 #define GPIO_MASK 0x03
239 /* codec parameterization */
240 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
241 unsigned int num_mixers;
243 const struct hda_verb *init_verbs[5]; /* initialization verbs
247 unsigned int num_init_verbs;
249 char *stream_name_analog; /* analog PCM stream */
250 struct hda_pcm_stream *stream_analog_playback;
251 struct hda_pcm_stream *stream_analog_capture;
252 struct hda_pcm_stream *stream_analog_alt_playback;
253 struct hda_pcm_stream *stream_analog_alt_capture;
255 char *stream_name_digital; /* digital PCM stream */
256 struct hda_pcm_stream *stream_digital_playback;
257 struct hda_pcm_stream *stream_digital_capture;
260 struct hda_multi_out multiout; /* playback set-up
261 * max_channels, dacs must be set
262 * dig_out_nid and hp_nid are optional
264 hda_nid_t alt_dac_nid;
267 unsigned int num_adc_nids;
269 hda_nid_t *capsrc_nids;
270 hda_nid_t dig_in_nid; /* digital-in NID; optional */
273 unsigned int num_mux_defs;
274 const struct hda_input_mux *input_mux;
275 unsigned int cur_mux[3];
278 const struct hda_channel_mode *channel_mode;
279 int num_channel_mode;
282 /* PCM information */
283 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
285 /* dynamic controls, init_verbs and input_mux */
286 struct auto_pin_cfg autocfg;
287 unsigned int num_kctl_alloc, num_kctl_used;
288 struct snd_kcontrol_new *kctl_alloc;
289 struct hda_input_mux private_imux;
290 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
293 void (*init_hook)(struct hda_codec *codec);
294 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
296 /* for pin sensing */
297 unsigned int sense_updated: 1;
298 unsigned int jack_present: 1;
299 unsigned int master_sw: 1;
301 /* for virtual master */
302 hda_nid_t vmaster_nid;
303 #ifdef CONFIG_SND_HDA_POWER_SAVE
304 struct hda_loopback_check loopback;
309 unsigned int pll_coef_idx, pll_coef_bit;
313 * configuration template - to be copied to the spec instance
315 struct alc_config_preset {
316 struct snd_kcontrol_new *mixers[5]; /* should be identical size
319 const struct hda_verb *init_verbs[5];
320 unsigned int num_dacs;
322 hda_nid_t dig_out_nid; /* optional */
323 hda_nid_t hp_nid; /* optional */
324 unsigned int num_adc_nids;
326 hda_nid_t *capsrc_nids;
327 hda_nid_t dig_in_nid;
328 unsigned int num_channel_mode;
329 const struct hda_channel_mode *channel_mode;
331 unsigned int num_mux_defs;
332 const struct hda_input_mux *input_mux;
333 void (*unsol_event)(struct hda_codec *, unsigned int);
334 void (*init_hook)(struct hda_codec *);
335 #ifdef CONFIG_SND_HDA_POWER_SAVE
336 struct hda_amp_list *loopbacks;
344 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
345 struct snd_ctl_elem_info *uinfo)
347 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
348 struct alc_spec *spec = codec->spec;
349 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
350 if (mux_idx >= spec->num_mux_defs)
352 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
355 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
356 struct snd_ctl_elem_value *ucontrol)
358 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
359 struct alc_spec *spec = codec->spec;
360 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
362 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
366 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
367 struct snd_ctl_elem_value *ucontrol)
369 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
370 struct alc_spec *spec = codec->spec;
371 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
372 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
373 hda_nid_t nid = spec->capsrc_nids ?
374 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
375 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
376 nid, &spec->cur_mux[adc_idx]);
381 * channel mode setting
383 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
384 struct snd_ctl_elem_info *uinfo)
386 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
387 struct alc_spec *spec = codec->spec;
388 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
389 spec->num_channel_mode);
392 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
393 struct snd_ctl_elem_value *ucontrol)
395 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
396 struct alc_spec *spec = codec->spec;
397 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
398 spec->num_channel_mode,
399 spec->multiout.max_channels);
402 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
403 struct snd_ctl_elem_value *ucontrol)
405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
406 struct alc_spec *spec = codec->spec;
407 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
408 spec->num_channel_mode,
409 &spec->multiout.max_channels);
410 if (err >= 0 && spec->need_dac_fix)
411 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
416 * Control the mode of pin widget settings via the mixer. "pc" is used
417 * instead of "%" to avoid consequences of accidently treating the % as
418 * being part of a format specifier. Maximum allowed length of a value is
419 * 63 characters plus NULL terminator.
421 * Note: some retasking pin complexes seem to ignore requests for input
422 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
423 * are requested. Therefore order this list so that this behaviour will not
424 * cause problems when mixer clients move through the enum sequentially.
425 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
428 static char *alc_pin_mode_names[] = {
429 "Mic 50pc bias", "Mic 80pc bias",
430 "Line in", "Line out", "Headphone out",
432 static unsigned char alc_pin_mode_values[] = {
433 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
435 /* The control can present all 5 options, or it can limit the options based
436 * in the pin being assumed to be exclusively an input or an output pin. In
437 * addition, "input" pins may or may not process the mic bias option
438 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
439 * accept requests for bias as of chip versions up to March 2006) and/or
440 * wiring in the computer.
442 #define ALC_PIN_DIR_IN 0x00
443 #define ALC_PIN_DIR_OUT 0x01
444 #define ALC_PIN_DIR_INOUT 0x02
445 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
446 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
448 /* Info about the pin modes supported by the different pin direction modes.
449 * For each direction the minimum and maximum values are given.
451 static signed char alc_pin_mode_dir_info[5][2] = {
452 { 0, 2 }, /* ALC_PIN_DIR_IN */
453 { 3, 4 }, /* ALC_PIN_DIR_OUT */
454 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
455 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
456 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
458 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
459 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
460 #define alc_pin_mode_n_items(_dir) \
461 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
463 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
464 struct snd_ctl_elem_info *uinfo)
466 unsigned int item_num = uinfo->value.enumerated.item;
467 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
469 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
471 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
473 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
474 item_num = alc_pin_mode_min(dir);
475 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
479 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
480 struct snd_ctl_elem_value *ucontrol)
483 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
484 hda_nid_t nid = kcontrol->private_value & 0xffff;
485 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
486 long *valp = ucontrol->value.integer.value;
487 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
488 AC_VERB_GET_PIN_WIDGET_CONTROL,
491 /* Find enumerated value for current pinctl setting */
492 i = alc_pin_mode_min(dir);
493 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
495 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
499 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
500 struct snd_ctl_elem_value *ucontrol)
503 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
504 hda_nid_t nid = kcontrol->private_value & 0xffff;
505 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
506 long val = *ucontrol->value.integer.value;
507 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
508 AC_VERB_GET_PIN_WIDGET_CONTROL,
511 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
512 val = alc_pin_mode_min(dir);
514 change = pinctl != alc_pin_mode_values[val];
516 /* Set pin mode to that requested */
517 snd_hda_codec_write_cache(codec, nid, 0,
518 AC_VERB_SET_PIN_WIDGET_CONTROL,
519 alc_pin_mode_values[val]);
521 /* Also enable the retasking pin's input/output as required
522 * for the requested pin mode. Enum values of 2 or less are
525 * Dynamically switching the input/output buffers probably
526 * reduces noise slightly (particularly on input) so we'll
527 * do it. However, having both input and output buffers
528 * enabled simultaneously doesn't seem to be problematic if
529 * this turns out to be necessary in the future.
532 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
533 HDA_AMP_MUTE, HDA_AMP_MUTE);
534 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
537 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
538 HDA_AMP_MUTE, HDA_AMP_MUTE);
539 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
546 #define ALC_PIN_MODE(xname, nid, dir) \
547 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
548 .info = alc_pin_mode_info, \
549 .get = alc_pin_mode_get, \
550 .put = alc_pin_mode_put, \
551 .private_value = nid | (dir<<16) }
553 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
554 * together using a mask with more than one bit set. This control is
555 * currently used only by the ALC260 test model. At this stage they are not
556 * needed for any "production" models.
558 #ifdef CONFIG_SND_DEBUG
559 #define alc_gpio_data_info snd_ctl_boolean_mono_info
561 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
562 struct snd_ctl_elem_value *ucontrol)
564 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
565 hda_nid_t nid = kcontrol->private_value & 0xffff;
566 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
567 long *valp = ucontrol->value.integer.value;
568 unsigned int val = snd_hda_codec_read(codec, nid, 0,
569 AC_VERB_GET_GPIO_DATA, 0x00);
571 *valp = (val & mask) != 0;
574 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
575 struct snd_ctl_elem_value *ucontrol)
578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
579 hda_nid_t nid = kcontrol->private_value & 0xffff;
580 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
581 long val = *ucontrol->value.integer.value;
582 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
583 AC_VERB_GET_GPIO_DATA,
586 /* Set/unset the masked GPIO bit(s) as needed */
587 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
592 snd_hda_codec_write_cache(codec, nid, 0,
593 AC_VERB_SET_GPIO_DATA, gpio_data);
597 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
598 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
599 .info = alc_gpio_data_info, \
600 .get = alc_gpio_data_get, \
601 .put = alc_gpio_data_put, \
602 .private_value = nid | (mask<<16) }
603 #endif /* CONFIG_SND_DEBUG */
605 /* A switch control to allow the enabling of the digital IO pins on the
606 * ALC260. This is incredibly simplistic; the intention of this control is
607 * to provide something in the test model allowing digital outputs to be
608 * identified if present. If models are found which can utilise these
609 * outputs a more complete mixer control can be devised for those models if
612 #ifdef CONFIG_SND_DEBUG
613 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
615 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
616 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 *valp = ucontrol->value.integer.value;
622 unsigned int val = snd_hda_codec_read(codec, nid, 0,
623 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
625 *valp = (val & mask) != 0;
628 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
629 struct snd_ctl_elem_value *ucontrol)
632 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
633 hda_nid_t nid = kcontrol->private_value & 0xffff;
634 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
635 long val = *ucontrol->value.integer.value;
636 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
637 AC_VERB_GET_DIGI_CONVERT_1,
640 /* Set/unset the masked control bit(s) as needed */
641 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
646 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
651 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
652 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
653 .info = alc_spdif_ctrl_info, \
654 .get = alc_spdif_ctrl_get, \
655 .put = alc_spdif_ctrl_put, \
656 .private_value = nid | (mask<<16) }
657 #endif /* CONFIG_SND_DEBUG */
659 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
660 * Again, this is only used in the ALC26x test models to help identify when
661 * the EAPD line must be asserted for features to work.
663 #ifdef CONFIG_SND_DEBUG
664 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
666 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
667 struct snd_ctl_elem_value *ucontrol)
669 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
670 hda_nid_t nid = kcontrol->private_value & 0xffff;
671 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
672 long *valp = ucontrol->value.integer.value;
673 unsigned int val = snd_hda_codec_read(codec, nid, 0,
674 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
676 *valp = (val & mask) != 0;
680 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
681 struct snd_ctl_elem_value *ucontrol)
684 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
685 hda_nid_t nid = kcontrol->private_value & 0xffff;
686 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
687 long val = *ucontrol->value.integer.value;
688 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
689 AC_VERB_GET_EAPD_BTLENABLE,
692 /* Set/unset the masked control bit(s) as needed */
693 change = (!val ? 0 : mask) != (ctrl_data & mask);
698 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
704 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
705 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
706 .info = alc_eapd_ctrl_info, \
707 .get = alc_eapd_ctrl_get, \
708 .put = alc_eapd_ctrl_put, \
709 .private_value = nid | (mask<<16) }
710 #endif /* CONFIG_SND_DEBUG */
713 * set up from the preset table
715 static void setup_preset(struct alc_spec *spec,
716 const struct alc_config_preset *preset)
720 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
721 spec->mixers[spec->num_mixers++] = preset->mixers[i];
722 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
724 spec->init_verbs[spec->num_init_verbs++] =
725 preset->init_verbs[i];
727 spec->channel_mode = preset->channel_mode;
728 spec->num_channel_mode = preset->num_channel_mode;
729 spec->need_dac_fix = preset->need_dac_fix;
731 spec->multiout.max_channels = spec->channel_mode[0].channels;
733 spec->multiout.num_dacs = preset->num_dacs;
734 spec->multiout.dac_nids = preset->dac_nids;
735 spec->multiout.dig_out_nid = preset->dig_out_nid;
736 spec->multiout.hp_nid = preset->hp_nid;
738 spec->num_mux_defs = preset->num_mux_defs;
739 if (!spec->num_mux_defs)
740 spec->num_mux_defs = 1;
741 spec->input_mux = preset->input_mux;
743 spec->num_adc_nids = preset->num_adc_nids;
744 spec->adc_nids = preset->adc_nids;
745 spec->capsrc_nids = preset->capsrc_nids;
746 spec->dig_in_nid = preset->dig_in_nid;
748 spec->unsol_event = preset->unsol_event;
749 spec->init_hook = preset->init_hook;
750 #ifdef CONFIG_SND_HDA_POWER_SAVE
751 spec->loopback.amplist = preset->loopbacks;
755 /* Enable GPIO mask and set output */
756 static struct hda_verb alc_gpio1_init_verbs[] = {
757 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
758 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
759 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
763 static struct hda_verb alc_gpio2_init_verbs[] = {
764 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
765 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
766 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
770 static struct hda_verb alc_gpio3_init_verbs[] = {
771 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
772 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
773 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
778 * Fix hardware PLL issue
779 * On some codecs, the analog PLL gating control must be off while
780 * the default value is 1.
782 static void alc_fix_pll(struct hda_codec *codec)
784 struct alc_spec *spec = codec->spec;
789 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
791 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
792 AC_VERB_GET_PROC_COEF, 0);
793 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
795 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
796 val & ~(1 << spec->pll_coef_bit));
799 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
800 unsigned int coef_idx, unsigned int coef_bit)
802 struct alc_spec *spec = codec->spec;
804 spec->pll_coef_idx = coef_idx;
805 spec->pll_coef_bit = coef_bit;
809 static void alc_sku_automute(struct hda_codec *codec)
811 struct alc_spec *spec = codec->spec;
812 unsigned int present;
813 unsigned int hp_nid = spec->autocfg.hp_pins[0];
814 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
816 /* need to execute and sync at first */
817 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
818 present = snd_hda_codec_read(codec, hp_nid, 0,
819 AC_VERB_GET_PIN_SENSE, 0);
820 spec->jack_present = (present & 0x80000000) != 0;
821 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
822 spec->jack_present ? 0 : PIN_OUT);
825 /* unsolicited event for HP jack sensing */
826 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
828 if (codec->vendor_id == 0x10ec0880)
832 if (res != ALC880_HP_EVENT)
835 alc_sku_automute(codec);
838 /* additional initialization for ALC888 variants */
839 static void alc888_coef_init(struct hda_codec *codec)
843 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
844 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
845 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
846 if ((tmp & 0xf0) == 2)
848 snd_hda_codec_read(codec, 0x20, 0,
849 AC_VERB_SET_PROC_COEF, 0x830);
852 snd_hda_codec_read(codec, 0x20, 0,
853 AC_VERB_SET_PROC_COEF, 0x3030);
856 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
857 * 31 ~ 16 : Manufacture ID
859 * 7 ~ 0 : Assembly ID
860 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
862 static void alc_subsystem_id(struct hda_codec *codec,
863 unsigned int porta, unsigned int porte,
866 unsigned int ass, tmp, i;
868 struct alc_spec *spec = codec->spec;
870 ass = codec->subsystem_id & 0xffff;
871 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
875 * 31~30 : port conetcivity
878 * 19~16 : Check sum (15:1)
883 if (codec->vendor_id == 0x10ec0260)
885 ass = snd_hda_codec_read(codec, nid, 0,
886 AC_VERB_GET_CONFIG_DEFAULT, 0);
887 if (!(ass & 1) && !(ass & 0x100000))
889 if ((ass >> 30) != 1) /* no physical connection */
894 for (i = 1; i < 16; i++) {
898 if (((ass >> 16) & 0xf) != tmp)
904 * 2 : 0 --> Desktop, 1 --> Laptop
905 * 3~5 : External Amplifier control
908 tmp = (ass & 0x38) >> 3; /* external Amp control */
911 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
914 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
917 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
919 case 5: /* set EAPD output high */
920 switch (codec->vendor_id) {
922 snd_hda_codec_write(codec, 0x0f, 0,
923 AC_VERB_SET_EAPD_BTLENABLE, 2);
924 snd_hda_codec_write(codec, 0x10, 0,
925 AC_VERB_SET_EAPD_BTLENABLE, 2);
936 snd_hda_codec_write(codec, 0x14, 0,
937 AC_VERB_SET_EAPD_BTLENABLE, 2);
938 snd_hda_codec_write(codec, 0x15, 0,
939 AC_VERB_SET_EAPD_BTLENABLE, 2);
942 switch (codec->vendor_id) {
944 snd_hda_codec_write(codec, 0x1a, 0,
945 AC_VERB_SET_COEF_INDEX, 7);
946 tmp = snd_hda_codec_read(codec, 0x1a, 0,
947 AC_VERB_GET_PROC_COEF, 0);
948 snd_hda_codec_write(codec, 0x1a, 0,
949 AC_VERB_SET_COEF_INDEX, 7);
950 snd_hda_codec_write(codec, 0x1a, 0,
951 AC_VERB_SET_PROC_COEF,
960 snd_hda_codec_write(codec, 0x20, 0,
961 AC_VERB_SET_COEF_INDEX, 7);
962 tmp = snd_hda_codec_read(codec, 0x20, 0,
963 AC_VERB_GET_PROC_COEF, 0);
964 snd_hda_codec_write(codec, 0x20, 0,
965 AC_VERB_SET_COEF_INDEX, 7);
966 snd_hda_codec_write(codec, 0x20, 0,
967 AC_VERB_SET_PROC_COEF,
971 /*alc888_coef_init(codec);*/ /* called in alc_init() */
975 snd_hda_codec_write(codec, 0x20, 0,
976 AC_VERB_SET_COEF_INDEX, 7);
977 tmp = snd_hda_codec_read(codec, 0x20, 0,
978 AC_VERB_GET_PROC_COEF, 0);
979 snd_hda_codec_write(codec, 0x20, 0,
980 AC_VERB_SET_COEF_INDEX, 7);
981 snd_hda_codec_write(codec, 0x20, 0,
982 AC_VERB_SET_PROC_COEF,
990 /* is laptop or Desktop and enable the function "Mute internal speaker
991 * when the external headphone out jack is plugged"
996 * 10~8 : Jack location
997 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
999 * 15 : 1 --> enable the function "Mute internal speaker
1000 * when the external headphone out jack is plugged"
1002 if (!spec->autocfg.speaker_pins[0]) {
1003 if (spec->autocfg.line_out_pins[0])
1004 spec->autocfg.speaker_pins[0] =
1005 spec->autocfg.line_out_pins[0];
1010 if (!spec->autocfg.hp_pins[0]) {
1011 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1013 spec->autocfg.hp_pins[0] = porta;
1015 spec->autocfg.hp_pins[0] = porte;
1017 spec->autocfg.hp_pins[0] = portd;
1022 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1023 AC_VERB_SET_UNSOLICITED_ENABLE,
1024 AC_USRSP_EN | ALC880_HP_EVENT);
1026 spec->unsol_event = alc_sku_unsol_event;
1030 * Fix-up pin default configurations
1038 static void alc_fix_pincfg(struct hda_codec *codec,
1039 const struct snd_pci_quirk *quirk,
1040 const struct alc_pincfg **pinfix)
1042 const struct alc_pincfg *cfg;
1044 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1048 cfg = pinfix[quirk->value];
1049 for (; cfg->nid; cfg++) {
1052 for (i = 0; i < 4; i++) {
1053 snd_hda_codec_write(codec, cfg->nid, 0,
1054 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1062 * ALC880 3-stack model
1064 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1065 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1066 * F-Mic = 0x1b, HP = 0x19
1069 static hda_nid_t alc880_dac_nids[4] = {
1070 /* front, rear, clfe, rear_surr */
1071 0x02, 0x05, 0x04, 0x03
1074 static hda_nid_t alc880_adc_nids[3] = {
1079 /* The datasheet says the node 0x07 is connected from inputs,
1080 * but it shows zero connection in the real implementation on some devices.
1081 * Note: this is a 915GAV bug, fixed on 915GLV
1083 static hda_nid_t alc880_adc_nids_alt[2] = {
1088 #define ALC880_DIGOUT_NID 0x06
1089 #define ALC880_DIGIN_NID 0x0a
1091 static struct hda_input_mux alc880_capture_source = {
1095 { "Front Mic", 0x3 },
1101 /* channel source setting (2/6 channel selection for 3-stack) */
1103 static struct hda_verb alc880_threestack_ch2_init[] = {
1104 /* set line-in to input, mute it */
1105 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1106 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1107 /* set mic-in to input vref 80%, mute it */
1108 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1109 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1114 static struct hda_verb alc880_threestack_ch6_init[] = {
1115 /* set line-in to output, unmute it */
1116 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1117 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1118 /* set mic-in to output, unmute it */
1119 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1120 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1124 static struct hda_channel_mode alc880_threestack_modes[2] = {
1125 { 2, alc880_threestack_ch2_init },
1126 { 6, alc880_threestack_ch6_init },
1129 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1130 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1133 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1136 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1137 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1144 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1145 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1146 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1147 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1148 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1150 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1151 .name = "Channel Mode",
1152 .info = alc_ch_mode_info,
1153 .get = alc_ch_mode_get,
1154 .put = alc_ch_mode_put,
1159 /* capture mixer elements */
1160 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1161 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1162 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1163 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1164 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1165 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1166 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1169 /* The multiple "Capture Source" controls confuse alsamixer
1170 * So call somewhat different..
1172 /* .name = "Capture Source", */
1173 .name = "Input Source",
1175 .info = alc_mux_enum_info,
1176 .get = alc_mux_enum_get,
1177 .put = alc_mux_enum_put,
1182 /* capture mixer elements (in case NID 0x07 not available) */
1183 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1184 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1185 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1186 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1187 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1189 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1190 /* The multiple "Capture Source" controls confuse alsamixer
1191 * So call somewhat different..
1193 /* .name = "Capture Source", */
1194 .name = "Input Source",
1196 .info = alc_mux_enum_info,
1197 .get = alc_mux_enum_get,
1198 .put = alc_mux_enum_put,
1206 * ALC880 5-stack model
1208 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1210 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1211 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1214 /* additional mixers to alc880_three_stack_mixer */
1215 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1216 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1217 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1221 /* channel source setting (6/8 channel selection for 5-stack) */
1223 static struct hda_verb alc880_fivestack_ch6_init[] = {
1224 /* set line-in to input, mute it */
1225 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1226 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1231 static struct hda_verb alc880_fivestack_ch8_init[] = {
1232 /* set line-in to output, unmute it */
1233 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1234 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1238 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1239 { 6, alc880_fivestack_ch6_init },
1240 { 8, alc880_fivestack_ch8_init },
1245 * ALC880 6-stack model
1247 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1248 * Side = 0x05 (0x0f)
1249 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1250 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1253 static hda_nid_t alc880_6st_dac_nids[4] = {
1254 /* front, rear, clfe, rear_surr */
1255 0x02, 0x03, 0x04, 0x05
1258 static struct hda_input_mux alc880_6stack_capture_source = {
1262 { "Front Mic", 0x1 },
1268 /* fixed 8-channels */
1269 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1273 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1274 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1275 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1276 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1277 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1278 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1279 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1280 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1281 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1282 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1283 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1284 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1285 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1286 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1287 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1290 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1291 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1292 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1293 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1295 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1296 .name = "Channel Mode",
1297 .info = alc_ch_mode_info,
1298 .get = alc_ch_mode_get,
1299 .put = alc_ch_mode_put,
1308 * W810 has rear IO for:
1311 * Center/LFE (DAC 04)
1314 * The system also has a pair of internal speakers, and a headphone jack.
1315 * These are both connected to Line2 on the codec, hence to DAC 02.
1317 * There is a variable resistor to control the speaker or headphone
1318 * volume. This is a hardware-only device without a software API.
1320 * Plugging headphones in will disable the internal speakers. This is
1321 * implemented in hardware, not via the driver using jack sense. In
1322 * a similar fashion, plugging into the rear socket marked "front" will
1323 * disable both the speakers and headphones.
1325 * For input, there's a microphone jack, and an "audio in" jack.
1326 * These may not do anything useful with this driver yet, because I
1327 * haven't setup any initialization verbs for these yet...
1330 static hda_nid_t alc880_w810_dac_nids[3] = {
1331 /* front, rear/surround, clfe */
1335 /* fixed 6 channels */
1336 static struct hda_channel_mode alc880_w810_modes[1] = {
1340 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1341 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1342 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1343 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1344 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1345 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1346 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1347 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1348 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1349 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1358 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1359 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1363 static hda_nid_t alc880_z71v_dac_nids[1] = {
1366 #define ALC880_Z71V_HP_DAC 0x03
1368 /* fixed 2 channels */
1369 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1373 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1374 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1375 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1376 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1377 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1378 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1379 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1380 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1387 * ALC880 F1734 model
1389 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1390 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1393 static hda_nid_t alc880_f1734_dac_nids[1] = {
1396 #define ALC880_F1734_HP_DAC 0x02
1398 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1399 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1400 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1401 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1402 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1403 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1404 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1405 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1406 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1410 static struct hda_input_mux alc880_f1734_capture_source = {
1422 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1423 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1424 * Mic = 0x18, Line = 0x1a
1427 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1428 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1430 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1431 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1432 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1433 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1434 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1435 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1436 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1437 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1438 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1439 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1440 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1444 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1447 .name = "Channel Mode",
1448 .info = alc_ch_mode_info,
1449 .get = alc_ch_mode_get,
1450 .put = alc_ch_mode_put,
1456 * ALC880 ASUS W1V model
1458 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1459 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1460 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1463 /* additional mixers to alc880_asus_mixer */
1464 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1465 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1466 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1470 /* additional mixers to alc880_asus_mixer */
1471 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1472 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1473 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1478 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1479 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1480 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1481 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1482 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1483 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1486 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1487 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1490 /* The multiple "Capture Source" controls confuse alsamixer
1491 * So call somewhat different..
1493 /* .name = "Capture Source", */
1494 .name = "Input Source",
1496 .info = alc_mux_enum_info,
1497 .get = alc_mux_enum_get,
1498 .put = alc_mux_enum_put,
1504 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1505 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1506 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1507 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1508 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1509 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1510 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1511 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1512 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1513 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1514 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1515 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1516 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1518 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1519 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1520 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1521 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1522 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1525 .name = "Channel Mode",
1526 .info = alc_ch_mode_info,
1527 .get = alc_ch_mode_get,
1528 .put = alc_ch_mode_put,
1533 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1534 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1535 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1536 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1537 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1538 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1539 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1540 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1541 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1542 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1543 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1547 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1548 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1549 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1550 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1551 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1558 * virtual master controls
1562 * slave controls for virtual master
1564 static const char *alc_slave_vols[] = {
1565 "Front Playback Volume",
1566 "Surround Playback Volume",
1567 "Center Playback Volume",
1568 "LFE Playback Volume",
1569 "Side Playback Volume",
1570 "Headphone Playback Volume",
1571 "Speaker Playback Volume",
1572 "Mono Playback Volume",
1573 "Line-Out Playback Volume",
1577 static const char *alc_slave_sws[] = {
1578 "Front Playback Switch",
1579 "Surround Playback Switch",
1580 "Center Playback Switch",
1581 "LFE Playback Switch",
1582 "Side Playback Switch",
1583 "Headphone Playback Switch",
1584 "Speaker Playback Switch",
1585 "Mono Playback Switch",
1586 "IEC958 Playback Switch",
1591 * build control elements
1593 static int alc_build_controls(struct hda_codec *codec)
1595 struct alc_spec *spec = codec->spec;
1599 for (i = 0; i < spec->num_mixers; i++) {
1600 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1605 if (spec->multiout.dig_out_nid) {
1606 err = snd_hda_create_spdif_out_ctls(codec,
1607 spec->multiout.dig_out_nid);
1610 err = snd_hda_create_spdif_share_sw(codec,
1614 spec->multiout.share_spdif = 1;
1616 if (spec->dig_in_nid) {
1617 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1622 /* if we have no master control, let's create it */
1623 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1624 unsigned int vmaster_tlv[4];
1625 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1626 HDA_OUTPUT, vmaster_tlv);
1627 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1628 vmaster_tlv, alc_slave_vols);
1632 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1633 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1634 NULL, alc_slave_sws);
1644 * initialize the codec volumes, etc
1648 * generic initialization of ADC, input mixers and output mixers
1650 static struct hda_verb alc880_volume_init_verbs[] = {
1652 * Unmute ADC0-2 and set the default input to mic-in
1654 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1655 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1656 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1657 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1658 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1659 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1661 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1663 * Note: PASD motherboards uses the Line In 2 as the input for front
1666 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1667 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1668 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1669 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1670 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1671 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1672 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1673 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1676 * Set up output mixers (0x0c - 0x0f)
1678 /* set vol=0 to output mixers */
1679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1680 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1681 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1682 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1683 /* set up input amps for analog loopback */
1684 /* Amp Indices: DAC = 0, mixer = 1 */
1685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1687 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1688 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1689 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1690 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1692 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1698 * 3-stack pin configuration:
1699 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1701 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1703 * preset connection lists of input pins
1704 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1706 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1707 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1708 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1711 * Set pin mode and muting
1713 /* set front pin widgets 0x14 for output */
1714 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1715 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1716 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1717 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1718 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1719 /* Mic2 (as headphone out) for HP output */
1720 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1722 /* Line In pin widget for input */
1723 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1724 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1725 /* Line2 (as front mic) pin widget for input and vref at 80% */
1726 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1727 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1728 /* CD pin widget for input */
1729 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1735 * 5-stack pin configuration:
1736 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1737 * line-in/side = 0x1a, f-mic = 0x1b
1739 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1741 * preset connection lists of input pins
1742 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1744 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1745 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1748 * Set pin mode and muting
1750 /* set pin widgets 0x14-0x17 for output */
1751 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1752 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1753 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1754 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1755 /* unmute pins for output (no gain on this amp) */
1756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1758 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1759 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1761 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1764 /* Mic2 (as headphone out) for HP output */
1765 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1766 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1767 /* Line In pin widget for input */
1768 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1769 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1770 /* Line2 (as front mic) pin widget for input and vref at 80% */
1771 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1772 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1773 /* CD pin widget for input */
1774 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1780 * W810 pin configuration:
1781 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1783 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1784 /* hphone/speaker input selector: front DAC */
1785 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1787 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1788 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1791 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1792 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1794 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1795 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1801 * Z71V pin configuration:
1802 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1804 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1811 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1812 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1813 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1819 * 6-stack pin configuration:
1820 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1821 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1823 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1824 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1827 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1830 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1831 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1832 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1833 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1835 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1836 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1837 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1838 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1839 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1840 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1841 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1842 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1843 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1849 * Uniwill pin configuration:
1850 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1853 static struct hda_verb alc880_uniwill_init_verbs[] = {
1854 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1856 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1857 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1858 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1859 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1860 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1861 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1862 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1863 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1864 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1865 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1866 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1867 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1868 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1869 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1871 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1873 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1874 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1875 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1877 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1878 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1879 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1881 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1882 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1889 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1891 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1892 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1895 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1896 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1897 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1898 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1899 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1905 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1907 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1908 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1910 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1911 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1914 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1915 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1920 static struct hda_verb alc880_beep_init_verbs[] = {
1921 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1925 /* toggle speaker-output according to the hp-jack state */
1926 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1928 unsigned int present;
1931 present = snd_hda_codec_read(codec, 0x14, 0,
1932 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1933 bits = present ? HDA_AMP_MUTE : 0;
1934 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1935 HDA_AMP_MUTE, bits);
1936 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1937 HDA_AMP_MUTE, bits);
1940 /* auto-toggle front mic */
1941 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1943 unsigned int present;
1946 present = snd_hda_codec_read(codec, 0x18, 0,
1947 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1948 bits = present ? HDA_AMP_MUTE : 0;
1949 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1952 static void alc880_uniwill_automute(struct hda_codec *codec)
1954 alc880_uniwill_hp_automute(codec);
1955 alc880_uniwill_mic_automute(codec);
1958 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1961 /* Looks like the unsol event is incompatible with the standard
1962 * definition. 4bit tag is placed at 28 bit!
1964 switch (res >> 28) {
1965 case ALC880_HP_EVENT:
1966 alc880_uniwill_hp_automute(codec);
1968 case ALC880_MIC_EVENT:
1969 alc880_uniwill_mic_automute(codec);
1974 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1976 unsigned int present;
1979 present = snd_hda_codec_read(codec, 0x14, 0,
1980 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1981 bits = present ? HDA_AMP_MUTE : 0;
1982 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
1985 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1987 unsigned int present;
1989 present = snd_hda_codec_read(codec, 0x21, 0,
1990 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1991 present &= HDA_AMP_VOLMASK;
1992 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1993 HDA_AMP_VOLMASK, present);
1994 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1995 HDA_AMP_VOLMASK, present);
1998 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2001 /* Looks like the unsol event is incompatible with the standard
2002 * definition. 4bit tag is placed at 28 bit!
2004 if ((res >> 28) == ALC880_HP_EVENT)
2005 alc880_uniwill_p53_hp_automute(codec);
2006 if ((res >> 28) == ALC880_DCVOL_EVENT)
2007 alc880_uniwill_p53_dcvol_automute(codec);
2011 * F1734 pin configuration:
2012 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2014 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2015 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2016 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2017 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2018 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2019 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2021 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2022 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2023 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2024 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2026 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2027 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2028 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2029 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2030 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2031 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2033 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2034 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2036 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2037 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2043 * ASUS pin configuration:
2044 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2046 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2047 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2048 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2049 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2050 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2052 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2055 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2056 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2057 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2058 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2059 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2061 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2062 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2064 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2066 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2067 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2068 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2069 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2074 /* Enable GPIO mask and set output */
2075 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2076 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2078 /* Clevo m520g init */
2079 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2080 /* headphone output */
2081 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2086 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2087 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2089 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2090 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2091 /* Mic1 (rear panel) */
2092 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2093 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2094 /* Mic2 (front panel) */
2095 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2096 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2098 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2099 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2100 /* change to EAPD mode */
2101 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2102 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2107 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2108 /* change to EAPD mode */
2109 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2110 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2112 /* Headphone output */
2113 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2116 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2118 /* Line In pin widget for input */
2119 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2120 /* CD pin widget for input */
2121 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2122 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2123 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2125 /* change to EAPD mode */
2126 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2127 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2133 * LG m1 express dual
2136 * Rear Line-In/Out (blue): 0x14
2137 * Build-in Mic-In: 0x15
2139 * HP-Out (green): 0x1b
2140 * Mic-In/Out (red): 0x19
2144 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2145 static hda_nid_t alc880_lg_dac_nids[3] = {
2149 /* seems analog CD is not working */
2150 static struct hda_input_mux alc880_lg_capture_source = {
2155 { "Internal Mic", 0x6 },
2159 /* 2,4,6 channel modes */
2160 static struct hda_verb alc880_lg_ch2_init[] = {
2161 /* set line-in and mic-in to input */
2162 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2163 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2167 static struct hda_verb alc880_lg_ch4_init[] = {
2168 /* set line-in to out and mic-in to input */
2169 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2170 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2174 static struct hda_verb alc880_lg_ch6_init[] = {
2175 /* set line-in and mic-in to output */
2176 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2177 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2181 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2182 { 2, alc880_lg_ch2_init },
2183 { 4, alc880_lg_ch4_init },
2184 { 6, alc880_lg_ch6_init },
2187 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2188 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2189 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2190 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2191 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2192 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2193 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2194 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2195 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2199 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2200 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2201 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2203 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2204 .name = "Channel Mode",
2205 .info = alc_ch_mode_info,
2206 .get = alc_ch_mode_get,
2207 .put = alc_ch_mode_put,
2212 static struct hda_verb alc880_lg_init_verbs[] = {
2213 /* set capture source to mic-in */
2214 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2217 /* mute all amp mixer inputs */
2218 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2219 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2220 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2221 /* line-in to input */
2222 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2223 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2225 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2226 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2228 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2229 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2230 /* mic-in to input */
2231 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2232 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2233 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2235 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2239 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2243 /* toggle speaker-output according to the hp-jack state */
2244 static void alc880_lg_automute(struct hda_codec *codec)
2246 unsigned int present;
2249 present = snd_hda_codec_read(codec, 0x1b, 0,
2250 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2251 bits = present ? HDA_AMP_MUTE : 0;
2252 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2253 HDA_AMP_MUTE, bits);
2256 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2258 /* Looks like the unsol event is incompatible with the standard
2259 * definition. 4bit tag is placed at 28 bit!
2261 if ((res >> 28) == 0x01)
2262 alc880_lg_automute(codec);
2271 * Built-in Mic-In: 0x19
2277 static struct hda_input_mux alc880_lg_lw_capture_source = {
2281 { "Internal Mic", 0x1 },
2286 #define alc880_lg_lw_modes alc880_threestack_modes
2288 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2289 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2290 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2291 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2292 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2293 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2294 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2295 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2296 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2298 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2300 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2301 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2302 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2304 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2305 .name = "Channel Mode",
2306 .info = alc_ch_mode_info,
2307 .get = alc_ch_mode_get,
2308 .put = alc_ch_mode_put,
2313 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2314 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2315 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2316 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2318 /* set capture source to mic-in */
2319 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2321 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2325 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2327 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2328 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2329 /* mic-in to input */
2330 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2331 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2333 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2334 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2336 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2340 /* toggle speaker-output according to the hp-jack state */
2341 static void alc880_lg_lw_automute(struct hda_codec *codec)
2343 unsigned int present;
2346 present = snd_hda_codec_read(codec, 0x1b, 0,
2347 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2348 bits = present ? HDA_AMP_MUTE : 0;
2349 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2350 HDA_AMP_MUTE, bits);
2353 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2355 /* Looks like the unsol event is incompatible with the standard
2356 * definition. 4bit tag is placed at 28 bit!
2358 if ((res >> 28) == 0x01)
2359 alc880_lg_lw_automute(codec);
2362 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2363 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2364 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2367 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2368 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2372 static struct hda_input_mux alc880_medion_rim_capture_source = {
2376 { "Internal Mic", 0x1 },
2380 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2381 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2384 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2386 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2387 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2388 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2389 /* Mic2 (as headphone out) for HP output */
2390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2392 /* Internal Speaker */
2393 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2394 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2396 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2397 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2399 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2403 /* toggle speaker-output according to the hp-jack state */
2404 static void alc880_medion_rim_automute(struct hda_codec *codec)
2406 unsigned int present;
2409 present = snd_hda_codec_read(codec, 0x14, 0,
2410 AC_VERB_GET_PIN_SENSE, 0)
2411 & AC_PINSENSE_PRESENCE;
2412 bits = present ? HDA_AMP_MUTE : 0;
2413 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2414 HDA_AMP_MUTE, bits);
2416 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2418 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2421 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2424 /* Looks like the unsol event is incompatible with the standard
2425 * definition. 4bit tag is placed at 28 bit!
2427 if ((res >> 28) == ALC880_HP_EVENT)
2428 alc880_medion_rim_automute(codec);
2431 #ifdef CONFIG_SND_HDA_POWER_SAVE
2432 static struct hda_amp_list alc880_loopbacks[] = {
2433 { 0x0b, HDA_INPUT, 0 },
2434 { 0x0b, HDA_INPUT, 1 },
2435 { 0x0b, HDA_INPUT, 2 },
2436 { 0x0b, HDA_INPUT, 3 },
2437 { 0x0b, HDA_INPUT, 4 },
2441 static struct hda_amp_list alc880_lg_loopbacks[] = {
2442 { 0x0b, HDA_INPUT, 1 },
2443 { 0x0b, HDA_INPUT, 6 },
2444 { 0x0b, HDA_INPUT, 7 },
2453 static int alc_init(struct hda_codec *codec)
2455 struct alc_spec *spec = codec->spec;
2459 if (codec->vendor_id == 0x10ec0888)
2460 alc888_coef_init(codec);
2462 for (i = 0; i < spec->num_init_verbs; i++)
2463 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2465 if (spec->init_hook)
2466 spec->init_hook(codec);
2471 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2473 struct alc_spec *spec = codec->spec;
2475 if (spec->unsol_event)
2476 spec->unsol_event(codec, res);
2479 #ifdef CONFIG_SND_HDA_POWER_SAVE
2480 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2482 struct alc_spec *spec = codec->spec;
2483 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2488 * Analog playback callbacks
2490 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2491 struct hda_codec *codec,
2492 struct snd_pcm_substream *substream)
2494 struct alc_spec *spec = codec->spec;
2495 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2499 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2500 struct hda_codec *codec,
2501 unsigned int stream_tag,
2502 unsigned int format,
2503 struct snd_pcm_substream *substream)
2505 struct alc_spec *spec = codec->spec;
2506 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2507 stream_tag, format, substream);
2510 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2511 struct hda_codec *codec,
2512 struct snd_pcm_substream *substream)
2514 struct alc_spec *spec = codec->spec;
2515 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2521 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2522 struct hda_codec *codec,
2523 struct snd_pcm_substream *substream)
2525 struct alc_spec *spec = codec->spec;
2526 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2529 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2530 struct hda_codec *codec,
2531 unsigned int stream_tag,
2532 unsigned int format,
2533 struct snd_pcm_substream *substream)
2535 struct alc_spec *spec = codec->spec;
2536 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2537 stream_tag, format, substream);
2540 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2541 struct hda_codec *codec,
2542 struct snd_pcm_substream *substream)
2544 struct alc_spec *spec = codec->spec;
2545 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2551 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2552 struct hda_codec *codec,
2553 unsigned int stream_tag,
2554 unsigned int format,
2555 struct snd_pcm_substream *substream)
2557 struct alc_spec *spec = codec->spec;
2559 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2560 stream_tag, 0, format);
2564 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2565 struct hda_codec *codec,
2566 struct snd_pcm_substream *substream)
2568 struct alc_spec *spec = codec->spec;
2570 snd_hda_codec_cleanup_stream(codec,
2571 spec->adc_nids[substream->number + 1]);
2578 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2582 /* NID is set in alc_build_pcms */
2584 .open = alc880_playback_pcm_open,
2585 .prepare = alc880_playback_pcm_prepare,
2586 .cleanup = alc880_playback_pcm_cleanup
2590 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2594 /* NID is set in alc_build_pcms */
2597 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2601 /* NID is set in alc_build_pcms */
2604 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2605 .substreams = 2, /* can be overridden */
2608 /* NID is set in alc_build_pcms */
2610 .prepare = alc880_alt_capture_pcm_prepare,
2611 .cleanup = alc880_alt_capture_pcm_cleanup
2615 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2619 /* NID is set in alc_build_pcms */
2621 .open = alc880_dig_playback_pcm_open,
2622 .close = alc880_dig_playback_pcm_close,
2623 .prepare = alc880_dig_playback_pcm_prepare
2627 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2631 /* NID is set in alc_build_pcms */
2634 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2635 static struct hda_pcm_stream alc_pcm_null_stream = {
2641 static int alc_build_pcms(struct hda_codec *codec)
2643 struct alc_spec *spec = codec->spec;
2644 struct hda_pcm *info = spec->pcm_rec;
2647 codec->num_pcms = 1;
2648 codec->pcm_info = info;
2650 info->name = spec->stream_name_analog;
2651 if (spec->stream_analog_playback) {
2652 if (snd_BUG_ON(!spec->multiout.dac_nids))
2654 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2655 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2657 if (spec->stream_analog_capture) {
2658 if (snd_BUG_ON(!spec->adc_nids))
2660 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2661 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2664 if (spec->channel_mode) {
2665 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2666 for (i = 0; i < spec->num_channel_mode; i++) {
2667 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2668 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2673 /* SPDIF for stream index #1 */
2674 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2675 codec->num_pcms = 2;
2676 info = spec->pcm_rec + 1;
2677 info->name = spec->stream_name_digital;
2678 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2679 if (spec->multiout.dig_out_nid &&
2680 spec->stream_digital_playback) {
2681 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2682 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2684 if (spec->dig_in_nid &&
2685 spec->stream_digital_capture) {
2686 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2687 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2689 /* FIXME: do we need this for all Realtek codec models? */
2690 codec->spdif_status_reset = 1;
2693 /* If the use of more than one ADC is requested for the current
2694 * model, configure a second analog capture-only PCM.
2696 /* Additional Analaog capture for index #2 */
2697 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2698 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2699 codec->num_pcms = 3;
2700 info = spec->pcm_rec + 2;
2701 info->name = spec->stream_name_analog;
2702 if (spec->alt_dac_nid) {
2703 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2704 *spec->stream_analog_alt_playback;
2705 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2708 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2709 alc_pcm_null_stream;
2710 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2712 if (spec->num_adc_nids > 1) {
2713 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2714 *spec->stream_analog_alt_capture;
2715 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2717 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2718 spec->num_adc_nids - 1;
2720 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2721 alc_pcm_null_stream;
2722 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2729 static void alc_free(struct hda_codec *codec)
2731 struct alc_spec *spec = codec->spec;
2737 if (spec->kctl_alloc) {
2738 for (i = 0; i < spec->num_kctl_used; i++)
2739 kfree(spec->kctl_alloc[i].name);
2740 kfree(spec->kctl_alloc);
2743 codec->spec = NULL; /* to be sure */
2748 static struct hda_codec_ops alc_patch_ops = {
2749 .build_controls = alc_build_controls,
2750 .build_pcms = alc_build_pcms,
2753 .unsol_event = alc_unsol_event,
2754 #ifdef CONFIG_SND_HDA_POWER_SAVE
2755 .check_power_status = alc_check_power_status,
2761 * Test configuration for debugging
2763 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2766 #ifdef CONFIG_SND_DEBUG
2767 static hda_nid_t alc880_test_dac_nids[4] = {
2768 0x02, 0x03, 0x04, 0x05
2771 static struct hda_input_mux alc880_test_capture_source = {
2780 { "Surround", 0x6 },
2784 static struct hda_channel_mode alc880_test_modes[4] = {
2791 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2792 struct snd_ctl_elem_info *uinfo)
2794 static char *texts[] = {
2795 "N/A", "Line Out", "HP Out",
2796 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2798 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2800 uinfo->value.enumerated.items = 8;
2801 if (uinfo->value.enumerated.item >= 8)
2802 uinfo->value.enumerated.item = 7;
2803 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2807 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2808 struct snd_ctl_elem_value *ucontrol)
2810 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2811 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2812 unsigned int pin_ctl, item = 0;
2814 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2815 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2816 if (pin_ctl & AC_PINCTL_OUT_EN) {
2817 if (pin_ctl & AC_PINCTL_HP_EN)
2821 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2822 switch (pin_ctl & AC_PINCTL_VREFEN) {
2823 case AC_PINCTL_VREF_HIZ: item = 3; break;
2824 case AC_PINCTL_VREF_50: item = 4; break;
2825 case AC_PINCTL_VREF_GRD: item = 5; break;
2826 case AC_PINCTL_VREF_80: item = 6; break;
2827 case AC_PINCTL_VREF_100: item = 7; break;
2830 ucontrol->value.enumerated.item[0] = item;
2834 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2835 struct snd_ctl_elem_value *ucontrol)
2837 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2838 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2839 static unsigned int ctls[] = {
2840 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2841 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2842 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2843 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2844 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2845 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2847 unsigned int old_ctl, new_ctl;
2849 old_ctl = snd_hda_codec_read(codec, nid, 0,
2850 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2851 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2852 if (old_ctl != new_ctl) {
2854 snd_hda_codec_write_cache(codec, nid, 0,
2855 AC_VERB_SET_PIN_WIDGET_CONTROL,
2857 val = ucontrol->value.enumerated.item[0] >= 3 ?
2859 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2866 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2867 struct snd_ctl_elem_info *uinfo)
2869 static char *texts[] = {
2870 "Front", "Surround", "CLFE", "Side"
2872 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2874 uinfo->value.enumerated.items = 4;
2875 if (uinfo->value.enumerated.item >= 4)
2876 uinfo->value.enumerated.item = 3;
2877 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2881 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2882 struct snd_ctl_elem_value *ucontrol)
2884 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2885 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2888 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2889 ucontrol->value.enumerated.item[0] = sel & 3;
2893 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2894 struct snd_ctl_elem_value *ucontrol)
2896 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2897 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2900 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2901 if (ucontrol->value.enumerated.item[0] != sel) {
2902 sel = ucontrol->value.enumerated.item[0] & 3;
2903 snd_hda_codec_write_cache(codec, nid, 0,
2904 AC_VERB_SET_CONNECT_SEL, sel);
2910 #define PIN_CTL_TEST(xname,nid) { \
2911 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2913 .info = alc_test_pin_ctl_info, \
2914 .get = alc_test_pin_ctl_get, \
2915 .put = alc_test_pin_ctl_put, \
2916 .private_value = nid \
2919 #define PIN_SRC_TEST(xname,nid) { \
2920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2922 .info = alc_test_pin_src_info, \
2923 .get = alc_test_pin_src_get, \
2924 .put = alc_test_pin_src_put, \
2925 .private_value = nid \
2928 static struct snd_kcontrol_new alc880_test_mixer[] = {
2929 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2930 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2931 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2932 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2933 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2934 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2935 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2936 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2937 PIN_CTL_TEST("Front Pin Mode", 0x14),
2938 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2939 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2940 PIN_CTL_TEST("Side Pin Mode", 0x17),
2941 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2942 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2943 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2944 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2945 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2946 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2947 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2948 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2949 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2950 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2951 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2952 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2953 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2954 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2955 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2956 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2957 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2958 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2961 .name = "Channel Mode",
2962 .info = alc_ch_mode_info,
2963 .get = alc_ch_mode_get,
2964 .put = alc_ch_mode_put,
2969 static struct hda_verb alc880_test_init_verbs[] = {
2970 /* Unmute inputs of 0x0c - 0x0f */
2971 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2973 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2974 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2975 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2976 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2977 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2978 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2979 /* Vol output for 0x0c-0x0f */
2980 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2981 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2982 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2983 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2984 /* Set output pins 0x14-0x17 */
2985 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2987 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2988 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2989 /* Unmute output pins 0x14-0x17 */
2990 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2992 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2993 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2994 /* Set input pins 0x18-0x1c */
2995 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2996 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2997 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3000 /* Mute input pins 0x18-0x1b */
3001 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3002 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3004 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3007 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3009 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3010 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3011 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3012 /* Analog input/passthru */
3013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3017 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3025 static const char *alc880_models[ALC880_MODEL_LAST] = {
3026 [ALC880_3ST] = "3stack",
3027 [ALC880_TCL_S700] = "tcl",
3028 [ALC880_3ST_DIG] = "3stack-digout",
3029 [ALC880_CLEVO] = "clevo",
3030 [ALC880_5ST] = "5stack",
3031 [ALC880_5ST_DIG] = "5stack-digout",
3032 [ALC880_W810] = "w810",
3033 [ALC880_Z71V] = "z71v",
3034 [ALC880_6ST] = "6stack",
3035 [ALC880_6ST_DIG] = "6stack-digout",
3036 [ALC880_ASUS] = "asus",
3037 [ALC880_ASUS_W1V] = "asus-w1v",
3038 [ALC880_ASUS_DIG] = "asus-dig",
3039 [ALC880_ASUS_DIG2] = "asus-dig2",
3040 [ALC880_UNIWILL_DIG] = "uniwill",
3041 [ALC880_UNIWILL_P53] = "uniwill-p53",
3042 [ALC880_FUJITSU] = "fujitsu",
3043 [ALC880_F1734] = "F1734",
3045 [ALC880_LG_LW] = "lg-lw",
3046 [ALC880_MEDION_RIM] = "medion",
3047 #ifdef CONFIG_SND_DEBUG
3048 [ALC880_TEST] = "test",
3050 [ALC880_AUTO] = "auto",
3053 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3054 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3055 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3056 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3057 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3058 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3059 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3060 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3061 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3062 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3063 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3064 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3065 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3066 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3067 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3068 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3069 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3070 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3071 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3072 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3073 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3074 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3075 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3076 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3077 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3078 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3079 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3080 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3081 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3082 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3083 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3084 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3085 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3086 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3087 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3088 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3089 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3090 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3091 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3092 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3093 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3094 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3095 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3096 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3097 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3098 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3099 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3100 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3101 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3102 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3103 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3104 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3105 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3106 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3107 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3108 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3109 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3110 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3111 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3112 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3113 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3114 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3115 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3116 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3117 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3118 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3119 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3120 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3121 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3122 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3123 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3124 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3129 * ALC880 codec presets
3131 static struct alc_config_preset alc880_presets[] = {
3133 .mixers = { alc880_three_stack_mixer },
3134 .init_verbs = { alc880_volume_init_verbs,
3135 alc880_pin_3stack_init_verbs },
3136 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3137 .dac_nids = alc880_dac_nids,
3138 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3139 .channel_mode = alc880_threestack_modes,
3141 .input_mux = &alc880_capture_source,
3143 [ALC880_3ST_DIG] = {
3144 .mixers = { alc880_three_stack_mixer },
3145 .init_verbs = { alc880_volume_init_verbs,
3146 alc880_pin_3stack_init_verbs },
3147 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3148 .dac_nids = alc880_dac_nids,
3149 .dig_out_nid = ALC880_DIGOUT_NID,
3150 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3151 .channel_mode = alc880_threestack_modes,
3153 .input_mux = &alc880_capture_source,
3155 [ALC880_TCL_S700] = {
3156 .mixers = { alc880_tcl_s700_mixer },
3157 .init_verbs = { alc880_volume_init_verbs,
3158 alc880_pin_tcl_S700_init_verbs,
3159 alc880_gpio2_init_verbs },
3160 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3161 .dac_nids = alc880_dac_nids,
3163 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3164 .channel_mode = alc880_2_jack_modes,
3165 .input_mux = &alc880_capture_source,
3168 .mixers = { alc880_three_stack_mixer,
3169 alc880_five_stack_mixer},
3170 .init_verbs = { alc880_volume_init_verbs,
3171 alc880_pin_5stack_init_verbs },
3172 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3173 .dac_nids = alc880_dac_nids,
3174 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3175 .channel_mode = alc880_fivestack_modes,
3176 .input_mux = &alc880_capture_source,
3178 [ALC880_5ST_DIG] = {
3179 .mixers = { alc880_three_stack_mixer,
3180 alc880_five_stack_mixer },
3181 .init_verbs = { alc880_volume_init_verbs,
3182 alc880_pin_5stack_init_verbs },
3183 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3184 .dac_nids = alc880_dac_nids,
3185 .dig_out_nid = ALC880_DIGOUT_NID,
3186 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3187 .channel_mode = alc880_fivestack_modes,
3188 .input_mux = &alc880_capture_source,
3191 .mixers = { alc880_six_stack_mixer },
3192 .init_verbs = { alc880_volume_init_verbs,
3193 alc880_pin_6stack_init_verbs },
3194 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3195 .dac_nids = alc880_6st_dac_nids,
3196 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3197 .channel_mode = alc880_sixstack_modes,
3198 .input_mux = &alc880_6stack_capture_source,
3200 [ALC880_6ST_DIG] = {
3201 .mixers = { alc880_six_stack_mixer },
3202 .init_verbs = { alc880_volume_init_verbs,
3203 alc880_pin_6stack_init_verbs },
3204 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3205 .dac_nids = alc880_6st_dac_nids,
3206 .dig_out_nid = ALC880_DIGOUT_NID,
3207 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3208 .channel_mode = alc880_sixstack_modes,
3209 .input_mux = &alc880_6stack_capture_source,
3212 .mixers = { alc880_w810_base_mixer },
3213 .init_verbs = { alc880_volume_init_verbs,
3214 alc880_pin_w810_init_verbs,
3215 alc880_gpio2_init_verbs },
3216 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3217 .dac_nids = alc880_w810_dac_nids,
3218 .dig_out_nid = ALC880_DIGOUT_NID,
3219 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3220 .channel_mode = alc880_w810_modes,
3221 .input_mux = &alc880_capture_source,
3224 .mixers = { alc880_z71v_mixer },
3225 .init_verbs = { alc880_volume_init_verbs,
3226 alc880_pin_z71v_init_verbs },
3227 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3228 .dac_nids = alc880_z71v_dac_nids,
3229 .dig_out_nid = ALC880_DIGOUT_NID,
3231 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3232 .channel_mode = alc880_2_jack_modes,
3233 .input_mux = &alc880_capture_source,
3236 .mixers = { alc880_f1734_mixer },
3237 .init_verbs = { alc880_volume_init_verbs,
3238 alc880_pin_f1734_init_verbs },
3239 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3240 .dac_nids = alc880_f1734_dac_nids,
3242 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3243 .channel_mode = alc880_2_jack_modes,
3244 .input_mux = &alc880_f1734_capture_source,
3245 .unsol_event = alc880_uniwill_p53_unsol_event,
3246 .init_hook = alc880_uniwill_p53_hp_automute,
3249 .mixers = { alc880_asus_mixer },
3250 .init_verbs = { alc880_volume_init_verbs,
3251 alc880_pin_asus_init_verbs,
3252 alc880_gpio1_init_verbs },
3253 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3254 .dac_nids = alc880_asus_dac_nids,
3255 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3256 .channel_mode = alc880_asus_modes,
3258 .input_mux = &alc880_capture_source,
3260 [ALC880_ASUS_DIG] = {
3261 .mixers = { alc880_asus_mixer },
3262 .init_verbs = { alc880_volume_init_verbs,
3263 alc880_pin_asus_init_verbs,
3264 alc880_gpio1_init_verbs },
3265 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3266 .dac_nids = alc880_asus_dac_nids,
3267 .dig_out_nid = ALC880_DIGOUT_NID,
3268 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3269 .channel_mode = alc880_asus_modes,
3271 .input_mux = &alc880_capture_source,
3273 [ALC880_ASUS_DIG2] = {
3274 .mixers = { alc880_asus_mixer },
3275 .init_verbs = { alc880_volume_init_verbs,
3276 alc880_pin_asus_init_verbs,
3277 alc880_gpio2_init_verbs }, /* use GPIO2 */
3278 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3279 .dac_nids = alc880_asus_dac_nids,
3280 .dig_out_nid = ALC880_DIGOUT_NID,
3281 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3282 .channel_mode = alc880_asus_modes,
3284 .input_mux = &alc880_capture_source,
3286 [ALC880_ASUS_W1V] = {
3287 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3288 .init_verbs = { alc880_volume_init_verbs,
3289 alc880_pin_asus_init_verbs,
3290 alc880_gpio1_init_verbs },
3291 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3292 .dac_nids = alc880_asus_dac_nids,
3293 .dig_out_nid = ALC880_DIGOUT_NID,
3294 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3295 .channel_mode = alc880_asus_modes,
3297 .input_mux = &alc880_capture_source,
3299 [ALC880_UNIWILL_DIG] = {
3300 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3301 .init_verbs = { alc880_volume_init_verbs,
3302 alc880_pin_asus_init_verbs },
3303 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3304 .dac_nids = alc880_asus_dac_nids,
3305 .dig_out_nid = ALC880_DIGOUT_NID,
3306 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3307 .channel_mode = alc880_asus_modes,
3309 .input_mux = &alc880_capture_source,
3311 [ALC880_UNIWILL] = {
3312 .mixers = { alc880_uniwill_mixer },
3313 .init_verbs = { alc880_volume_init_verbs,
3314 alc880_uniwill_init_verbs },
3315 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3316 .dac_nids = alc880_asus_dac_nids,
3317 .dig_out_nid = ALC880_DIGOUT_NID,
3318 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3319 .channel_mode = alc880_threestack_modes,
3321 .input_mux = &alc880_capture_source,
3322 .unsol_event = alc880_uniwill_unsol_event,
3323 .init_hook = alc880_uniwill_automute,
3325 [ALC880_UNIWILL_P53] = {
3326 .mixers = { alc880_uniwill_p53_mixer },
3327 .init_verbs = { alc880_volume_init_verbs,
3328 alc880_uniwill_p53_init_verbs },
3329 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3330 .dac_nids = alc880_asus_dac_nids,
3331 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3332 .channel_mode = alc880_threestack_modes,
3333 .input_mux = &alc880_capture_source,
3334 .unsol_event = alc880_uniwill_p53_unsol_event,
3335 .init_hook = alc880_uniwill_p53_hp_automute,
3337 [ALC880_FUJITSU] = {
3338 .mixers = { alc880_fujitsu_mixer,
3339 alc880_pcbeep_mixer, },
3340 .init_verbs = { alc880_volume_init_verbs,
3341 alc880_uniwill_p53_init_verbs,
3342 alc880_beep_init_verbs },
3343 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3344 .dac_nids = alc880_dac_nids,
3345 .dig_out_nid = ALC880_DIGOUT_NID,
3346 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3347 .channel_mode = alc880_2_jack_modes,
3348 .input_mux = &alc880_capture_source,
3349 .unsol_event = alc880_uniwill_p53_unsol_event,
3350 .init_hook = alc880_uniwill_p53_hp_automute,
3353 .mixers = { alc880_three_stack_mixer },
3354 .init_verbs = { alc880_volume_init_verbs,
3355 alc880_pin_clevo_init_verbs },
3356 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3357 .dac_nids = alc880_dac_nids,
3359 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3360 .channel_mode = alc880_threestack_modes,
3362 .input_mux = &alc880_capture_source,
3365 .mixers = { alc880_lg_mixer },
3366 .init_verbs = { alc880_volume_init_verbs,
3367 alc880_lg_init_verbs },
3368 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3369 .dac_nids = alc880_lg_dac_nids,
3370 .dig_out_nid = ALC880_DIGOUT_NID,
3371 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3372 .channel_mode = alc880_lg_ch_modes,
3374 .input_mux = &alc880_lg_capture_source,
3375 .unsol_event = alc880_lg_unsol_event,
3376 .init_hook = alc880_lg_automute,
3377 #ifdef CONFIG_SND_HDA_POWER_SAVE
3378 .loopbacks = alc880_lg_loopbacks,
3382 .mixers = { alc880_lg_lw_mixer },
3383 .init_verbs = { alc880_volume_init_verbs,
3384 alc880_lg_lw_init_verbs },
3385 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3386 .dac_nids = alc880_dac_nids,
3387 .dig_out_nid = ALC880_DIGOUT_NID,
3388 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3389 .channel_mode = alc880_lg_lw_modes,
3390 .input_mux = &alc880_lg_lw_capture_source,
3391 .unsol_event = alc880_lg_lw_unsol_event,
3392 .init_hook = alc880_lg_lw_automute,
3394 [ALC880_MEDION_RIM] = {
3395 .mixers = { alc880_medion_rim_mixer },
3396 .init_verbs = { alc880_volume_init_verbs,
3397 alc880_medion_rim_init_verbs,
3398 alc_gpio2_init_verbs },
3399 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3400 .dac_nids = alc880_dac_nids,
3401 .dig_out_nid = ALC880_DIGOUT_NID,
3402 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3403 .channel_mode = alc880_2_jack_modes,
3404 .input_mux = &alc880_medion_rim_capture_source,
3405 .unsol_event = alc880_medion_rim_unsol_event,
3406 .init_hook = alc880_medion_rim_automute,
3408 #ifdef CONFIG_SND_DEBUG
3410 .mixers = { alc880_test_mixer },
3411 .init_verbs = { alc880_test_init_verbs },
3412 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3413 .dac_nids = alc880_test_dac_nids,
3414 .dig_out_nid = ALC880_DIGOUT_NID,
3415 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3416 .channel_mode = alc880_test_modes,
3417 .input_mux = &alc880_test_capture_source,
3423 * Automatic parse of I/O pins from the BIOS configuration
3426 #define NUM_CONTROL_ALLOC 32
3427 #define NUM_VERB_ALLOC 32
3431 ALC_CTL_WIDGET_MUTE,
3434 static struct snd_kcontrol_new alc880_control_templates[] = {
3435 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3436 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3437 HDA_BIND_MUTE(NULL, 0, 0, 0),
3440 /* add dynamic controls */
3441 static int add_control(struct alc_spec *spec, int type, const char *name,
3444 struct snd_kcontrol_new *knew;
3446 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3447 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3449 /* array + terminator */
3450 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3453 if (spec->kctl_alloc) {
3454 memcpy(knew, spec->kctl_alloc,
3455 sizeof(*knew) * spec->num_kctl_alloc);
3456 kfree(spec->kctl_alloc);
3458 spec->kctl_alloc = knew;
3459 spec->num_kctl_alloc = num;
3462 knew = &spec->kctl_alloc[spec->num_kctl_used];
3463 *knew = alc880_control_templates[type];
3464 knew->name = kstrdup(name, GFP_KERNEL);
3467 knew->private_value = val;
3468 spec->num_kctl_used++;
3472 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3473 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3474 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3475 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3476 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3477 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3478 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3479 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3480 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3481 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3482 #define ALC880_PIN_CD_NID 0x1c
3484 /* fill in the dac_nids table from the parsed pin configuration */
3485 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3486 const struct auto_pin_cfg *cfg)
3492 memset(assigned, 0, sizeof(assigned));
3493 spec->multiout.dac_nids = spec->private_dac_nids;
3495 /* check the pins hardwired to audio widget */
3496 for (i = 0; i < cfg->line_outs; i++) {
3497 nid = cfg->line_out_pins[i];
3498 if (alc880_is_fixed_pin(nid)) {
3499 int idx = alc880_fixed_pin_idx(nid);
3500 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3504 /* left pins can be connect to any audio widget */
3505 for (i = 0; i < cfg->line_outs; i++) {
3506 nid = cfg->line_out_pins[i];
3507 if (alc880_is_fixed_pin(nid))
3509 /* search for an empty channel */
3510 for (j = 0; j < cfg->line_outs; j++) {
3512 spec->multiout.dac_nids[i] =
3513 alc880_idx_to_dac(j);
3519 spec->multiout.num_dacs = cfg->line_outs;
3523 /* add playback controls from the parsed DAC table */
3524 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3525 const struct auto_pin_cfg *cfg)
3528 static const char *chname[4] = {
3529 "Front", "Surround", NULL /*CLFE*/, "Side"
3534 for (i = 0; i < cfg->line_outs; i++) {
3535 if (!spec->multiout.dac_nids[i])
3537 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3540 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3541 "Center Playback Volume",
3542 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3546 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3547 "LFE Playback Volume",
3548 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3552 err = add_control(spec, ALC_CTL_BIND_MUTE,
3553 "Center Playback Switch",
3554 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3558 err = add_control(spec, ALC_CTL_BIND_MUTE,
3559 "LFE Playback Switch",
3560 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3565 sprintf(name, "%s Playback Volume", chname[i]);
3566 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3567 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3571 sprintf(name, "%s Playback Switch", chname[i]);
3572 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3573 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3582 /* add playback controls for speaker and HP outputs */
3583 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3593 if (alc880_is_fixed_pin(pin)) {
3594 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3595 /* specify the DAC as the extra output */
3596 if (!spec->multiout.hp_nid)
3597 spec->multiout.hp_nid = nid;
3599 spec->multiout.extra_out_nid[0] = nid;
3600 /* control HP volume/switch on the output mixer amp */
3601 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3602 sprintf(name, "%s Playback Volume", pfx);
3603 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3604 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3607 sprintf(name, "%s Playback Switch", pfx);
3608 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3609 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3612 } else if (alc880_is_multi_pin(pin)) {
3613 /* set manual connection */
3614 /* we have only a switch on HP-out PIN */
3615 sprintf(name, "%s Playback Switch", pfx);
3616 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3617 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3624 /* create input playback/capture controls for the given pin */
3625 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3626 const char *ctlname,
3627 int idx, hda_nid_t mix_nid)
3632 sprintf(name, "%s Playback Volume", ctlname);
3633 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3634 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3637 sprintf(name, "%s Playback Switch", ctlname);
3638 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3639 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3645 /* create playback/capture controls for input pins */
3646 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3647 const struct auto_pin_cfg *cfg)
3649 struct hda_input_mux *imux = &spec->private_imux;
3652 for (i = 0; i < AUTO_PIN_LAST; i++) {
3653 if (alc880_is_input_pin(cfg->input_pins[i])) {
3654 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3655 err = new_analog_input(spec, cfg->input_pins[i],
3656 auto_pin_cfg_labels[i],
3660 imux->items[imux->num_items].label =
3661 auto_pin_cfg_labels[i];
3662 imux->items[imux->num_items].index =
3663 alc880_input_pin_idx(cfg->input_pins[i]);
3670 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3671 unsigned int pin_type)
3673 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3676 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3680 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3681 hda_nid_t nid, int pin_type,
3684 alc_set_pin_output(codec, nid, pin_type);
3685 /* need the manual connection? */
3686 if (alc880_is_multi_pin(nid)) {
3687 struct alc_spec *spec = codec->spec;
3688 int idx = alc880_multi_pin_idx(nid);
3689 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3690 AC_VERB_SET_CONNECT_SEL,
3691 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3695 static int get_pin_type(int line_out_type)
3697 if (line_out_type == AUTO_PIN_HP_OUT)
3703 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3705 struct alc_spec *spec = codec->spec;
3708 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3709 for (i = 0; i < spec->autocfg.line_outs; i++) {
3710 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3711 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3712 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3716 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3718 struct alc_spec *spec = codec->spec;
3721 pin = spec->autocfg.speaker_pins[0];
3722 if (pin) /* connect to front */
3723 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3724 pin = spec->autocfg.hp_pins[0];
3725 if (pin) /* connect to front */
3726 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3729 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3731 struct alc_spec *spec = codec->spec;
3734 for (i = 0; i < AUTO_PIN_LAST; i++) {
3735 hda_nid_t nid = spec->autocfg.input_pins[i];
3736 if (alc880_is_input_pin(nid)) {
3737 snd_hda_codec_write(codec, nid, 0,
3738 AC_VERB_SET_PIN_WIDGET_CONTROL,
3739 i <= AUTO_PIN_FRONT_MIC ?
3740 PIN_VREF80 : PIN_IN);
3741 if (nid != ALC880_PIN_CD_NID)
3742 snd_hda_codec_write(codec, nid, 0,
3743 AC_VERB_SET_AMP_GAIN_MUTE,
3749 /* parse the BIOS configuration and set up the alc_spec */
3750 /* return 1 if successful, 0 if the proper config is not found,
3751 * or a negative error code
3753 static int alc880_parse_auto_config(struct hda_codec *codec)
3755 struct alc_spec *spec = codec->spec;
3757 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3759 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3763 if (!spec->autocfg.line_outs)
3764 return 0; /* can't find valid BIOS pin config */
3766 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3769 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3772 err = alc880_auto_create_extra_out(spec,
3773 spec->autocfg.speaker_pins[0],
3777 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3781 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3785 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3787 if (spec->autocfg.dig_out_pin)
3788 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3789 if (spec->autocfg.dig_in_pin)
3790 spec->dig_in_nid = ALC880_DIGIN_NID;
3792 if (spec->kctl_alloc)
3793 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3795 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3797 spec->num_mux_defs = 1;
3798 spec->input_mux = &spec->private_imux;
3803 /* additional initialization for auto-configuration model */
3804 static void alc880_auto_init(struct hda_codec *codec)
3806 struct alc_spec *spec = codec->spec;
3807 alc880_auto_init_multi_out(codec);
3808 alc880_auto_init_extra_out(codec);
3809 alc880_auto_init_analog_input(codec);
3810 if (spec->unsol_event)
3811 alc_sku_automute(codec);
3815 * OK, here we have finally the patch for ALC880
3818 static int patch_alc880(struct hda_codec *codec)
3820 struct alc_spec *spec;
3824 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3830 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3833 if (board_config < 0) {
3834 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3835 "trying auto-probe from BIOS...\n");
3836 board_config = ALC880_AUTO;
3839 if (board_config == ALC880_AUTO) {
3840 /* automatic parse from the BIOS config */
3841 err = alc880_parse_auto_config(codec);
3847 "hda_codec: Cannot set up configuration "
3848 "from BIOS. Using 3-stack mode...\n");
3849 board_config = ALC880_3ST;
3853 if (board_config != ALC880_AUTO)
3854 setup_preset(spec, &alc880_presets[board_config]);
3856 spec->stream_name_analog = "ALC880 Analog";
3857 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3858 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3859 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3861 spec->stream_name_digital = "ALC880 Digital";
3862 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3863 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3865 if (!spec->adc_nids && spec->input_mux) {
3866 /* check whether NID 0x07 is valid */
3867 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3869 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3870 if (wcap != AC_WID_AUD_IN) {
3871 spec->adc_nids = alc880_adc_nids_alt;
3872 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3873 spec->mixers[spec->num_mixers] =
3874 alc880_capture_alt_mixer;
3877 spec->adc_nids = alc880_adc_nids;
3878 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3879 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3884 spec->vmaster_nid = 0x0c;
3886 codec->patch_ops = alc_patch_ops;
3887 if (board_config == ALC880_AUTO)
3888 spec->init_hook = alc880_auto_init;
3889 #ifdef CONFIG_SND_HDA_POWER_SAVE
3890 if (!spec->loopback.amplist)
3891 spec->loopback.amplist = alc880_loopbacks;
3902 static hda_nid_t alc260_dac_nids[1] = {
3907 static hda_nid_t alc260_adc_nids[1] = {
3912 static hda_nid_t alc260_adc_nids_alt[1] = {
3917 static hda_nid_t alc260_hp_adc_nids[2] = {
3922 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3923 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3925 static hda_nid_t alc260_dual_adc_nids[2] = {
3930 #define ALC260_DIGOUT_NID 0x03
3931 #define ALC260_DIGIN_NID 0x06
3933 static struct hda_input_mux alc260_capture_source = {
3937 { "Front Mic", 0x1 },
3943 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3944 * headphone jack and the internal CD lines since these are the only pins at
3945 * which audio can appear. For flexibility, also allow the option of
3946 * recording the mixer output on the second ADC (ADC0 doesn't have a
3947 * connection to the mixer output).
3949 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3953 { "Mic/Line", 0x0 },
3955 { "Headphone", 0x2 },
3961 { "Mic/Line", 0x0 },
3963 { "Headphone", 0x2 },
3970 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3971 * the Fujitsu S702x, but jacks are marked differently.
3973 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3980 { "Headphone", 0x5 },
3989 { "Headphone", 0x6 },
3995 * This is just place-holder, so there's something for alc_build_pcms to look
3996 * at when it calculates the maximum number of channels. ALC260 has no mixer
3997 * element which allows changing the channel mode, so the verb list is
4000 static struct hda_channel_mode alc260_modes[1] = {
4005 /* Mixer combinations
4007 * basic: base_output + input + pc_beep + capture
4008 * HP: base_output + input + capture_alt
4009 * HP_3013: hp_3013 + input + capture
4010 * fujitsu: fujitsu + capture
4011 * acer: acer + capture
4014 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4015 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4016 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4017 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4018 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4019 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4020 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4024 static struct snd_kcontrol_new alc260_input_mixer[] = {
4025 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4026 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4027 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4028 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4029 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4030 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4031 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4032 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4036 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4037 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4038 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4042 /* update HP, line and mono out pins according to the master switch */
4043 static void alc260_hp_master_update(struct hda_codec *codec,
4044 hda_nid_t hp, hda_nid_t line,
4047 struct alc_spec *spec = codec->spec;
4048 unsigned int val = spec->master_sw ? PIN_HP : 0;
4049 /* change HP and line-out pins */
4050 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4052 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4054 /* mono (speaker) depending on the HP jack sense */
4055 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4056 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4060 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4061 struct snd_ctl_elem_value *ucontrol)
4063 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4064 struct alc_spec *spec = codec->spec;
4065 *ucontrol->value.integer.value = spec->master_sw;
4069 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4070 struct snd_ctl_elem_value *ucontrol)
4072 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4073 struct alc_spec *spec = codec->spec;
4074 int val = !!*ucontrol->value.integer.value;
4075 hda_nid_t hp, line, mono;
4077 if (val == spec->master_sw)
4079 spec->master_sw = val;
4080 hp = (kcontrol->private_value >> 16) & 0xff;
4081 line = (kcontrol->private_value >> 8) & 0xff;
4082 mono = kcontrol->private_value & 0xff;
4083 alc260_hp_master_update(codec, hp, line, mono);
4087 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4089 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4090 .name = "Master Playback Switch",
4091 .info = snd_ctl_boolean_mono_info,
4092 .get = alc260_hp_master_sw_get,
4093 .put = alc260_hp_master_sw_put,
4094 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4096 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4097 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4099 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4100 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4102 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4106 static struct hda_verb alc260_hp_unsol_verbs[] = {
4107 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4111 static void alc260_hp_automute(struct hda_codec *codec)
4113 struct alc_spec *spec = codec->spec;
4114 unsigned int present;
4116 present = snd_hda_codec_read(codec, 0x10, 0,
4117 AC_VERB_GET_PIN_SENSE, 0);
4118 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4119 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4122 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4124 if ((res >> 26) == ALC880_HP_EVENT)
4125 alc260_hp_automute(codec);
4128 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4130 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4131 .name = "Master Playback Switch",
4132 .info = snd_ctl_boolean_mono_info,
4133 .get = alc260_hp_master_sw_get,
4134 .put = alc260_hp_master_sw_put,
4135 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4137 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4138 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4139 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4140 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4141 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4142 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4143 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4144 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4148 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4149 .ops = &snd_hda_bind_vol,
4151 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4152 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4153 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4158 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4159 .ops = &snd_hda_bind_sw,
4161 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4162 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4167 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4168 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4169 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4170 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4175 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4176 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4180 static void alc260_hp_3013_automute(struct hda_codec *codec)
4182 struct alc_spec *spec = codec->spec;
4183 unsigned int present;
4185 present = snd_hda_codec_read(codec, 0x15, 0,
4186 AC_VERB_GET_PIN_SENSE, 0);
4187 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4188 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4191 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4194 if ((res >> 26) == ALC880_HP_EVENT)
4195 alc260_hp_3013_automute(codec);
4198 static void alc260_hp_3012_automute(struct hda_codec *codec)
4200 unsigned int present, bits;
4202 present = snd_hda_codec_read(codec, 0x10, 0,
4203 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4205 bits = present ? 0 : PIN_OUT;
4206 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4208 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4210 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4214 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4217 if ((res >> 26) == ALC880_HP_EVENT)
4218 alc260_hp_3012_automute(codec);
4221 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4222 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4224 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4225 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4226 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4227 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4228 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4229 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4230 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4231 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4232 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4233 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4234 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4235 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4236 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4240 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4241 * versions of the ALC260 don't act on requests to enable mic bias from NID
4242 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4243 * datasheet doesn't mention this restriction. At this stage it's not clear
4244 * whether this behaviour is intentional or is a hardware bug in chip
4245 * revisions available in early 2006. Therefore for now allow the
4246 * "Headphone Jack Mode" control to span all choices, but if it turns out
4247 * that the lack of mic bias for this NID is intentional we could change the
4248 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4250 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4251 * don't appear to make the mic bias available from the "line" jack, even
4252 * though the NID used for this jack (0x14) can supply it. The theory is
4253 * that perhaps Acer have included blocking capacitors between the ALC260
4254 * and the output jack. If this turns out to be the case for all such
4255 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4256 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4258 * The C20x Tablet series have a mono internal speaker which is controlled
4259 * via the chip's Mono sum widget and pin complex, so include the necessary
4260 * controls for such models. On models without a "mono speaker" the control
4261 * won't do anything.
4263 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4264 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4265 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4266 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4267 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4269 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4271 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4272 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4273 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4274 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4275 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4276 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4277 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4278 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4279 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4280 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4284 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4285 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4287 static struct snd_kcontrol_new alc260_will_mixer[] = {
4288 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4289 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4291 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4292 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4293 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4294 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4295 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4296 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4297 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4298 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4299 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4303 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4304 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4306 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4307 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4308 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4309 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4310 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4311 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4312 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4313 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4314 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4315 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4316 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4320 /* capture mixer elements */
4321 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4322 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4323 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4324 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4325 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4327 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4328 /* The multiple "Capture Source" controls confuse alsamixer
4329 * So call somewhat different..
4331 /* .name = "Capture Source", */
4332 .name = "Input Source",
4334 .info = alc_mux_enum_info,
4335 .get = alc_mux_enum_get,
4336 .put = alc_mux_enum_put,
4341 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4342 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4343 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4345 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4346 /* The multiple "Capture Source" controls confuse alsamixer
4347 * So call somewhat different..
4349 /* .name = "Capture Source", */
4350 .name = "Input Source",
4352 .info = alc_mux_enum_info,
4353 .get = alc_mux_enum_get,
4354 .put = alc_mux_enum_put,
4360 * initialization verbs
4362 static struct hda_verb alc260_init_verbs[] = {
4363 /* Line In pin widget for input */
4364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4365 /* CD pin widget for input */
4366 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4367 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4368 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4369 /* Mic2 (front panel) pin widget for input and vref at 80% */
4370 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4371 /* LINE-2 is used for line-out in rear */
4372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4373 /* select line-out */
4374 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4376 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4378 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4380 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4381 /* mute capture amp left and right */
4382 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4383 /* set connection select to line in (default select for this ADC) */
4384 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4385 /* mute capture amp left and right */
4386 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4387 /* set connection select to line in (default select for this ADC) */
4388 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4389 /* set vol=0 Line-Out mixer amp left and right */
4390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4391 /* unmute pin widget amp left and right (no gain on this amp) */
4392 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4393 /* set vol=0 HP mixer amp left and right */
4394 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4395 /* unmute pin widget amp left and right (no gain on this amp) */
4396 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4397 /* set vol=0 Mono mixer amp left and right */
4398 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4399 /* unmute pin widget amp left and right (no gain on this amp) */
4400 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4401 /* unmute LINE-2 out pin */
4402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4403 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4406 /* mute analog inputs */
4407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4412 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4413 /* mute Front out path */
4414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4415 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4416 /* mute Headphone out path */
4417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4419 /* mute Mono out path */
4420 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4421 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4425 #if 0 /* should be identical with alc260_init_verbs? */
4426 static struct hda_verb alc260_hp_init_verbs[] = {
4427 /* Headphone and output */
4428 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4430 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4431 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4433 /* Mic2 (front panel) pin widget for input and vref at 80% */
4434 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4435 /* Line In pin widget for input */
4436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4437 /* Line-2 pin widget for output */
4438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4439 /* CD pin widget for input */
4440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4441 /* unmute amp left and right */
4442 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4443 /* set connection select to line in (default select for this ADC) */
4444 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4445 /* unmute Line-Out mixer amp left and right (volume = 0) */
4446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4447 /* mute pin widget amp left and right (no gain on this amp) */
4448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4449 /* unmute HP mixer amp left and right (volume = 0) */
4450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4451 /* mute pin widget amp left and right (no gain on this amp) */
4452 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4453 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4456 /* mute analog inputs */
4457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4462 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4463 /* Unmute Front out path */
4464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4466 /* Unmute Headphone out path */
4467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4469 /* Unmute Mono out path */
4470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4471 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4476 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4477 /* Line out and output */
4478 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4480 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4481 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4482 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4483 /* Mic2 (front panel) pin widget for input and vref at 80% */
4484 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4485 /* Line In pin widget for input */
4486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4487 /* Headphone pin widget for output */
4488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4489 /* CD pin widget for input */
4490 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4491 /* unmute amp left and right */
4492 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4493 /* set connection select to line in (default select for this ADC) */
4494 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4495 /* unmute Line-Out mixer amp left and right (volume = 0) */
4496 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4497 /* mute pin widget amp left and right (no gain on this amp) */
4498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4499 /* unmute HP mixer amp left and right (volume = 0) */
4500 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4501 /* mute pin widget amp left and right (no gain on this amp) */
4502 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4503 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4506 /* mute analog inputs */
4507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4512 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4513 /* Unmute Front out path */
4514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4515 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4516 /* Unmute Headphone out path */
4517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4518 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4519 /* Unmute Mono out path */
4520 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4521 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4525 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4526 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4527 * audio = 0x16, internal speaker = 0x10.
4529 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4530 /* Disable all GPIOs */
4531 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4532 /* Internal speaker is connected to headphone pin */
4533 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4534 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4536 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4537 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4538 /* Ensure all other unused pins are disabled and muted. */
4539 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4541 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4542 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4543 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4544 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4548 /* Disable digital (SPDIF) pins */
4549 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4550 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4552 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4553 * when acting as an output.
4555 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4557 /* Start with output sum widgets muted and their output gains at min */
4558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4560 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4562 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4564 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4565 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4566 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4568 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4569 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4570 /* Unmute Line1 pin widget output buffer since it starts as an output.
4571 * If the pin mode is changed by the user the pin mode control will
4572 * take care of enabling the pin's input/output buffers as needed.
4573 * Therefore there's no need to enable the input buffer at this
4576 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4577 /* Unmute input buffer of pin widget used for Line-in (no equiv
4580 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4582 /* Mute capture amp left and right */
4583 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4584 /* Set ADC connection select to match default mixer setting - line
4587 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4589 /* Do the same for the second ADC: mute capture input amp and
4590 * set ADC connection to line in (on mic1 pin)
4592 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4593 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4595 /* Mute all inputs to mixer widget (even unconnected ones) */
4596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4603 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4608 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4609 * similar laptops (adapted from Fujitsu init verbs).
4611 static struct hda_verb alc260_acer_init_verbs[] = {
4612 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4613 * the headphone jack. Turn this on and rely on the standard mute
4614 * methods whenever the user wants to turn these outputs off.
4616 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4617 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4618 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4619 /* Internal speaker/Headphone jack is connected to Line-out pin */
4620 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4621 /* Internal microphone/Mic jack is connected to Mic1 pin */
4622 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4623 /* Line In jack is connected to Line1 pin */
4624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4625 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4626 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4627 /* Ensure all other unused pins are disabled and muted. */
4628 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4629 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4630 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4631 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4632 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4634 /* Disable digital (SPDIF) pins */
4635 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4636 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4638 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4639 * bus when acting as outputs.
4641 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4642 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4644 /* Start with output sum widgets muted and their output gains at min */
4645 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4646 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4647 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4648 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4650 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4651 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4652 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4653 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4655 /* Unmute Line-out pin widget amp left and right
4656 * (no equiv mixer ctrl)
4658 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4659 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4660 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4661 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4662 * inputs. If the pin mode is changed by the user the pin mode control
4663 * will take care of enabling the pin's input/output buffers as needed.
4664 * Therefore there's no need to enable the input buffer at this
4667 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4668 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4670 /* Mute capture amp left and right */
4671 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4672 /* Set ADC connection select to match default mixer setting - mic
4675 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4677 /* Do similar with the second ADC: mute capture input amp and
4678 * set ADC connection to mic to match ALSA's default state.
4680 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4681 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4683 /* Mute all inputs to mixer widget (even unconnected ones) */
4684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4696 static struct hda_verb alc260_will_verbs[] = {
4697 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4698 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4699 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4700 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4701 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4702 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4706 static struct hda_verb alc260_replacer_672v_verbs[] = {
4707 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4708 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4709 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4711 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4712 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4713 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4715 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4719 /* toggle speaker-output according to the hp-jack state */
4720 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4722 unsigned int present;
4724 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4725 present = snd_hda_codec_read(codec, 0x0f, 0,
4726 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4728 snd_hda_codec_write_cache(codec, 0x01, 0,
4729 AC_VERB_SET_GPIO_DATA, 1);
4730 snd_hda_codec_write_cache(codec, 0x0f, 0,
4731 AC_VERB_SET_PIN_WIDGET_CONTROL,
4734 snd_hda_codec_write_cache(codec, 0x01, 0,
4735 AC_VERB_SET_GPIO_DATA, 0);
4736 snd_hda_codec_write_cache(codec, 0x0f, 0,
4737 AC_VERB_SET_PIN_WIDGET_CONTROL,
4742 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4745 if ((res >> 26) == ALC880_HP_EVENT)
4746 alc260_replacer_672v_automute(codec);
4749 static struct hda_verb alc260_hp_dc7600_verbs[] = {
4750 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4752 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4753 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4754 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4756 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4757 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4758 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4759 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4763 /* Test configuration for debugging, modelled after the ALC880 test
4766 #ifdef CONFIG_SND_DEBUG
4767 static hda_nid_t alc260_test_dac_nids[1] = {
4770 static hda_nid_t alc260_test_adc_nids[2] = {
4773 /* For testing the ALC260, each input MUX needs its own definition since
4774 * the signal assignments are different. This assumes that the first ADC
4777 static struct hda_input_mux alc260_test_capture_sources[2] = {
4781 { "MIC1 pin", 0x0 },
4782 { "MIC2 pin", 0x1 },
4783 { "LINE1 pin", 0x2 },
4784 { "LINE2 pin", 0x3 },
4786 { "LINE-OUT pin", 0x5 },
4787 { "HP-OUT pin", 0x6 },
4793 { "MIC1 pin", 0x0 },
4794 { "MIC2 pin", 0x1 },
4795 { "LINE1 pin", 0x2 },
4796 { "LINE2 pin", 0x3 },
4799 { "LINE-OUT pin", 0x6 },
4800 { "HP-OUT pin", 0x7 },
4804 static struct snd_kcontrol_new alc260_test_mixer[] = {
4805 /* Output driver widgets */
4806 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4807 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4808 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4809 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4810 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4811 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4813 /* Modes for retasking pin widgets
4814 * Note: the ALC260 doesn't seem to act on requests to enable mic
4815 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4816 * mention this restriction. At this stage it's not clear whether
4817 * this behaviour is intentional or is a hardware bug in chip
4818 * revisions available at least up until early 2006. Therefore for
4819 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4820 * choices, but if it turns out that the lack of mic bias for these
4821 * NIDs is intentional we could change their modes from
4822 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4824 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4825 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4826 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4827 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4828 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4829 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4831 /* Loopback mixer controls */
4832 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4833 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4834 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4835 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4836 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4837 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4838 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4839 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4840 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4841 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4842 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4843 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4844 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4845 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4846 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4847 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4849 /* Controls for GPIO pins, assuming they are configured as outputs */
4850 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4851 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4852 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4853 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4855 /* Switches to allow the digital IO pins to be enabled. The datasheet
4856 * is ambigious as to which NID is which; testing on laptops which
4857 * make this output available should provide clarification.
4859 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4860 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4862 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4863 * this output to turn on an external amplifier.
4865 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4866 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4870 static struct hda_verb alc260_test_init_verbs[] = {
4871 /* Enable all GPIOs as outputs with an initial value of 0 */
4872 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4873 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4874 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4876 /* Enable retasking pins as output, initially without power amp */
4877 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4878 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4879 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4880 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4881 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4882 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4884 /* Disable digital (SPDIF) pins initially, but users can enable
4885 * them via a mixer switch. In the case of SPDIF-out, this initverb
4886 * payload also sets the generation to 0, output to be in "consumer"
4887 * PCM format, copyright asserted, no pre-emphasis and no validity
4890 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4891 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4893 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4894 * OUT1 sum bus when acting as an output.
4896 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4897 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4898 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4899 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4901 /* Start with output sum widgets muted and their output gains at min */
4902 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4903 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4904 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4906 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4907 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4908 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4909 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4910 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4912 /* Unmute retasking pin widget output buffers since the default
4913 * state appears to be output. As the pin mode is changed by the
4914 * user the pin mode control will take care of enabling the pin's
4915 * input/output buffers as needed.
4917 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4918 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4919 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4920 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4921 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4922 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4923 /* Also unmute the mono-out pin widget */
4924 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4926 /* Mute capture amp left and right */
4927 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4928 /* Set ADC connection select to match default mixer setting (mic1
4931 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4933 /* Do the same for the second ADC: mute capture input amp and
4934 * set ADC connection to mic1 pin
4936 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4937 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4939 /* Mute all inputs to mixer widget (even unconnected ones) */
4940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4944 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4953 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4954 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4956 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4957 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4960 * for BIOS auto-configuration
4963 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4967 unsigned long vol_val, sw_val;
4971 if (nid >= 0x0f && nid < 0x11) {
4972 nid_vol = nid - 0x7;
4973 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4974 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4975 } else if (nid == 0x11) {
4976 nid_vol = nid - 0x7;
4977 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4978 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4979 } else if (nid >= 0x12 && nid <= 0x15) {
4981 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4982 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4986 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4987 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4990 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4991 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4997 /* add playback controls from the parsed DAC table */
4998 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4999 const struct auto_pin_cfg *cfg)
5004 spec->multiout.num_dacs = 1;
5005 spec->multiout.dac_nids = spec->private_dac_nids;
5006 spec->multiout.dac_nids[0] = 0x02;
5008 nid = cfg->line_out_pins[0];
5010 err = alc260_add_playback_controls(spec, nid, "Front");
5015 nid = cfg->speaker_pins[0];
5017 err = alc260_add_playback_controls(spec, nid, "Speaker");
5022 nid = cfg->hp_pins[0];
5024 err = alc260_add_playback_controls(spec, nid, "Headphone");
5031 /* create playback/capture controls for input pins */
5032 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5033 const struct auto_pin_cfg *cfg)
5035 struct hda_input_mux *imux = &spec->private_imux;
5038 for (i = 0; i < AUTO_PIN_LAST; i++) {
5039 if (cfg->input_pins[i] >= 0x12) {
5040 idx = cfg->input_pins[i] - 0x12;
5041 err = new_analog_input(spec, cfg->input_pins[i],
5042 auto_pin_cfg_labels[i], idx,
5046 imux->items[imux->num_items].label =
5047 auto_pin_cfg_labels[i];
5048 imux->items[imux->num_items].index = idx;
5051 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5052 idx = cfg->input_pins[i] - 0x09;
5053 err = new_analog_input(spec, cfg->input_pins[i],
5054 auto_pin_cfg_labels[i], idx,
5058 imux->items[imux->num_items].label =
5059 auto_pin_cfg_labels[i];
5060 imux->items[imux->num_items].index = idx;
5067 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5068 hda_nid_t nid, int pin_type,
5071 alc_set_pin_output(codec, nid, pin_type);
5072 /* need the manual connection? */
5074 int idx = nid - 0x12;
5075 snd_hda_codec_write(codec, idx + 0x0b, 0,
5076 AC_VERB_SET_CONNECT_SEL, sel_idx);
5080 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5082 struct alc_spec *spec = codec->spec;
5085 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5086 nid = spec->autocfg.line_out_pins[0];
5088 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5089 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5092 nid = spec->autocfg.speaker_pins[0];
5094 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5096 nid = spec->autocfg.hp_pins[0];
5098 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5101 #define ALC260_PIN_CD_NID 0x16
5102 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5104 struct alc_spec *spec = codec->spec;
5107 for (i = 0; i < AUTO_PIN_LAST; i++) {
5108 hda_nid_t nid = spec->autocfg.input_pins[i];
5110 snd_hda_codec_write(codec, nid, 0,
5111 AC_VERB_SET_PIN_WIDGET_CONTROL,
5112 i <= AUTO_PIN_FRONT_MIC ?
5113 PIN_VREF80 : PIN_IN);
5114 if (nid != ALC260_PIN_CD_NID)
5115 snd_hda_codec_write(codec, nid, 0,
5116 AC_VERB_SET_AMP_GAIN_MUTE,
5123 * generic initialization of ADC, input mixers and output mixers
5125 static struct hda_verb alc260_volume_init_verbs[] = {
5127 * Unmute ADC0-1 and set the default input to mic-in
5129 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5130 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5131 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5132 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5134 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5136 * Note: PASD motherboards uses the Line In 2 as the input for
5137 * front panel mic (mic 2)
5139 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5140 /* mute analog inputs */
5141 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5142 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5143 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5144 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5145 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5148 * Set up output mixers (0x08 - 0x0a)
5150 /* set vol=0 to output mixers */
5151 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5152 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5153 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5154 /* set up input amps for analog loopback */
5155 /* Amp Indices: DAC = 0, mixer = 1 */
5156 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5157 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5158 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5159 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5160 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5161 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5166 static int alc260_parse_auto_config(struct hda_codec *codec)
5168 struct alc_spec *spec = codec->spec;
5171 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5173 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5177 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5180 if (!spec->kctl_alloc)
5181 return 0; /* can't find valid BIOS pin config */
5182 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5186 spec->multiout.max_channels = 2;
5188 if (spec->autocfg.dig_out_pin)
5189 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5190 if (spec->kctl_alloc)
5191 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5193 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5195 spec->num_mux_defs = 1;
5196 spec->input_mux = &spec->private_imux;
5198 /* check whether NID 0x04 is valid */
5199 wcap = get_wcaps(codec, 0x04);
5200 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5201 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5202 spec->adc_nids = alc260_adc_nids_alt;
5203 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5204 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5206 spec->adc_nids = alc260_adc_nids;
5207 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5208 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5215 /* additional initialization for auto-configuration model */
5216 static void alc260_auto_init(struct hda_codec *codec)
5218 struct alc_spec *spec = codec->spec;
5219 alc260_auto_init_multi_out(codec);
5220 alc260_auto_init_analog_input(codec);
5221 if (spec->unsol_event)
5222 alc_sku_automute(codec);
5225 #ifdef CONFIG_SND_HDA_POWER_SAVE
5226 static struct hda_amp_list alc260_loopbacks[] = {
5227 { 0x07, HDA_INPUT, 0 },
5228 { 0x07, HDA_INPUT, 1 },
5229 { 0x07, HDA_INPUT, 2 },
5230 { 0x07, HDA_INPUT, 3 },
5231 { 0x07, HDA_INPUT, 4 },
5237 * ALC260 configurations
5239 static const char *alc260_models[ALC260_MODEL_LAST] = {
5240 [ALC260_BASIC] = "basic",
5242 [ALC260_HP_3013] = "hp-3013",
5243 [ALC260_HP_DC7600] = "hp-dc7600",
5244 [ALC260_FUJITSU_S702X] = "fujitsu",
5245 [ALC260_ACER] = "acer",
5246 [ALC260_WILL] = "will",
5247 [ALC260_REPLACER_672V] = "replacer",
5248 #ifdef CONFIG_SND_DEBUG
5249 [ALC260_TEST] = "test",
5251 [ALC260_AUTO] = "auto",
5254 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5255 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5256 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5257 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5258 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5259 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5260 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5261 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5262 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5263 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5264 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5265 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5266 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5267 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5268 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5269 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5270 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5271 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5272 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5276 static struct alc_config_preset alc260_presets[] = {
5278 .mixers = { alc260_base_output_mixer,
5280 alc260_pc_beep_mixer,
5281 alc260_capture_mixer },
5282 .init_verbs = { alc260_init_verbs },
5283 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5284 .dac_nids = alc260_dac_nids,
5285 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5286 .adc_nids = alc260_adc_nids,
5287 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5288 .channel_mode = alc260_modes,
5289 .input_mux = &alc260_capture_source,
5292 .mixers = { alc260_hp_output_mixer,
5294 alc260_capture_alt_mixer },
5295 .init_verbs = { alc260_init_verbs,
5296 alc260_hp_unsol_verbs },
5297 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5298 .dac_nids = alc260_dac_nids,
5299 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5300 .adc_nids = alc260_hp_adc_nids,
5301 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5302 .channel_mode = alc260_modes,
5303 .input_mux = &alc260_capture_source,
5304 .unsol_event = alc260_hp_unsol_event,
5305 .init_hook = alc260_hp_automute,
5307 [ALC260_HP_DC7600] = {
5308 .mixers = { alc260_hp_dc7600_mixer,
5310 alc260_capture_alt_mixer },
5311 .init_verbs = { alc260_init_verbs,
5312 alc260_hp_dc7600_verbs },
5313 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5314 .dac_nids = alc260_dac_nids,
5315 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5316 .adc_nids = alc260_hp_adc_nids,
5317 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5318 .channel_mode = alc260_modes,
5319 .input_mux = &alc260_capture_source,
5320 .unsol_event = alc260_hp_3012_unsol_event,
5321 .init_hook = alc260_hp_3012_automute,
5323 [ALC260_HP_3013] = {
5324 .mixers = { alc260_hp_3013_mixer,
5326 alc260_capture_alt_mixer },
5327 .init_verbs = { alc260_hp_3013_init_verbs,
5328 alc260_hp_3013_unsol_verbs },
5329 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5330 .dac_nids = alc260_dac_nids,
5331 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5332 .adc_nids = alc260_hp_adc_nids,
5333 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5334 .channel_mode = alc260_modes,
5335 .input_mux = &alc260_capture_source,
5336 .unsol_event = alc260_hp_3013_unsol_event,
5337 .init_hook = alc260_hp_3013_automute,
5339 [ALC260_FUJITSU_S702X] = {
5340 .mixers = { alc260_fujitsu_mixer,
5341 alc260_capture_mixer },
5342 .init_verbs = { alc260_fujitsu_init_verbs },
5343 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5344 .dac_nids = alc260_dac_nids,
5345 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5346 .adc_nids = alc260_dual_adc_nids,
5347 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5348 .channel_mode = alc260_modes,
5349 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5350 .input_mux = alc260_fujitsu_capture_sources,
5353 .mixers = { alc260_acer_mixer,
5354 alc260_capture_mixer },
5355 .init_verbs = { alc260_acer_init_verbs },
5356 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5357 .dac_nids = alc260_dac_nids,
5358 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5359 .adc_nids = alc260_dual_adc_nids,
5360 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5361 .channel_mode = alc260_modes,
5362 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5363 .input_mux = alc260_acer_capture_sources,
5366 .mixers = { alc260_will_mixer,
5367 alc260_capture_mixer },
5368 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5369 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5370 .dac_nids = alc260_dac_nids,
5371 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5372 .adc_nids = alc260_adc_nids,
5373 .dig_out_nid = ALC260_DIGOUT_NID,
5374 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5375 .channel_mode = alc260_modes,
5376 .input_mux = &alc260_capture_source,
5378 [ALC260_REPLACER_672V] = {
5379 .mixers = { alc260_replacer_672v_mixer,
5380 alc260_capture_mixer },
5381 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5382 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5383 .dac_nids = alc260_dac_nids,
5384 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5385 .adc_nids = alc260_adc_nids,
5386 .dig_out_nid = ALC260_DIGOUT_NID,
5387 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5388 .channel_mode = alc260_modes,
5389 .input_mux = &alc260_capture_source,
5390 .unsol_event = alc260_replacer_672v_unsol_event,
5391 .init_hook = alc260_replacer_672v_automute,
5393 #ifdef CONFIG_SND_DEBUG
5395 .mixers = { alc260_test_mixer,
5396 alc260_capture_mixer },
5397 .init_verbs = { alc260_test_init_verbs },
5398 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5399 .dac_nids = alc260_test_dac_nids,
5400 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5401 .adc_nids = alc260_test_adc_nids,
5402 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5403 .channel_mode = alc260_modes,
5404 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5405 .input_mux = alc260_test_capture_sources,
5410 static int patch_alc260(struct hda_codec *codec)
5412 struct alc_spec *spec;
5413 int err, board_config;
5415 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5421 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5424 if (board_config < 0) {
5425 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5426 "trying auto-probe from BIOS...\n");
5427 board_config = ALC260_AUTO;
5430 if (board_config == ALC260_AUTO) {
5431 /* automatic parse from the BIOS config */
5432 err = alc260_parse_auto_config(codec);
5438 "hda_codec: Cannot set up configuration "
5439 "from BIOS. Using base mode...\n");
5440 board_config = ALC260_BASIC;
5444 if (board_config != ALC260_AUTO)
5445 setup_preset(spec, &alc260_presets[board_config]);
5447 spec->stream_name_analog = "ALC260 Analog";
5448 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5449 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5451 spec->stream_name_digital = "ALC260 Digital";
5452 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5453 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5455 spec->vmaster_nid = 0x08;
5457 codec->patch_ops = alc_patch_ops;
5458 if (board_config == ALC260_AUTO)
5459 spec->init_hook = alc260_auto_init;
5460 #ifdef CONFIG_SND_HDA_POWER_SAVE
5461 if (!spec->loopback.amplist)
5462 spec->loopback.amplist = alc260_loopbacks;
5472 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5473 * configuration. Each pin widget can choose any input DACs and a mixer.
5474 * Each ADC is connected from a mixer of all inputs. This makes possible
5475 * 6-channel independent captures.
5477 * In addition, an independent DAC for the multi-playback (not used in this
5480 #define ALC882_DIGOUT_NID 0x06
5481 #define ALC882_DIGIN_NID 0x0a
5483 static struct hda_channel_mode alc882_ch_modes[1] = {
5487 static hda_nid_t alc882_dac_nids[4] = {
5488 /* front, rear, clfe, rear_surr */
5489 0x02, 0x03, 0x04, 0x05
5492 /* identical with ALC880 */
5493 #define alc882_adc_nids alc880_adc_nids
5494 #define alc882_adc_nids_alt alc880_adc_nids_alt
5496 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5497 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5500 /* FIXME: should be a matrix-type input source selection */
5502 static struct hda_input_mux alc882_capture_source = {
5506 { "Front Mic", 0x1 },
5511 #define alc882_mux_enum_info alc_mux_enum_info
5512 #define alc882_mux_enum_get alc_mux_enum_get
5514 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5515 struct snd_ctl_elem_value *ucontrol)
5517 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5518 struct alc_spec *spec = codec->spec;
5519 const struct hda_input_mux *imux = spec->input_mux;
5520 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5521 hda_nid_t nid = spec->capsrc_nids ?
5522 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5523 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5524 unsigned int i, idx;
5526 idx = ucontrol->value.enumerated.item[0];
5527 if (idx >= imux->num_items)
5528 idx = imux->num_items - 1;
5529 if (*cur_val == idx)
5531 for (i = 0; i < imux->num_items; i++) {
5532 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5533 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5534 imux->items[i].index,
5544 static struct hda_verb alc882_3ST_ch2_init[] = {
5545 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5546 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5547 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5548 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5555 static struct hda_verb alc882_3ST_ch6_init[] = {
5556 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5557 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5558 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5559 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5560 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5561 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5565 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5566 { 2, alc882_3ST_ch2_init },
5567 { 6, alc882_3ST_ch6_init },
5573 static struct hda_verb alc882_sixstack_ch6_init[] = {
5574 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5575 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5576 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5577 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5584 static struct hda_verb alc882_sixstack_ch8_init[] = {
5585 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5586 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5587 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5588 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5592 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5593 { 6, alc882_sixstack_ch6_init },
5594 { 8, alc882_sixstack_ch8_init },
5598 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5604 static struct hda_verb alc885_mbp_ch2_init[] = {
5605 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5606 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5607 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5614 static struct hda_verb alc885_mbp_ch6_init[] = {
5615 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5616 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5617 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5618 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5619 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5623 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5624 { 2, alc885_mbp_ch2_init },
5625 { 6, alc885_mbp_ch6_init },
5629 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5630 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5632 static struct snd_kcontrol_new alc882_base_mixer[] = {
5633 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5634 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5635 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5636 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5637 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5638 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5639 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5640 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5641 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5642 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5643 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5644 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5645 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5646 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5647 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5649 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5651 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5652 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5653 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5654 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5655 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5659 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5660 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5661 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5662 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5663 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5665 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5667 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5668 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5672 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5673 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5674 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5675 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5676 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5677 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5678 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5680 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5682 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5683 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5687 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5688 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5689 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5691 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5692 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5693 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5694 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5697 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5698 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5699 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5700 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5704 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5705 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5707 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5708 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5709 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5710 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5711 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5712 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5713 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5714 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5715 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5716 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5717 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5719 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5720 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5724 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5725 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5726 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5727 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5728 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5729 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5730 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5731 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5733 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5734 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5735 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5736 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5740 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5742 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5743 .name = "Channel Mode",
5744 .info = alc_ch_mode_info,
5745 .get = alc_ch_mode_get,
5746 .put = alc_ch_mode_put,
5751 static struct hda_verb alc882_init_verbs[] = {
5752 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5757 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5758 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5762 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5763 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5765 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5766 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5767 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5769 /* Front Pin: output 0 (0x0c) */
5770 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5772 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5773 /* Rear Pin: output 1 (0x0d) */
5774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5776 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5777 /* CLFE Pin: output 2 (0x0e) */
5778 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5779 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5780 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5781 /* Side Pin: output 3 (0x0f) */
5782 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5783 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5784 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5785 /* Mic (rear) pin: input vref at 80% */
5786 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5787 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5788 /* Front Mic pin: input vref at 80% */
5789 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5790 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5791 /* Line In pin: input */
5792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5793 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5794 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5795 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5796 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5797 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5798 /* CD pin widget for input */
5799 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5801 /* FIXME: use matrix-type input source selection */
5802 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5803 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5804 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5805 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5806 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5807 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5809 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5810 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5811 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5812 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5814 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5815 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5818 /* ADC1: mute amp left and right */
5819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5820 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5821 /* ADC2: mute amp left and right */
5822 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5823 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5824 /* ADC3: mute amp left and right */
5825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5826 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5831 static struct hda_verb alc882_eapd_verbs[] = {
5832 /* change to EAPD mode */
5833 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5834 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5839 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5840 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5841 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5842 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5843 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5844 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5845 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5846 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5850 static struct hda_verb alc882_macpro_init_verbs[] = {
5851 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5855 /* Front Pin: output 0 (0x0c) */
5856 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5857 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5858 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5859 /* Front Mic pin: input vref at 80% */
5860 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5861 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5862 /* Speaker: output */
5863 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5864 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5865 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5866 /* Headphone output (output 0 - 0x0c) */
5867 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5868 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5869 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5871 /* FIXME: use matrix-type input source selection */
5872 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5873 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5874 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5875 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5876 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5877 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5879 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5880 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5881 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5882 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5885 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5886 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5887 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5888 /* ADC1: mute amp left and right */
5889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5890 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5891 /* ADC2: mute amp left and right */
5892 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5893 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5894 /* ADC3: mute amp left and right */
5895 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5896 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5901 /* Macbook Pro rev3 */
5902 static struct hda_verb alc885_mbp3_init_verbs[] = {
5903 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5905 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5906 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5911 /* Front Pin: output 0 (0x0c) */
5912 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5913 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5914 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5915 /* HP Pin: output 0 (0x0d) */
5916 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5917 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5918 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5919 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5920 /* Mic (rear) pin: input vref at 80% */
5921 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5922 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5923 /* Front Mic pin: input vref at 80% */
5924 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5925 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5926 /* Line In pin: use output 1 when in LineOut mode */
5927 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5928 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5929 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5931 /* FIXME: use matrix-type input source selection */
5932 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5933 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5934 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5935 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5936 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5937 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5939 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5940 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5941 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5942 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5944 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5946 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5947 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5948 /* ADC1: mute amp left and right */
5949 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5950 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5951 /* ADC2: mute amp left and right */
5952 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5953 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5954 /* ADC3: mute amp left and right */
5955 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5956 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5961 /* iMac 24 mixer. */
5962 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5963 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5964 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5968 /* iMac 24 init verbs. */
5969 static struct hda_verb alc885_imac24_init_verbs[] = {
5970 /* Internal speakers: output 0 (0x0c) */
5971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5973 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5974 /* Internal speakers: output 0 (0x0c) */
5975 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5977 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5978 /* Headphone: output 0 (0x0c) */
5979 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5980 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5981 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5982 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5983 /* Front Mic: input vref at 80% */
5984 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5985 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5989 /* Toggle speaker-output according to the hp-jack state */
5990 static void alc885_imac24_automute(struct hda_codec *codec)
5992 unsigned int present;
5994 present = snd_hda_codec_read(codec, 0x14, 0,
5995 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5996 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5997 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5998 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5999 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6002 /* Processes unsolicited events. */
6003 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6006 /* Headphone insertion or removal. */
6007 if ((res >> 26) == ALC880_HP_EVENT)
6008 alc885_imac24_automute(codec);
6011 static void alc885_mbp3_automute(struct hda_codec *codec)
6013 unsigned int present;
6015 present = snd_hda_codec_read(codec, 0x15, 0,
6016 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6017 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6018 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6019 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6020 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6023 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6026 /* Headphone insertion or removal. */
6027 if ((res >> 26) == ALC880_HP_EVENT)
6028 alc885_mbp3_automute(codec);
6032 static struct hda_verb alc882_targa_verbs[] = {
6033 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6037 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6039 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6040 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6041 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6043 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6044 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6045 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6046 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6050 /* toggle speaker-output according to the hp-jack state */
6051 static void alc882_targa_automute(struct hda_codec *codec)
6053 unsigned int present;
6055 present = snd_hda_codec_read(codec, 0x14, 0,
6056 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6057 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6058 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6059 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6063 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6065 /* Looks like the unsol event is incompatible with the standard
6066 * definition. 4bit tag is placed at 26 bit!
6068 if (((res >> 26) == ALC880_HP_EVENT)) {
6069 alc882_targa_automute(codec);
6073 static struct hda_verb alc882_asus_a7j_verbs[] = {
6074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6077 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6079 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6081 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6083 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6085 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6086 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6087 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6091 static struct hda_verb alc882_asus_a7m_verbs[] = {
6092 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6096 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6097 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6099 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6100 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6101 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6103 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6104 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6105 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6109 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6111 unsigned int gpiostate, gpiomask, gpiodir;
6113 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6114 AC_VERB_GET_GPIO_DATA, 0);
6117 gpiostate |= (1 << pin);
6119 gpiostate &= ~(1 << pin);
6121 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6122 AC_VERB_GET_GPIO_MASK, 0);
6123 gpiomask |= (1 << pin);
6125 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6126 AC_VERB_GET_GPIO_DIRECTION, 0);
6127 gpiodir |= (1 << pin);
6130 snd_hda_codec_write(codec, codec->afg, 0,
6131 AC_VERB_SET_GPIO_MASK, gpiomask);
6132 snd_hda_codec_write(codec, codec->afg, 0,
6133 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6137 snd_hda_codec_write(codec, codec->afg, 0,
6138 AC_VERB_SET_GPIO_DATA, gpiostate);
6141 /* set up GPIO at initialization */
6142 static void alc885_macpro_init_hook(struct hda_codec *codec)
6144 alc882_gpio_mute(codec, 0, 0);
6145 alc882_gpio_mute(codec, 1, 0);
6148 /* set up GPIO and update auto-muting at initialization */
6149 static void alc885_imac24_init_hook(struct hda_codec *codec)
6151 alc885_macpro_init_hook(codec);
6152 alc885_imac24_automute(codec);
6156 * generic initialization of ADC, input mixers and output mixers
6158 static struct hda_verb alc882_auto_init_verbs[] = {
6160 * Unmute ADC0-2 and set the default input to mic-in
6162 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6164 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6165 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6166 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6167 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6169 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6171 * Note: PASD motherboards uses the Line In 2 as the input for
6172 * front panel mic (mic 2)
6174 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6177 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6182 * Set up output mixers (0x0c - 0x0f)
6184 /* set vol=0 to output mixers */
6185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6186 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6187 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6188 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6189 /* set up input amps for analog loopback */
6190 /* Amp Indices: DAC = 0, mixer = 1 */
6191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6192 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6193 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6194 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6195 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6196 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6197 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6198 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6199 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6200 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6202 /* FIXME: use matrix-type input source selection */
6203 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6204 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6223 /* capture mixer elements */
6224 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6225 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6226 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6227 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6228 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6230 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6231 /* The multiple "Capture Source" controls confuse alsamixer
6232 * So call somewhat different..
6234 /* .name = "Capture Source", */
6235 .name = "Input Source",
6237 .info = alc882_mux_enum_info,
6238 .get = alc882_mux_enum_get,
6239 .put = alc882_mux_enum_put,
6244 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6245 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6246 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6247 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6248 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6249 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6250 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6252 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6253 /* The multiple "Capture Source" controls confuse alsamixer
6254 * So call somewhat different..
6256 /* .name = "Capture Source", */
6257 .name = "Input Source",
6259 .info = alc882_mux_enum_info,
6260 .get = alc882_mux_enum_get,
6261 .put = alc882_mux_enum_put,
6266 #ifdef CONFIG_SND_HDA_POWER_SAVE
6267 #define alc882_loopbacks alc880_loopbacks
6270 /* pcm configuration: identiacal with ALC880 */
6271 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6272 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6273 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6274 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6277 * configuration and preset
6279 static const char *alc882_models[ALC882_MODEL_LAST] = {
6280 [ALC882_3ST_DIG] = "3stack-dig",
6281 [ALC882_6ST_DIG] = "6stack-dig",
6282 [ALC882_ARIMA] = "arima",
6283 [ALC882_W2JC] = "w2jc",
6284 [ALC882_TARGA] = "targa",
6285 [ALC882_ASUS_A7J] = "asus-a7j",
6286 [ALC882_ASUS_A7M] = "asus-a7m",
6287 [ALC885_MACPRO] = "macpro",
6288 [ALC885_MBP3] = "mbp3",
6289 [ALC885_IMAC24] = "imac24",
6290 [ALC882_AUTO] = "auto",
6293 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6294 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6295 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6296 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6297 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6298 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6299 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6300 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6301 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6302 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6303 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6304 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6305 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6309 static struct alc_config_preset alc882_presets[] = {
6310 [ALC882_3ST_DIG] = {
6311 .mixers = { alc882_base_mixer },
6312 .init_verbs = { alc882_init_verbs },
6313 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6314 .dac_nids = alc882_dac_nids,
6315 .dig_out_nid = ALC882_DIGOUT_NID,
6316 .dig_in_nid = ALC882_DIGIN_NID,
6317 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6318 .channel_mode = alc882_ch_modes,
6320 .input_mux = &alc882_capture_source,
6322 [ALC882_6ST_DIG] = {
6323 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6324 .init_verbs = { alc882_init_verbs },
6325 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6326 .dac_nids = alc882_dac_nids,
6327 .dig_out_nid = ALC882_DIGOUT_NID,
6328 .dig_in_nid = ALC882_DIGIN_NID,
6329 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6330 .channel_mode = alc882_sixstack_modes,
6331 .input_mux = &alc882_capture_source,
6334 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6335 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6336 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6337 .dac_nids = alc882_dac_nids,
6338 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6339 .channel_mode = alc882_sixstack_modes,
6340 .input_mux = &alc882_capture_source,
6343 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6344 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6345 alc880_gpio1_init_verbs },
6346 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6347 .dac_nids = alc882_dac_nids,
6348 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6349 .channel_mode = alc880_threestack_modes,
6351 .input_mux = &alc882_capture_source,
6352 .dig_out_nid = ALC882_DIGOUT_NID,
6355 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6356 .init_verbs = { alc885_mbp3_init_verbs,
6357 alc880_gpio1_init_verbs },
6358 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6359 .dac_nids = alc882_dac_nids,
6360 .channel_mode = alc885_mbp_6ch_modes,
6361 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6362 .input_mux = &alc882_capture_source,
6363 .dig_out_nid = ALC882_DIGOUT_NID,
6364 .dig_in_nid = ALC882_DIGIN_NID,
6365 .unsol_event = alc885_mbp3_unsol_event,
6366 .init_hook = alc885_mbp3_automute,
6369 .mixers = { alc882_macpro_mixer },
6370 .init_verbs = { alc882_macpro_init_verbs },
6371 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6372 .dac_nids = alc882_dac_nids,
6373 .dig_out_nid = ALC882_DIGOUT_NID,
6374 .dig_in_nid = ALC882_DIGIN_NID,
6375 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6376 .channel_mode = alc882_ch_modes,
6377 .input_mux = &alc882_capture_source,
6378 .init_hook = alc885_macpro_init_hook,
6381 .mixers = { alc885_imac24_mixer },
6382 .init_verbs = { alc885_imac24_init_verbs },
6383 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6384 .dac_nids = alc882_dac_nids,
6385 .dig_out_nid = ALC882_DIGOUT_NID,
6386 .dig_in_nid = ALC882_DIGIN_NID,
6387 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6388 .channel_mode = alc882_ch_modes,
6389 .input_mux = &alc882_capture_source,
6390 .unsol_event = alc885_imac24_unsol_event,
6391 .init_hook = alc885_imac24_init_hook,
6394 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6395 alc882_capture_mixer },
6396 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6397 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6398 .dac_nids = alc882_dac_nids,
6399 .dig_out_nid = ALC882_DIGOUT_NID,
6400 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6401 .adc_nids = alc882_adc_nids,
6402 .capsrc_nids = alc882_capsrc_nids,
6403 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6404 .channel_mode = alc882_3ST_6ch_modes,
6406 .input_mux = &alc882_capture_source,
6407 .unsol_event = alc882_targa_unsol_event,
6408 .init_hook = alc882_targa_automute,
6410 [ALC882_ASUS_A7J] = {
6411 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6412 alc882_capture_mixer },
6413 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6414 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6415 .dac_nids = alc882_dac_nids,
6416 .dig_out_nid = ALC882_DIGOUT_NID,
6417 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6418 .adc_nids = alc882_adc_nids,
6419 .capsrc_nids = alc882_capsrc_nids,
6420 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6421 .channel_mode = alc882_3ST_6ch_modes,
6423 .input_mux = &alc882_capture_source,
6425 [ALC882_ASUS_A7M] = {
6426 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6427 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6428 alc880_gpio1_init_verbs,
6429 alc882_asus_a7m_verbs },
6430 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6431 .dac_nids = alc882_dac_nids,
6432 .dig_out_nid = ALC882_DIGOUT_NID,
6433 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6434 .channel_mode = alc880_threestack_modes,
6436 .input_mux = &alc882_capture_source,
6445 PINFIX_ABIT_AW9D_MAX
6448 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6449 { 0x15, 0x01080104 }, /* side */
6450 { 0x16, 0x01011012 }, /* rear */
6451 { 0x17, 0x01016011 }, /* clfe */
6455 static const struct alc_pincfg *alc882_pin_fixes[] = {
6456 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6459 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6460 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6465 * BIOS auto configuration
6467 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6468 hda_nid_t nid, int pin_type,
6472 struct alc_spec *spec = codec->spec;
6475 alc_set_pin_output(codec, nid, pin_type);
6476 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6479 idx = spec->multiout.dac_nids[dac_idx] - 2;
6480 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6484 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6486 struct alc_spec *spec = codec->spec;
6489 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6490 for (i = 0; i <= HDA_SIDE; i++) {
6491 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6492 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6494 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6499 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6501 struct alc_spec *spec = codec->spec;
6504 pin = spec->autocfg.hp_pins[0];
6505 if (pin) /* connect to front */
6507 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6508 pin = spec->autocfg.speaker_pins[0];
6510 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6513 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6514 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6516 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6518 struct alc_spec *spec = codec->spec;
6521 for (i = 0; i < AUTO_PIN_LAST; i++) {
6522 hda_nid_t nid = spec->autocfg.input_pins[i];
6527 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6528 unsigned int pincap;
6529 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6530 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6534 snd_hda_codec_write(codec, nid, 0,
6535 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6536 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6537 snd_hda_codec_write(codec, nid, 0,
6538 AC_VERB_SET_AMP_GAIN_MUTE,
6543 static void alc882_auto_init_input_src(struct hda_codec *codec)
6545 struct alc_spec *spec = codec->spec;
6546 const struct hda_input_mux *imux = spec->input_mux;
6549 for (c = 0; c < spec->num_adc_nids; c++) {
6550 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6551 hda_nid_t nid = spec->capsrc_nids[c];
6552 int conns, mute, idx, item;
6554 conns = snd_hda_get_connections(codec, nid, conn_list,
6555 ARRAY_SIZE(conn_list));
6558 for (idx = 0; idx < conns; idx++) {
6559 /* if the current connection is the selected one,
6560 * unmute it as default - otherwise mute it
6562 mute = AMP_IN_MUTE(idx);
6563 for (item = 0; item < imux->num_items; item++) {
6564 if (imux->items[item].index == idx) {
6565 if (spec->cur_mux[c] == item)
6566 mute = AMP_IN_UNMUTE(idx);
6570 snd_hda_codec_write(codec, nid, 0,
6571 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6576 /* add mic boosts if needed */
6577 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6579 struct alc_spec *spec = codec->spec;
6583 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6584 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6585 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6587 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6591 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6592 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6593 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6595 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6602 /* almost identical with ALC880 parser... */
6603 static int alc882_parse_auto_config(struct hda_codec *codec)
6605 struct alc_spec *spec = codec->spec;
6606 int err = alc880_parse_auto_config(codec);
6611 return 0; /* no config found */
6613 err = alc_auto_add_mic_boost(codec);
6617 /* hack - override the init verbs */
6618 spec->init_verbs[0] = alc882_auto_init_verbs;
6620 return 1; /* config found */
6623 /* additional initialization for auto-configuration model */
6624 static void alc882_auto_init(struct hda_codec *codec)
6626 struct alc_spec *spec = codec->spec;
6627 alc882_auto_init_multi_out(codec);
6628 alc882_auto_init_hp_out(codec);
6629 alc882_auto_init_analog_input(codec);
6630 alc882_auto_init_input_src(codec);
6631 if (spec->unsol_event)
6632 alc_sku_automute(codec);
6635 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6637 static int patch_alc882(struct hda_codec *codec)
6639 struct alc_spec *spec;
6640 int err, board_config;
6642 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6648 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6652 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6653 /* Pick up systems that don't supply PCI SSID */
6654 switch (codec->subsystem_id) {
6655 case 0x106b0c00: /* Mac Pro */
6656 board_config = ALC885_MACPRO;
6658 case 0x106b1000: /* iMac 24 */
6659 case 0x106b2800: /* AppleTV */
6660 board_config = ALC885_IMAC24;
6662 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6663 case 0x106b00a4: /* MacbookPro4,1 */
6664 case 0x106b2c00: /* Macbook Pro rev3 */
6665 case 0x106b3600: /* Macbook 3.1 */
6666 board_config = ALC885_MBP3;
6669 /* ALC889A is handled better as ALC888-compatible */
6670 if (codec->revision_id == 0x100101 ||
6671 codec->revision_id == 0x100103) {
6673 return patch_alc883(codec);
6675 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6676 "trying auto-probe from BIOS...\n");
6677 board_config = ALC882_AUTO;
6681 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6683 if (board_config == ALC882_AUTO) {
6684 /* automatic parse from the BIOS config */
6685 err = alc882_parse_auto_config(codec);
6691 "hda_codec: Cannot set up configuration "
6692 "from BIOS. Using base mode...\n");
6693 board_config = ALC882_3ST_DIG;
6697 if (board_config != ALC882_AUTO)
6698 setup_preset(spec, &alc882_presets[board_config]);
6700 if (codec->vendor_id == 0x10ec0885) {
6701 spec->stream_name_analog = "ALC885 Analog";
6702 spec->stream_name_digital = "ALC885 Digital";
6704 spec->stream_name_analog = "ALC882 Analog";
6705 spec->stream_name_digital = "ALC882 Digital";
6708 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6709 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6710 /* FIXME: setup DAC5 */
6711 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6712 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6714 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6715 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6717 if (!spec->adc_nids && spec->input_mux) {
6718 /* check whether NID 0x07 is valid */
6719 unsigned int wcap = get_wcaps(codec, 0x07);
6721 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6722 if (wcap != AC_WID_AUD_IN) {
6723 spec->adc_nids = alc882_adc_nids_alt;
6724 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6725 spec->capsrc_nids = alc882_capsrc_nids_alt;
6726 spec->mixers[spec->num_mixers] =
6727 alc882_capture_alt_mixer;
6730 spec->adc_nids = alc882_adc_nids;
6731 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6732 spec->capsrc_nids = alc882_capsrc_nids;
6733 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6738 spec->vmaster_nid = 0x0c;
6740 codec->patch_ops = alc_patch_ops;
6741 if (board_config == ALC882_AUTO)
6742 spec->init_hook = alc882_auto_init;
6743 #ifdef CONFIG_SND_HDA_POWER_SAVE
6744 if (!spec->loopback.amplist)
6745 spec->loopback.amplist = alc882_loopbacks;
6754 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6755 * configuration. Each pin widget can choose any input DACs and a mixer.
6756 * Each ADC is connected from a mixer of all inputs. This makes possible
6757 * 6-channel independent captures.
6759 * In addition, an independent DAC for the multi-playback (not used in this
6762 #define ALC883_DIGOUT_NID 0x06
6763 #define ALC883_DIGIN_NID 0x0a
6765 static hda_nid_t alc883_dac_nids[4] = {
6766 /* front, rear, clfe, rear_surr */
6767 0x02, 0x03, 0x04, 0x05
6770 static hda_nid_t alc883_adc_nids[2] = {
6775 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6778 /* FIXME: should be a matrix-type input source selection */
6780 static struct hda_input_mux alc883_capture_source = {
6784 { "Front Mic", 0x1 },
6790 static struct hda_input_mux alc883_3stack_6ch_intel = {
6794 { "Front Mic", 0x0 },
6800 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6808 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6818 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6826 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6830 { "Front Mic", 0x1 },
6835 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6843 #define alc883_mux_enum_info alc_mux_enum_info
6844 #define alc883_mux_enum_get alc_mux_enum_get
6845 /* ALC883 has the ALC882-type input selection */
6846 #define alc883_mux_enum_put alc882_mux_enum_put
6851 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6858 static struct hda_verb alc883_3ST_ch2_init[] = {
6859 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6860 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6861 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6862 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6869 static struct hda_verb alc883_3ST_ch4_init[] = {
6870 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6871 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6872 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6873 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6874 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6881 static struct hda_verb alc883_3ST_ch6_init[] = {
6882 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6883 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6884 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6887 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6891 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6892 { 2, alc883_3ST_ch2_init },
6893 { 4, alc883_3ST_ch4_init },
6894 { 6, alc883_3ST_ch6_init },
6900 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6901 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6902 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6903 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6904 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6911 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6912 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6913 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6914 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6915 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6916 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6923 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6924 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6925 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6926 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6927 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6928 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6929 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6933 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6934 { 2, alc883_3ST_ch2_intel_init },
6935 { 4, alc883_3ST_ch4_intel_init },
6936 { 6, alc883_3ST_ch6_intel_init },
6942 static struct hda_verb alc883_sixstack_ch6_init[] = {
6943 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6944 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6945 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6946 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6953 static struct hda_verb alc883_sixstack_ch8_init[] = {
6954 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6955 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6956 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6957 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6961 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6962 { 6, alc883_sixstack_ch6_init },
6963 { 8, alc883_sixstack_ch8_init },
6966 static struct hda_verb alc883_medion_eapd_verbs[] = {
6967 /* eanable EAPD on medion laptop */
6968 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6969 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6973 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6974 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6977 static struct snd_kcontrol_new alc883_base_mixer[] = {
6978 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6979 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6980 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6981 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6982 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6983 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6984 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6985 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6986 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6987 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6997 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6998 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6999 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7000 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7001 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7002 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7003 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7004 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7007 /* .name = "Capture Source", */
7008 .name = "Input Source",
7010 .info = alc883_mux_enum_info,
7011 .get = alc883_mux_enum_get,
7012 .put = alc883_mux_enum_put,
7017 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7018 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7019 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7020 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7021 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7022 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7023 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7026 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7028 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7029 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7030 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7032 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7033 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7034 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7036 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7037 /* .name = "Capture Source", */
7038 .name = "Input Source",
7040 .info = alc883_mux_enum_info,
7041 .get = alc883_mux_enum_get,
7042 .put = alc883_mux_enum_put,
7047 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7048 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7049 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7050 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7051 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7053 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7055 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7056 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7057 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7058 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7059 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7060 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7061 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7063 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7064 /* .name = "Capture Source", */
7065 .name = "Input Source",
7067 .info = alc883_mux_enum_info,
7068 .get = alc883_mux_enum_get,
7069 .put = alc883_mux_enum_put,
7074 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7075 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7076 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7077 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7078 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7080 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7082 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7083 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7084 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7085 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7086 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7087 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7088 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7090 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7091 /* .name = "Capture Source", */
7092 .name = "Input Source",
7094 .info = alc883_mux_enum_info,
7095 .get = alc883_mux_enum_get,
7096 .put = alc883_mux_enum_put,
7101 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7103 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7104 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7105 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7106 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7107 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7108 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7110 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7113 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7114 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7115 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7116 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7118 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7119 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7120 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7122 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7123 /* .name = "Capture Source", */
7124 .name = "Input Source",
7126 .info = alc883_mux_enum_info,
7127 .get = alc883_mux_enum_get,
7128 .put = alc883_mux_enum_put,
7133 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7135 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7136 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7137 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7138 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7139 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7140 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7141 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7142 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7143 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7144 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7146 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7149 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7150 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7151 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7152 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7153 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7154 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7155 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7156 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7158 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7159 /* .name = "Capture Source", */
7160 .name = "Input Source",
7162 .info = alc883_mux_enum_info,
7163 .get = alc883_mux_enum_get,
7164 .put = alc883_mux_enum_put,
7169 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7170 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7171 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7172 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7173 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7174 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7176 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7177 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7178 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7179 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7180 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7181 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7185 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7186 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7187 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7188 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7189 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7190 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7191 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7192 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7193 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7194 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7195 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7197 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7198 /* .name = "Capture Source", */
7199 .name = "Input Source",
7201 .info = alc883_mux_enum_info,
7202 .get = alc883_mux_enum_get,
7203 .put = alc883_mux_enum_put,
7208 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7209 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7210 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7211 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7212 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7213 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7214 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7215 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7216 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7218 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7219 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7220 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7221 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7223 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7225 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7226 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7227 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7228 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7229 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7230 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7231 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7234 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7235 /* .name = "Capture Source", */
7236 .name = "Input Source",
7238 .info = alc883_mux_enum_info,
7239 .get = alc883_mux_enum_get,
7240 .put = alc883_mux_enum_put,
7245 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7246 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7248 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7249 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7250 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7251 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7252 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7253 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7254 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7255 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7256 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7257 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7258 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7260 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7261 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7262 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7263 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7264 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7265 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7267 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7268 /* .name = "Capture Source", */
7269 .name = "Input Source",
7271 .info = alc883_mux_enum_info,
7272 .get = alc883_mux_enum_get,
7273 .put = alc883_mux_enum_put,
7278 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7279 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7280 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7281 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7282 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7283 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7285 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7287 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7288 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7289 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7290 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7291 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7292 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7293 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7295 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7296 /* .name = "Capture Source", */
7297 .name = "Input Source",
7299 .info = alc883_mux_enum_info,
7300 .get = alc883_mux_enum_get,
7301 .put = alc883_mux_enum_put,
7306 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7307 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7308 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7309 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7310 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7312 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7313 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7315 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7316 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7318 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7319 /* .name = "Capture Source", */
7320 .name = "Input Source",
7322 .info = alc883_mux_enum_info,
7323 .get = alc883_mux_enum_get,
7324 .put = alc883_mux_enum_put,
7329 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7330 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7331 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7333 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7334 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7337 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7338 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7339 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7340 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7341 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7342 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7344 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7345 /* .name = "Capture Source", */
7346 .name = "Input Source",
7348 .info = alc883_mux_enum_info,
7349 .get = alc883_mux_enum_get,
7350 .put = alc883_mux_enum_put,
7355 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7356 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7357 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7358 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7359 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7360 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7363 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7364 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7365 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7366 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7367 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7368 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7370 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7371 /* .name = "Capture Source", */
7372 .name = "Input Source",
7374 .info = alc883_mux_enum_info,
7375 .get = alc883_mux_enum_get,
7376 .put = alc883_mux_enum_put,
7381 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7382 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7383 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7385 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7386 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7387 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7388 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7389 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7390 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7391 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7392 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7393 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7395 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7396 /* .name = "Capture Source", */
7397 .name = "Input Source",
7399 .info = alc883_mux_enum_info,
7400 .get = alc883_mux_enum_get,
7401 .put = alc883_mux_enum_put,
7406 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7407 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7408 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7409 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7410 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7411 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7412 0x0d, 1, 0x0, HDA_OUTPUT),
7413 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7414 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7415 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7416 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7417 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7419 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7420 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7421 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7423 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7425 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7426 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7427 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7428 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7429 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7431 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7432 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7433 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7435 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7436 /* .name = "Capture Source", */
7437 .name = "Input Source",
7439 .info = alc883_mux_enum_info,
7440 .get = alc883_mux_enum_get,
7441 .put = alc883_mux_enum_put,
7446 static struct hda_bind_ctls alc883_bind_cap_vol = {
7447 .ops = &snd_hda_bind_vol,
7449 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7450 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7455 static struct hda_bind_ctls alc883_bind_cap_switch = {
7456 .ops = &snd_hda_bind_sw,
7458 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7459 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7464 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7466 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7467 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7471 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7473 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7474 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7476 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7477 /* .name = "Capture Source", */
7478 .name = "Input Source",
7480 .info = alc883_mux_enum_info,
7481 .get = alc883_mux_enum_get,
7482 .put = alc883_mux_enum_put,
7487 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7490 .name = "Channel Mode",
7491 .info = alc_ch_mode_info,
7492 .get = alc_ch_mode_get,
7493 .put = alc_ch_mode_put,
7498 static struct hda_verb alc883_init_verbs[] = {
7499 /* ADC1: mute amp left and right */
7500 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7501 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7502 /* ADC2: mute amp left and right */
7503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7504 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7505 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7518 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7522 /* mute analog input loopbacks */
7523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7529 /* Front Pin: output 0 (0x0c) */
7530 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7531 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7532 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7533 /* Rear Pin: output 1 (0x0d) */
7534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7536 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7537 /* CLFE Pin: output 2 (0x0e) */
7538 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7539 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7540 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7541 /* Side Pin: output 3 (0x0f) */
7542 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7543 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7544 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7545 /* Mic (rear) pin: input vref at 80% */
7546 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7547 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7548 /* Front Mic pin: input vref at 80% */
7549 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7550 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7551 /* Line In pin: input */
7552 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7553 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7554 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7556 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7557 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7558 /* CD pin widget for input */
7559 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7561 /* FIXME: use matrix-type input source selection */
7562 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7576 /* toggle speaker-output according to the hp-jack state */
7577 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7579 unsigned int present;
7581 present = snd_hda_codec_read(codec, 0x15, 0,
7582 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7583 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7584 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7585 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7586 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7589 /* auto-toggle front mic */
7591 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7593 unsigned int present;
7596 present = snd_hda_codec_read(codec, 0x18, 0,
7597 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7598 bits = present ? HDA_AMP_MUTE : 0;
7599 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7603 static void alc883_mitac_automute(struct hda_codec *codec)
7605 alc883_mitac_hp_automute(codec);
7606 /* alc883_mitac_mic_automute(codec); */
7609 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7612 switch (res >> 26) {
7613 case ALC880_HP_EVENT:
7614 alc883_mitac_hp_automute(codec);
7616 case ALC880_MIC_EVENT:
7617 /* alc883_mitac_mic_automute(codec); */
7622 static struct hda_verb alc883_mitac_verbs[] = {
7624 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7627 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7628 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7630 /* enable unsolicited event */
7631 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7632 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7637 static struct hda_verb alc883_clevo_m720_verbs[] = {
7639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7640 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7642 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7645 /* enable unsolicited event */
7646 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7647 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7652 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7654 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7657 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7660 /* enable unsolicited event */
7661 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7666 static struct hda_verb alc883_tagra_verbs[] = {
7667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7670 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7671 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7673 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7674 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7675 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7677 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7678 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7679 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7680 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7685 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7686 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7687 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7688 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7692 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7693 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7695 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7696 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7700 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7703 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7704 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7705 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7709 static struct hda_verb alc883_haier_w66_verbs[] = {
7710 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7713 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7715 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7716 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7717 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7718 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7722 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7725 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7728 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7729 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7730 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7734 static struct hda_verb alc888_3st_hp_verbs[] = {
7735 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7736 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7737 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7741 static struct hda_verb alc888_6st_dell_verbs[] = {
7742 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7746 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7747 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7748 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7749 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7750 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7754 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7755 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7756 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7757 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7758 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7762 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7763 { 2, alc888_3st_hp_2ch_init },
7764 { 6, alc888_3st_hp_6ch_init },
7767 /* toggle front-jack and RCA according to the hp-jack state */
7768 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7770 unsigned int present;
7772 present = snd_hda_codec_read(codec, 0x1b, 0,
7773 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7774 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7775 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7776 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7777 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7780 /* toggle RCA according to the front-jack state */
7781 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7783 unsigned int present;
7785 present = snd_hda_codec_read(codec, 0x14, 0,
7786 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7787 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7788 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7791 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7794 if ((res >> 26) == ALC880_HP_EVENT)
7795 alc888_lenovo_ms7195_front_automute(codec);
7796 if ((res >> 26) == ALC880_FRONT_EVENT)
7797 alc888_lenovo_ms7195_rca_automute(codec);
7800 static struct hda_verb alc883_medion_md2_verbs[] = {
7801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7802 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7806 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7810 /* toggle speaker-output according to the hp-jack state */
7811 static void alc883_medion_md2_automute(struct hda_codec *codec)
7813 unsigned int present;
7815 present = snd_hda_codec_read(codec, 0x14, 0,
7816 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7817 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7818 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7821 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7824 if ((res >> 26) == ALC880_HP_EVENT)
7825 alc883_medion_md2_automute(codec);
7828 /* toggle speaker-output according to the hp-jack state */
7829 static void alc883_tagra_automute(struct hda_codec *codec)
7831 unsigned int present;
7834 present = snd_hda_codec_read(codec, 0x14, 0,
7835 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7836 bits = present ? HDA_AMP_MUTE : 0;
7837 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7838 HDA_AMP_MUTE, bits);
7839 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7843 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7845 if ((res >> 26) == ALC880_HP_EVENT)
7846 alc883_tagra_automute(codec);
7849 /* toggle speaker-output according to the hp-jack state */
7850 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7852 unsigned int present;
7855 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7856 & AC_PINSENSE_PRESENCE;
7857 bits = present ? HDA_AMP_MUTE : 0;
7858 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7859 HDA_AMP_MUTE, bits);
7862 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7864 unsigned int present;
7866 present = snd_hda_codec_read(codec, 0x18, 0,
7867 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7868 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7869 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7872 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7874 alc883_clevo_m720_hp_automute(codec);
7875 alc883_clevo_m720_mic_automute(codec);
7878 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7881 switch (res >> 26) {
7882 case ALC880_HP_EVENT:
7883 alc883_clevo_m720_hp_automute(codec);
7885 case ALC880_MIC_EVENT:
7886 alc883_clevo_m720_mic_automute(codec);
7891 /* toggle speaker-output according to the hp-jack state */
7892 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7894 unsigned int present;
7897 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7898 & AC_PINSENSE_PRESENCE;
7899 bits = present ? HDA_AMP_MUTE : 0;
7900 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7901 HDA_AMP_MUTE, bits);
7904 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7907 if ((res >> 26) == ALC880_HP_EVENT)
7908 alc883_2ch_fujitsu_pi2515_automute(codec);
7911 static void alc883_haier_w66_automute(struct hda_codec *codec)
7913 unsigned int present;
7916 present = snd_hda_codec_read(codec, 0x1b, 0,
7917 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7918 bits = present ? 0x80 : 0;
7919 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7923 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7926 if ((res >> 26) == ALC880_HP_EVENT)
7927 alc883_haier_w66_automute(codec);
7930 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7932 unsigned int present;
7935 present = snd_hda_codec_read(codec, 0x14, 0,
7936 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7937 bits = present ? HDA_AMP_MUTE : 0;
7938 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7939 HDA_AMP_MUTE, bits);
7942 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7944 unsigned int present;
7947 present = snd_hda_codec_read(codec, 0x1b, 0,
7948 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7949 bits = present ? HDA_AMP_MUTE : 0;
7950 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7951 HDA_AMP_MUTE, bits);
7952 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7953 HDA_AMP_MUTE, bits);
7956 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7959 if ((res >> 26) == ALC880_HP_EVENT)
7960 alc883_lenovo_101e_all_automute(codec);
7961 if ((res >> 26) == ALC880_FRONT_EVENT)
7962 alc883_lenovo_101e_ispeaker_automute(codec);
7965 /* toggle speaker-output according to the hp-jack state */
7966 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7968 unsigned int present;
7970 present = snd_hda_codec_read(codec, 0x14, 0,
7971 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7972 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7973 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7974 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7975 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7978 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7981 if ((res >> 26) == ALC880_HP_EVENT)
7982 alc883_acer_aspire_automute(codec);
7985 static struct hda_verb alc883_acer_eapd_verbs[] = {
7986 /* HP Pin: output 0 (0x0c) */
7987 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7988 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7989 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7990 /* Front Pin: output 0 (0x0c) */
7991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7992 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7993 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7994 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7995 /* eanable EAPD on medion laptop */
7996 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7997 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7998 /* enable unsolicited event */
7999 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8003 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8005 unsigned int present;
8007 present = snd_hda_codec_read(codec, 0x1b, 0,
8008 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8009 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8010 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8011 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8012 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8013 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8014 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8015 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8016 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8019 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8022 switch (res >> 26) {
8023 case ALC880_HP_EVENT:
8024 printk("hp_event\n");
8025 alc888_6st_dell_front_automute(codec);
8030 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8033 unsigned int present;
8035 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8036 present = snd_hda_codec_read(codec, 0x1b, 0,
8037 AC_VERB_GET_PIN_SENSE, 0);
8038 present = (present & 0x80000000) != 0;
8040 /* mute internal speaker */
8041 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8042 HDA_AMP_MUTE, HDA_AMP_MUTE);
8043 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8044 HDA_AMP_MUTE, HDA_AMP_MUTE);
8045 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8046 HDA_AMP_MUTE, HDA_AMP_MUTE);
8047 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8048 HDA_AMP_MUTE, HDA_AMP_MUTE);
8049 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8050 HDA_AMP_MUTE, HDA_AMP_MUTE);
8052 /* unmute internal speaker if necessary */
8053 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8054 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8055 HDA_AMP_MUTE, mute);
8056 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8057 HDA_AMP_MUTE, mute);
8058 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8059 HDA_AMP_MUTE, mute);
8060 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8061 HDA_AMP_MUTE, mute);
8062 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8063 HDA_AMP_MUTE, mute);
8067 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8070 if ((res >> 26) == ALC880_HP_EVENT)
8071 alc888_lenovo_sky_front_automute(codec);
8075 * generic initialization of ADC, input mixers and output mixers
8077 static struct hda_verb alc883_auto_init_verbs[] = {
8079 * Unmute ADC0-2 and set the default input to mic-in
8081 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8082 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8083 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8084 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8086 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8088 * Note: PASD motherboards uses the Line In 2 as the input for
8089 * front panel mic (mic 2)
8091 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8092 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8093 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8094 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8099 * Set up output mixers (0x0c - 0x0f)
8101 /* set vol=0 to output mixers */
8102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8103 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8104 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8106 /* set up input amps for analog loopback */
8107 /* Amp Indices: DAC = 0, mixer = 1 */
8108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8110 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8111 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8112 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8113 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8114 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8115 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8116 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8117 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8119 /* FIXME: use matrix-type input source selection */
8120 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8122 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8123 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8125 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8131 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8137 /* capture mixer elements */
8138 static struct snd_kcontrol_new alc883_capture_mixer[] = {
8139 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8140 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8141 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
8142 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
8144 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8145 /* The multiple "Capture Source" controls confuse alsamixer
8146 * So call somewhat different..
8148 /* .name = "Capture Source", */
8149 .name = "Input Source",
8151 .info = alc882_mux_enum_info,
8152 .get = alc882_mux_enum_get,
8153 .put = alc882_mux_enum_put,
8158 static struct hda_verb alc888_asus_m90v_verbs[] = {
8159 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8160 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8161 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8162 /* enable unsolicited event */
8163 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8164 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8168 static void alc883_nb_mic_automute(struct hda_codec *codec)
8170 unsigned int present;
8172 present = snd_hda_codec_read(codec, 0x18, 0,
8173 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8174 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8175 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8176 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8177 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8180 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8182 unsigned int present;
8185 present = snd_hda_codec_read(codec, 0x1b, 0,
8186 AC_VERB_GET_PIN_SENSE, 0)
8187 & AC_PINSENSE_PRESENCE;
8188 bits = present ? 0 : PIN_OUT;
8189 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8191 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8193 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8197 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8200 switch (res >> 26) {
8201 case ALC880_HP_EVENT:
8202 alc883_M90V_speaker_automute(codec);
8204 case ALC880_MIC_EVENT:
8205 alc883_nb_mic_automute(codec);
8210 static void alc883_mode2_inithook(struct hda_codec *codec)
8212 alc883_M90V_speaker_automute(codec);
8213 alc883_nb_mic_automute(codec);
8216 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8220 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8221 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8222 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8223 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8224 /* enable unsolicited event */
8225 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8229 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8231 unsigned int present;
8234 present = snd_hda_codec_read(codec, 0x14, 0,
8235 AC_VERB_GET_PIN_SENSE, 0)
8236 & AC_PINSENSE_PRESENCE;
8237 bits = present ? 0 : PIN_OUT;
8238 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8242 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8245 switch (res >> 26) {
8246 case ALC880_HP_EVENT:
8247 alc883_eee1601_speaker_automute(codec);
8252 static void alc883_eee1601_inithook(struct hda_codec *codec)
8254 alc883_eee1601_speaker_automute(codec);
8257 #ifdef CONFIG_SND_HDA_POWER_SAVE
8258 #define alc883_loopbacks alc880_loopbacks
8261 /* pcm configuration: identiacal with ALC880 */
8262 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8263 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8264 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8265 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8266 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8269 * configuration and preset
8271 static const char *alc883_models[ALC883_MODEL_LAST] = {
8272 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8273 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8274 [ALC883_3ST_6ch] = "3stack-6ch",
8275 [ALC883_6ST_DIG] = "6stack-dig",
8276 [ALC883_TARGA_DIG] = "targa-dig",
8277 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8278 [ALC883_ACER] = "acer",
8279 [ALC883_ACER_ASPIRE] = "acer-aspire",
8280 [ALC883_MEDION] = "medion",
8281 [ALC883_MEDION_MD2] = "medion-md2",
8282 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8283 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8284 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8285 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8286 [ALC888_LENOVO_SKY] = "lenovo-sky",
8287 [ALC883_HAIER_W66] = "haier-w66",
8288 [ALC888_3ST_HP] = "3stack-hp",
8289 [ALC888_6ST_DELL] = "6stack-dell",
8290 [ALC883_MITAC] = "mitac",
8291 [ALC883_CLEVO_M720] = "clevo-m720",
8292 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8293 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8294 [ALC883_AUTO] = "auto",
8297 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8298 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8299 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8300 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8301 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8302 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8303 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8304 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8305 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8306 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8307 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8308 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8309 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8310 SND_PCI_QUIRK(0x1043, 0x8317, "Asus M90V", ALC888_ASUS_M90V),
8311 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8312 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8313 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8314 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8315 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8316 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8317 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8318 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8319 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8320 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8321 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8322 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8323 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8324 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8325 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8326 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8327 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8328 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8329 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8330 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8331 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8332 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8333 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8334 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8335 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8336 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8337 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8338 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8339 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8340 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8341 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8342 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8343 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8344 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8345 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8346 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8347 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8348 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8349 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8350 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8351 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8352 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8353 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8354 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8355 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8356 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8357 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8358 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8362 static struct alc_config_preset alc883_presets[] = {
8363 [ALC883_3ST_2ch_DIG] = {
8364 .mixers = { alc883_3ST_2ch_mixer },
8365 .init_verbs = { alc883_init_verbs },
8366 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8367 .dac_nids = alc883_dac_nids,
8368 .dig_out_nid = ALC883_DIGOUT_NID,
8369 .dig_in_nid = ALC883_DIGIN_NID,
8370 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8371 .channel_mode = alc883_3ST_2ch_modes,
8372 .input_mux = &alc883_capture_source,
8374 [ALC883_3ST_6ch_DIG] = {
8375 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8376 .init_verbs = { alc883_init_verbs },
8377 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8378 .dac_nids = alc883_dac_nids,
8379 .dig_out_nid = ALC883_DIGOUT_NID,
8380 .dig_in_nid = ALC883_DIGIN_NID,
8381 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8382 .channel_mode = alc883_3ST_6ch_modes,
8384 .input_mux = &alc883_capture_source,
8386 [ALC883_3ST_6ch] = {
8387 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8388 .init_verbs = { alc883_init_verbs },
8389 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8390 .dac_nids = alc883_dac_nids,
8391 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8392 .channel_mode = alc883_3ST_6ch_modes,
8394 .input_mux = &alc883_capture_source,
8396 [ALC883_3ST_6ch_INTEL] = {
8397 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8398 .init_verbs = { alc883_init_verbs },
8399 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8400 .dac_nids = alc883_dac_nids,
8401 .dig_out_nid = ALC883_DIGOUT_NID,
8402 .dig_in_nid = ALC883_DIGIN_NID,
8403 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8404 .channel_mode = alc883_3ST_6ch_intel_modes,
8406 .input_mux = &alc883_3stack_6ch_intel,
8408 [ALC883_6ST_DIG] = {
8409 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8410 .init_verbs = { alc883_init_verbs },
8411 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8412 .dac_nids = alc883_dac_nids,
8413 .dig_out_nid = ALC883_DIGOUT_NID,
8414 .dig_in_nid = ALC883_DIGIN_NID,
8415 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8416 .channel_mode = alc883_sixstack_modes,
8417 .input_mux = &alc883_capture_source,
8419 [ALC883_TARGA_DIG] = {
8420 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8421 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8422 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8423 .dac_nids = alc883_dac_nids,
8424 .dig_out_nid = ALC883_DIGOUT_NID,
8425 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8426 .channel_mode = alc883_3ST_6ch_modes,
8428 .input_mux = &alc883_capture_source,
8429 .unsol_event = alc883_tagra_unsol_event,
8430 .init_hook = alc883_tagra_automute,
8432 [ALC883_TARGA_2ch_DIG] = {
8433 .mixers = { alc883_tagra_2ch_mixer},
8434 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8435 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8436 .dac_nids = alc883_dac_nids,
8437 .dig_out_nid = ALC883_DIGOUT_NID,
8438 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8439 .channel_mode = alc883_3ST_2ch_modes,
8440 .input_mux = &alc883_capture_source,
8441 .unsol_event = alc883_tagra_unsol_event,
8442 .init_hook = alc883_tagra_automute,
8445 .mixers = { alc883_base_mixer },
8446 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8447 * and the headphone jack. Turn this on and rely on the
8448 * standard mute methods whenever the user wants to turn
8449 * these outputs off.
8451 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8452 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8453 .dac_nids = alc883_dac_nids,
8454 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8455 .channel_mode = alc883_3ST_2ch_modes,
8456 .input_mux = &alc883_capture_source,
8458 [ALC883_ACER_ASPIRE] = {
8459 .mixers = { alc883_acer_aspire_mixer },
8460 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8461 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8462 .dac_nids = alc883_dac_nids,
8463 .dig_out_nid = ALC883_DIGOUT_NID,
8464 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8465 .channel_mode = alc883_3ST_2ch_modes,
8466 .input_mux = &alc883_capture_source,
8467 .unsol_event = alc883_acer_aspire_unsol_event,
8468 .init_hook = alc883_acer_aspire_automute,
8471 .mixers = { alc883_fivestack_mixer,
8472 alc883_chmode_mixer },
8473 .init_verbs = { alc883_init_verbs,
8474 alc883_medion_eapd_verbs },
8475 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8476 .dac_nids = alc883_dac_nids,
8477 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8478 .channel_mode = alc883_sixstack_modes,
8479 .input_mux = &alc883_capture_source,
8481 [ALC883_MEDION_MD2] = {
8482 .mixers = { alc883_medion_md2_mixer},
8483 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8484 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8485 .dac_nids = alc883_dac_nids,
8486 .dig_out_nid = ALC883_DIGOUT_NID,
8487 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8488 .channel_mode = alc883_3ST_2ch_modes,
8489 .input_mux = &alc883_capture_source,
8490 .unsol_event = alc883_medion_md2_unsol_event,
8491 .init_hook = alc883_medion_md2_automute,
8493 [ALC883_LAPTOP_EAPD] = {
8494 .mixers = { alc883_base_mixer },
8495 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8496 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8497 .dac_nids = alc883_dac_nids,
8498 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8499 .channel_mode = alc883_3ST_2ch_modes,
8500 .input_mux = &alc883_capture_source,
8502 [ALC883_CLEVO_M720] = {
8503 .mixers = { alc883_clevo_m720_mixer },
8504 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8505 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8506 .dac_nids = alc883_dac_nids,
8507 .dig_out_nid = ALC883_DIGOUT_NID,
8508 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8509 .channel_mode = alc883_3ST_2ch_modes,
8510 .input_mux = &alc883_capture_source,
8511 .unsol_event = alc883_clevo_m720_unsol_event,
8512 .init_hook = alc883_clevo_m720_automute,
8514 [ALC883_LENOVO_101E_2ch] = {
8515 .mixers = { alc883_lenovo_101e_2ch_mixer},
8516 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8517 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8518 .dac_nids = alc883_dac_nids,
8519 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8520 .channel_mode = alc883_3ST_2ch_modes,
8521 .input_mux = &alc883_lenovo_101e_capture_source,
8522 .unsol_event = alc883_lenovo_101e_unsol_event,
8523 .init_hook = alc883_lenovo_101e_all_automute,
8525 [ALC883_LENOVO_NB0763] = {
8526 .mixers = { alc883_lenovo_nb0763_mixer },
8527 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8528 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8529 .dac_nids = alc883_dac_nids,
8530 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8531 .channel_mode = alc883_3ST_2ch_modes,
8533 .input_mux = &alc883_lenovo_nb0763_capture_source,
8534 .unsol_event = alc883_medion_md2_unsol_event,
8535 .init_hook = alc883_medion_md2_automute,
8537 [ALC888_LENOVO_MS7195_DIG] = {
8538 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8539 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8540 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8541 .dac_nids = alc883_dac_nids,
8542 .dig_out_nid = ALC883_DIGOUT_NID,
8543 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8544 .channel_mode = alc883_3ST_6ch_modes,
8546 .input_mux = &alc883_capture_source,
8547 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8548 .init_hook = alc888_lenovo_ms7195_front_automute,
8550 [ALC883_HAIER_W66] = {
8551 .mixers = { alc883_tagra_2ch_mixer},
8552 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8553 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8554 .dac_nids = alc883_dac_nids,
8555 .dig_out_nid = ALC883_DIGOUT_NID,
8556 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8557 .channel_mode = alc883_3ST_2ch_modes,
8558 .input_mux = &alc883_capture_source,
8559 .unsol_event = alc883_haier_w66_unsol_event,
8560 .init_hook = alc883_haier_w66_automute,
8563 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8564 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8565 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8566 .dac_nids = alc883_dac_nids,
8567 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8568 .channel_mode = alc888_3st_hp_modes,
8570 .input_mux = &alc883_capture_source,
8572 [ALC888_6ST_DELL] = {
8573 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8574 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8575 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8576 .dac_nids = alc883_dac_nids,
8577 .dig_out_nid = ALC883_DIGOUT_NID,
8578 .dig_in_nid = ALC883_DIGIN_NID,
8579 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8580 .channel_mode = alc883_sixstack_modes,
8581 .input_mux = &alc883_capture_source,
8582 .unsol_event = alc888_6st_dell_unsol_event,
8583 .init_hook = alc888_6st_dell_front_automute,
8586 .mixers = { alc883_mitac_mixer },
8587 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8588 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8589 .dac_nids = alc883_dac_nids,
8590 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8591 .channel_mode = alc883_3ST_2ch_modes,
8592 .input_mux = &alc883_capture_source,
8593 .unsol_event = alc883_mitac_unsol_event,
8594 .init_hook = alc883_mitac_automute,
8596 [ALC883_FUJITSU_PI2515] = {
8597 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8598 .init_verbs = { alc883_init_verbs,
8599 alc883_2ch_fujitsu_pi2515_verbs},
8600 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8601 .dac_nids = alc883_dac_nids,
8602 .dig_out_nid = ALC883_DIGOUT_NID,
8603 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8604 .channel_mode = alc883_3ST_2ch_modes,
8605 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8606 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8607 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8609 [ALC888_LENOVO_SKY] = {
8610 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8611 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8612 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8613 .dac_nids = alc883_dac_nids,
8614 .dig_out_nid = ALC883_DIGOUT_NID,
8615 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
8616 .adc_nids = alc883_adc_nids,
8617 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8618 .channel_mode = alc883_sixstack_modes,
8620 .input_mux = &alc883_lenovo_sky_capture_source,
8621 .unsol_event = alc883_lenovo_sky_unsol_event,
8622 .init_hook = alc888_lenovo_sky_front_automute,
8624 [ALC888_ASUS_M90V] = {
8625 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8626 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8628 .dac_nids = alc883_dac_nids,
8629 .dig_out_nid = ALC883_DIGOUT_NID,
8630 .dig_in_nid = ALC883_DIGIN_NID,
8631 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8632 .channel_mode = alc883_3ST_6ch_modes,
8634 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8635 .unsol_event = alc883_mode2_unsol_event,
8636 .init_hook = alc883_mode2_inithook,
8638 [ALC888_ASUS_EEE1601] = {
8639 .mixers = { alc883_asus_eee1601_mixer },
8640 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8641 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8642 .dac_nids = alc883_dac_nids,
8643 .dig_out_nid = ALC883_DIGOUT_NID,
8644 .dig_in_nid = ALC883_DIGIN_NID,
8645 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8646 .channel_mode = alc883_3ST_2ch_modes,
8648 .input_mux = &alc883_asus_eee1601_capture_source,
8649 .unsol_event = alc883_eee1601_unsol_event,
8650 .init_hook = alc883_eee1601_inithook,
8656 * BIOS auto configuration
8658 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8659 hda_nid_t nid, int pin_type,
8663 struct alc_spec *spec = codec->spec;
8666 alc_set_pin_output(codec, nid, pin_type);
8667 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8670 idx = spec->multiout.dac_nids[dac_idx] - 2;
8671 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8675 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8677 struct alc_spec *spec = codec->spec;
8680 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8681 for (i = 0; i <= HDA_SIDE; i++) {
8682 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8683 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8685 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8690 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8692 struct alc_spec *spec = codec->spec;
8695 pin = spec->autocfg.hp_pins[0];
8696 if (pin) /* connect to front */
8698 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8699 pin = spec->autocfg.speaker_pins[0];
8701 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8704 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8705 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8707 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8709 struct alc_spec *spec = codec->spec;
8712 for (i = 0; i < AUTO_PIN_LAST; i++) {
8713 hda_nid_t nid = spec->autocfg.input_pins[i];
8714 if (alc883_is_input_pin(nid)) {
8715 snd_hda_codec_write(codec, nid, 0,
8716 AC_VERB_SET_PIN_WIDGET_CONTROL,
8717 (i <= AUTO_PIN_FRONT_MIC ?
8718 PIN_VREF80 : PIN_IN));
8719 if (nid != ALC883_PIN_CD_NID)
8720 snd_hda_codec_write(codec, nid, 0,
8721 AC_VERB_SET_AMP_GAIN_MUTE,
8727 #define alc883_auto_init_input_src alc882_auto_init_input_src
8729 /* almost identical with ALC880 parser... */
8730 static int alc883_parse_auto_config(struct hda_codec *codec)
8732 struct alc_spec *spec = codec->spec;
8733 int err = alc880_parse_auto_config(codec);
8738 return 0; /* no config found */
8740 err = alc_auto_add_mic_boost(codec);
8744 /* hack - override the init verbs */
8745 spec->init_verbs[0] = alc883_auto_init_verbs;
8746 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8749 return 1; /* config found */
8752 /* additional initialization for auto-configuration model */
8753 static void alc883_auto_init(struct hda_codec *codec)
8755 struct alc_spec *spec = codec->spec;
8756 alc883_auto_init_multi_out(codec);
8757 alc883_auto_init_hp_out(codec);
8758 alc883_auto_init_analog_input(codec);
8759 alc883_auto_init_input_src(codec);
8760 if (spec->unsol_event)
8761 alc_sku_automute(codec);
8764 static int patch_alc883(struct hda_codec *codec)
8766 struct alc_spec *spec;
8767 int err, board_config;
8769 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8775 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8777 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8780 if (board_config < 0) {
8781 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8782 "trying auto-probe from BIOS...\n");
8783 board_config = ALC883_AUTO;
8786 if (board_config == ALC883_AUTO) {
8787 /* automatic parse from the BIOS config */
8788 err = alc883_parse_auto_config(codec);
8794 "hda_codec: Cannot set up configuration "
8795 "from BIOS. Using base mode...\n");
8796 board_config = ALC883_3ST_2ch_DIG;
8800 if (board_config != ALC883_AUTO)
8801 setup_preset(spec, &alc883_presets[board_config]);
8803 switch (codec->vendor_id) {
8805 spec->stream_name_analog = "ALC888 Analog";
8806 spec->stream_name_digital = "ALC888 Digital";
8809 spec->stream_name_analog = "ALC889 Analog";
8810 spec->stream_name_digital = "ALC889 Digital";
8813 spec->stream_name_analog = "ALC883 Analog";
8814 spec->stream_name_digital = "ALC883 Digital";
8818 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8819 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8820 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8822 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8823 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8825 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8826 spec->adc_nids = alc883_adc_nids;
8827 spec->capsrc_nids = alc883_capsrc_nids;
8829 spec->vmaster_nid = 0x0c;
8831 codec->patch_ops = alc_patch_ops;
8832 if (board_config == ALC883_AUTO)
8833 spec->init_hook = alc883_auto_init;
8835 #ifdef CONFIG_SND_HDA_POWER_SAVE
8836 if (!spec->loopback.amplist)
8837 spec->loopback.amplist = alc883_loopbacks;
8847 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8848 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8850 #define alc262_dac_nids alc260_dac_nids
8851 #define alc262_adc_nids alc882_adc_nids
8852 #define alc262_adc_nids_alt alc882_adc_nids_alt
8853 #define alc262_capsrc_nids alc882_capsrc_nids
8854 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8856 #define alc262_modes alc260_modes
8857 #define alc262_capture_source alc882_capture_source
8859 static hda_nid_t alc262_dmic_adc_nids[1] = {
8864 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8866 static struct snd_kcontrol_new alc262_base_mixer[] = {
8867 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8868 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8875 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8876 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8877 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8878 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8879 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8880 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8881 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8883 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8884 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8888 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8889 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8890 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8891 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8892 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8893 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8894 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8897 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8898 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8900 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8901 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8902 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8903 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8904 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8908 /* update HP, line and mono-out pins according to the master switch */
8909 static void alc262_hp_master_update(struct hda_codec *codec)
8911 struct alc_spec *spec = codec->spec;
8912 int val = spec->master_sw;
8915 snd_hda_codec_write_cache(codec, 0x1b, 0,
8916 AC_VERB_SET_PIN_WIDGET_CONTROL,
8918 snd_hda_codec_write_cache(codec, 0x15, 0,
8919 AC_VERB_SET_PIN_WIDGET_CONTROL,
8921 /* mono (speaker) depending on the HP jack sense */
8922 val = val && !spec->jack_present;
8923 snd_hda_codec_write_cache(codec, 0x16, 0,
8924 AC_VERB_SET_PIN_WIDGET_CONTROL,
8928 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8930 struct alc_spec *spec = codec->spec;
8931 unsigned int presence;
8932 presence = snd_hda_codec_read(codec, 0x1b, 0,
8933 AC_VERB_GET_PIN_SENSE, 0);
8934 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8935 alc262_hp_master_update(codec);
8938 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8940 if ((res >> 26) != ALC880_HP_EVENT)
8942 alc262_hp_bpc_automute(codec);
8945 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8947 struct alc_spec *spec = codec->spec;
8948 unsigned int presence;
8949 presence = snd_hda_codec_read(codec, 0x15, 0,
8950 AC_VERB_GET_PIN_SENSE, 0);
8951 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8952 alc262_hp_master_update(codec);
8955 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8958 if ((res >> 26) != ALC880_HP_EVENT)
8960 alc262_hp_wildwest_automute(codec);
8963 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8964 struct snd_ctl_elem_value *ucontrol)
8966 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8967 struct alc_spec *spec = codec->spec;
8968 *ucontrol->value.integer.value = spec->master_sw;
8972 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8973 struct snd_ctl_elem_value *ucontrol)
8975 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8976 struct alc_spec *spec = codec->spec;
8977 int val = !!*ucontrol->value.integer.value;
8979 if (val == spec->master_sw)
8981 spec->master_sw = val;
8982 alc262_hp_master_update(codec);
8986 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8988 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8989 .name = "Master Playback Switch",
8990 .info = snd_ctl_boolean_mono_info,
8991 .get = alc262_hp_master_sw_get,
8992 .put = alc262_hp_master_sw_put,
8994 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8995 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8997 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8999 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9001 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9003 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9004 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9005 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9006 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9007 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9008 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9009 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9010 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9011 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9012 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9013 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9014 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9018 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9021 .name = "Master Playback Switch",
9022 .info = snd_ctl_boolean_mono_info,
9023 .get = alc262_hp_master_sw_get,
9024 .put = alc262_hp_master_sw_put,
9026 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9027 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9028 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9030 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9032 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9034 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9035 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9036 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9037 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9038 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9039 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9040 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9041 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9042 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9046 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9047 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9048 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9049 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9053 /* mute/unmute internal speaker according to the hp jack and mute state */
9054 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9056 struct alc_spec *spec = codec->spec;
9058 if (force || !spec->sense_updated) {
9059 unsigned int present;
9060 present = snd_hda_codec_read(codec, 0x15, 0,
9061 AC_VERB_GET_PIN_SENSE, 0);
9062 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9063 spec->sense_updated = 1;
9065 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9066 spec->jack_present ? HDA_AMP_MUTE : 0);
9069 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9072 if ((res >> 26) != ALC880_HP_EVENT)
9074 alc262_hp_t5735_automute(codec, 1);
9077 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9079 alc262_hp_t5735_automute(codec, 1);
9082 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9083 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9084 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9085 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9087 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9088 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9089 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9093 static struct hda_verb alc262_hp_t5735_verbs[] = {
9094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9097 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9101 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9102 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9104 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9105 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9111 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9112 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9113 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9114 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9116 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9117 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9118 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9119 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9120 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9121 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9125 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9132 /* bind hp and internal speaker mute (with plug check) */
9133 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9134 struct snd_ctl_elem_value *ucontrol)
9136 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9137 long *valp = ucontrol->value.integer.value;
9140 /* change hp mute */
9141 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9143 valp[0] ? 0 : HDA_AMP_MUTE);
9144 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9146 valp[1] ? 0 : HDA_AMP_MUTE);
9148 /* change speaker according to HP jack state */
9149 struct alc_spec *spec = codec->spec;
9151 if (spec->jack_present)
9152 mute = HDA_AMP_MUTE;
9154 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9156 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9157 HDA_AMP_MUTE, mute);
9162 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9163 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9166 .name = "Master Playback Switch",
9167 .info = snd_hda_mixer_amp_switch_info,
9168 .get = snd_hda_mixer_amp_switch_get,
9169 .put = alc262_sony_master_sw_put,
9170 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9174 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9175 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9179 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9180 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9181 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9185 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9186 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9190 #define alc262_capture_mixer alc882_capture_mixer
9191 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9194 * generic initialization of ADC, input mixers and output mixers
9196 static struct hda_verb alc262_init_verbs[] = {
9198 * Unmute ADC0-2 and set the default input to mic-in
9200 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9201 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9202 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9203 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9204 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9205 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9207 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9209 * Note: PASD motherboards uses the Line In 2 as the input for
9210 * front panel mic (mic 2)
9212 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9220 * Set up output mixers (0x0c - 0x0e)
9222 /* set vol=0 to output mixers */
9223 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9224 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9225 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9226 /* set up input amps for analog loopback */
9227 /* Amp Indices: DAC = 0, mixer = 1 */
9228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9231 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9232 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9233 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9237 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9238 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9240 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9242 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9244 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9245 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9246 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9248 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9249 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9251 /* FIXME: use matrix-type input source selection */
9252 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9253 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9255 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9272 static struct hda_verb alc262_eapd_verbs[] = {
9273 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9274 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9278 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9279 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9284 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9285 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9286 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9287 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9289 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9290 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9294 static struct hda_verb alc262_sony_unsol_verbs[] = {
9295 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9296 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9297 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9299 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9300 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9304 static struct hda_input_mux alc262_dmic_capture_source = {
9307 { "Int DMic", 0x9 },
9312 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9313 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9314 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9318 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9319 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9321 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9322 /* The multiple "Capture Source" controls confuse alsamixer
9323 * So call somewhat different..
9325 /* .name = "Capture Source", */
9326 .name = "Input Source",
9328 .info = alc_mux_enum_info,
9329 .get = alc_mux_enum_get,
9330 .put = alc_mux_enum_put,
9335 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9336 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9339 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9340 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9342 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9343 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9347 static void alc262_dmic_automute(struct hda_codec *codec)
9349 unsigned int present;
9351 present = snd_hda_codec_read(codec, 0x18, 0,
9352 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9353 snd_hda_codec_write(codec, 0x22, 0,
9354 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9357 /* toggle speaker-output according to the hp-jack state */
9358 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9360 unsigned int present;
9363 present = snd_hda_codec_read(codec, 0x15, 0,
9364 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9365 bits = present ? 0 : PIN_OUT;
9366 snd_hda_codec_write(codec, 0x14, 0,
9367 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9372 /* unsolicited event for HP jack sensing */
9373 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9376 if ((res >> 26) == ALC880_HP_EVENT)
9377 alc262_toshiba_s06_speaker_automute(codec);
9378 if ((res >> 26) == ALC880_MIC_EVENT)
9379 alc262_dmic_automute(codec);
9383 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9385 alc262_toshiba_s06_speaker_automute(codec);
9386 alc262_dmic_automute(codec);
9389 /* mute/unmute internal speaker according to the hp jack and mute state */
9390 static void alc262_hippo_automute(struct hda_codec *codec)
9392 struct alc_spec *spec = codec->spec;
9394 unsigned int present;
9396 /* need to execute and sync at first */
9397 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9398 present = snd_hda_codec_read(codec, 0x15, 0,
9399 AC_VERB_GET_PIN_SENSE, 0);
9400 spec->jack_present = (present & 0x80000000) != 0;
9401 if (spec->jack_present) {
9402 /* mute internal speaker */
9403 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9404 HDA_AMP_MUTE, HDA_AMP_MUTE);
9406 /* unmute internal speaker if necessary */
9407 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9408 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9409 HDA_AMP_MUTE, mute);
9413 /* unsolicited event for HP jack sensing */
9414 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9417 if ((res >> 26) != ALC880_HP_EVENT)
9419 alc262_hippo_automute(codec);
9422 static void alc262_hippo1_automute(struct hda_codec *codec)
9425 unsigned int present;
9427 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9428 present = snd_hda_codec_read(codec, 0x1b, 0,
9429 AC_VERB_GET_PIN_SENSE, 0);
9430 present = (present & 0x80000000) != 0;
9432 /* mute internal speaker */
9433 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9434 HDA_AMP_MUTE, HDA_AMP_MUTE);
9436 /* unmute internal speaker if necessary */
9437 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9438 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9439 HDA_AMP_MUTE, mute);
9443 /* unsolicited event for HP jack sensing */
9444 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9447 if ((res >> 26) != ALC880_HP_EVENT)
9449 alc262_hippo1_automute(codec);
9455 * 0x16 = internal speaker
9456 * 0x18 = external mic
9459 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9460 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9461 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9465 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9467 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9472 static struct hda_verb alc262_nec_verbs[] = {
9473 /* Unmute Speaker */
9474 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9477 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9478 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9480 /* External mic to headphone */
9481 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9482 /* External mic to speaker */
9483 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9489 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9490 * 0x1b = port replicator headphone out
9493 #define ALC_HP_EVENT 0x37
9495 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9496 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9498 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9499 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9503 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9504 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9505 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9509 static struct hda_input_mux alc262_fujitsu_capture_source = {
9518 static struct hda_input_mux alc262_HP_capture_source = {
9522 { "Front Mic", 0x1 },
9529 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9533 { "Front Mic", 0x2 },
9539 /* mute/unmute internal speaker according to the hp jacks and mute state */
9540 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9542 struct alc_spec *spec = codec->spec;
9545 if (force || !spec->sense_updated) {
9546 unsigned int present;
9547 /* need to execute and sync at first */
9548 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9549 /* check laptop HP jack */
9550 present = snd_hda_codec_read(codec, 0x14, 0,
9551 AC_VERB_GET_PIN_SENSE, 0);
9552 /* need to execute and sync at first */
9553 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9554 /* check docking HP jack */
9555 present |= snd_hda_codec_read(codec, 0x1b, 0,
9556 AC_VERB_GET_PIN_SENSE, 0);
9557 if (present & AC_PINSENSE_PRESENCE)
9558 spec->jack_present = 1;
9560 spec->jack_present = 0;
9561 spec->sense_updated = 1;
9563 /* unmute internal speaker only if both HPs are unplugged and
9564 * master switch is on
9566 if (spec->jack_present)
9567 mute = HDA_AMP_MUTE;
9569 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9570 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9571 HDA_AMP_MUTE, mute);
9574 /* unsolicited event for HP jack sensing */
9575 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9578 if ((res >> 26) != ALC_HP_EVENT)
9580 alc262_fujitsu_automute(codec, 1);
9583 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9585 alc262_fujitsu_automute(codec, 1);
9588 /* bind volumes of both NID 0x0c and 0x0d */
9589 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9590 .ops = &snd_hda_bind_vol,
9592 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9593 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9598 /* mute/unmute internal speaker according to the hp jack and mute state */
9599 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9601 struct alc_spec *spec = codec->spec;
9604 if (force || !spec->sense_updated) {
9605 unsigned int present_int_hp;
9606 /* need to execute and sync at first */
9607 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9608 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9609 AC_VERB_GET_PIN_SENSE, 0);
9610 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9611 spec->sense_updated = 1;
9613 if (spec->jack_present) {
9614 /* mute internal speaker */
9615 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9616 HDA_AMP_MUTE, HDA_AMP_MUTE);
9617 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9618 HDA_AMP_MUTE, HDA_AMP_MUTE);
9620 /* unmute internal speaker if necessary */
9621 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9622 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9623 HDA_AMP_MUTE, mute);
9624 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9625 HDA_AMP_MUTE, mute);
9629 /* unsolicited event for HP jack sensing */
9630 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9633 if ((res >> 26) != ALC_HP_EVENT)
9635 alc262_lenovo_3000_automute(codec, 1);
9638 /* bind hp and internal speaker mute (with plug check) */
9639 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9640 struct snd_ctl_elem_value *ucontrol)
9642 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9643 long *valp = ucontrol->value.integer.value;
9646 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9648 valp ? 0 : HDA_AMP_MUTE);
9649 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9651 valp ? 0 : HDA_AMP_MUTE);
9654 alc262_fujitsu_automute(codec, 0);
9658 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9659 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9661 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9662 .name = "Master Playback Switch",
9663 .info = snd_hda_mixer_amp_switch_info,
9664 .get = snd_hda_mixer_amp_switch_get,
9665 .put = alc262_fujitsu_master_sw_put,
9666 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9668 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9669 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9670 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9671 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9672 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9675 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9676 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9677 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9681 /* bind hp and internal speaker mute (with plug check) */
9682 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9683 struct snd_ctl_elem_value *ucontrol)
9685 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9686 long *valp = ucontrol->value.integer.value;
9689 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9691 valp ? 0 : HDA_AMP_MUTE);
9694 alc262_lenovo_3000_automute(codec, 0);
9698 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9699 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9701 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9702 .name = "Master Playback Switch",
9703 .info = snd_hda_mixer_amp_switch_info,
9704 .get = snd_hda_mixer_amp_switch_get,
9705 .put = alc262_lenovo_3000_master_sw_put,
9706 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9708 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9709 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9710 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9712 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9713 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9714 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9715 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9719 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9720 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9722 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9723 .name = "Master Playback Switch",
9724 .info = snd_hda_mixer_amp_switch_info,
9725 .get = snd_hda_mixer_amp_switch_get,
9726 .put = alc262_sony_master_sw_put,
9727 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9731 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9732 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9733 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9734 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9738 /* additional init verbs for Benq laptops */
9739 static struct hda_verb alc262_EAPD_verbs[] = {
9740 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9741 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9745 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9746 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9747 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9749 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9750 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9754 /* Samsung Q1 Ultra Vista model setup */
9755 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9756 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9757 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9759 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9760 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9761 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9765 static struct hda_verb alc262_ultra_verbs[] = {
9767 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9768 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9769 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9771 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9774 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9777 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9778 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9779 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9780 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9782 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9783 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9784 /* ADC, choose mic */
9785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9786 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9787 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9788 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9789 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9792 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9793 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9794 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9798 /* mute/unmute internal speaker according to the hp jack and mute state */
9799 static void alc262_ultra_automute(struct hda_codec *codec)
9801 struct alc_spec *spec = codec->spec;
9805 /* auto-mute only when HP is used as HP */
9806 if (!spec->cur_mux[0]) {
9807 unsigned int present;
9808 /* need to execute and sync at first */
9809 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9810 present = snd_hda_codec_read(codec, 0x15, 0,
9811 AC_VERB_GET_PIN_SENSE, 0);
9812 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9813 if (spec->jack_present)
9814 mute = HDA_AMP_MUTE;
9816 /* mute/unmute internal speaker */
9817 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9818 HDA_AMP_MUTE, mute);
9819 /* mute/unmute HP */
9820 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9821 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9824 /* unsolicited event for HP jack sensing */
9825 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9828 if ((res >> 26) != ALC880_HP_EVENT)
9830 alc262_ultra_automute(codec);
9833 static struct hda_input_mux alc262_ultra_capture_source = {
9837 { "Headphone", 0x7 },
9841 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9842 struct snd_ctl_elem_value *ucontrol)
9844 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9845 struct alc_spec *spec = codec->spec;
9848 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9851 /* reprogram the HP pin as mic or HP according to the input source */
9852 snd_hda_codec_write_cache(codec, 0x15, 0,
9853 AC_VERB_SET_PIN_WIDGET_CONTROL,
9854 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9855 alc262_ultra_automute(codec); /* mute/unmute HP */
9859 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9860 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9861 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9864 .name = "Capture Source",
9865 .info = alc882_mux_enum_info,
9866 .get = alc882_mux_enum_get,
9867 .put = alc262_ultra_mux_enum_put,
9872 /* add playback controls from the parsed DAC table */
9873 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9874 const struct auto_pin_cfg *cfg)
9879 spec->multiout.num_dacs = 1; /* only use one dac */
9880 spec->multiout.dac_nids = spec->private_dac_nids;
9881 spec->multiout.dac_nids[0] = 2;
9883 nid = cfg->line_out_pins[0];
9885 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9886 "Front Playback Volume",
9887 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9890 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9891 "Front Playback Switch",
9892 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9897 nid = cfg->speaker_pins[0];
9900 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9901 "Speaker Playback Volume",
9902 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9906 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9907 "Speaker Playback Switch",
9908 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9913 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9914 "Speaker Playback Switch",
9915 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9921 nid = cfg->hp_pins[0];
9923 /* spec->multiout.hp_nid = 2; */
9925 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9926 "Headphone Playback Volume",
9927 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9931 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9932 "Headphone Playback Switch",
9933 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9938 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9939 "Headphone Playback Switch",
9940 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9949 /* identical with ALC880 */
9950 #define alc262_auto_create_analog_input_ctls \
9951 alc880_auto_create_analog_input_ctls
9954 * generic initialization of ADC, input mixers and output mixers
9956 static struct hda_verb alc262_volume_init_verbs[] = {
9958 * Unmute ADC0-2 and set the default input to mic-in
9960 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9961 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9962 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9963 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9964 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9965 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9967 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9969 * Note: PASD motherboards uses the Line In 2 as the input for
9970 * front panel mic (mic 2)
9972 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9976 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9977 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9980 * Set up output mixers (0x0c - 0x0f)
9982 /* set vol=0 to output mixers */
9983 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9984 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9985 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9987 /* set up input amps for analog loopback */
9988 /* Amp Indices: DAC = 0, mixer = 1 */
9989 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9990 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9991 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9992 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9993 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9994 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9996 /* FIXME: use matrix-type input source selection */
9997 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9998 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10002 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10017 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10019 * Unmute ADC0-2 and set the default input to mic-in
10021 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10023 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10025 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10026 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10028 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10030 * Note: PASD motherboards uses the Line In 2 as the input for
10031 * front panel mic (mic 2)
10033 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10043 * Set up output mixers (0x0c - 0x0e)
10045 /* set vol=0 to output mixers */
10046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10047 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10048 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10050 /* set up input amps for analog loopback */
10051 /* Amp Indices: DAC = 0, mixer = 1 */
10052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10054 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10056 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10059 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10061 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10063 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10066 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10067 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10069 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10070 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10071 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10072 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10073 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10075 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10076 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10077 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10079 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10080 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10083 /* FIXME: use matrix-type input source selection */
10084 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10085 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10089 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10101 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10106 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10108 * Unmute ADC0-2 and set the default input to mic-in
10110 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10112 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10113 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10114 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10115 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10117 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10119 * Note: PASD motherboards uses the Line In 2 as the input for front
10120 * panel mic (mic 2)
10122 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10123 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10124 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10132 * Set up output mixers (0x0c - 0x0e)
10134 /* set vol=0 to output mixers */
10135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10137 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10139 /* set up input amps for analog loopback */
10140 /* Amp Indices: DAC = 0, mixer = 1 */
10141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10142 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10143 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10149 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10150 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10151 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10152 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10153 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10154 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10155 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10157 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10158 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10160 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10163 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10164 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10165 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10166 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10167 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10168 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10170 /* FIXME: use matrix-type input source selection */
10171 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10172 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10173 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10174 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10175 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10176 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10177 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10178 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10179 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10181 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10182 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10183 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10184 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10185 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10186 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10191 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10194 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10197 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10202 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10204 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10205 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10206 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10208 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10211 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10214 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10215 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10220 #ifdef CONFIG_SND_HDA_POWER_SAVE
10221 #define alc262_loopbacks alc880_loopbacks
10224 /* pcm configuration: identiacal with ALC880 */
10225 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10226 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10227 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10228 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10231 * BIOS auto configuration
10233 static int alc262_parse_auto_config(struct hda_codec *codec)
10235 struct alc_spec *spec = codec->spec;
10237 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10239 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10243 if (!spec->autocfg.line_outs)
10244 return 0; /* can't find valid BIOS pin config */
10245 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10248 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10252 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10254 if (spec->autocfg.dig_out_pin)
10255 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10256 if (spec->autocfg.dig_in_pin)
10257 spec->dig_in_nid = ALC262_DIGIN_NID;
10259 if (spec->kctl_alloc)
10260 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10262 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
10263 spec->num_mux_defs = 1;
10264 spec->input_mux = &spec->private_imux;
10266 err = alc_auto_add_mic_boost(codec);
10273 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10274 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10275 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10276 #define alc262_auto_init_input_src alc882_auto_init_input_src
10279 /* init callback for auto-configuration model -- overriding the default init */
10280 static void alc262_auto_init(struct hda_codec *codec)
10282 struct alc_spec *spec = codec->spec;
10283 alc262_auto_init_multi_out(codec);
10284 alc262_auto_init_hp_out(codec);
10285 alc262_auto_init_analog_input(codec);
10286 alc262_auto_init_input_src(codec);
10287 if (spec->unsol_event)
10288 alc_sku_automute(codec);
10292 * configuration and preset
10294 static const char *alc262_models[ALC262_MODEL_LAST] = {
10295 [ALC262_BASIC] = "basic",
10296 [ALC262_HIPPO] = "hippo",
10297 [ALC262_HIPPO_1] = "hippo_1",
10298 [ALC262_FUJITSU] = "fujitsu",
10299 [ALC262_HP_BPC] = "hp-bpc",
10300 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10301 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10302 [ALC262_HP_RP5700] = "hp-rp5700",
10303 [ALC262_BENQ_ED8] = "benq",
10304 [ALC262_BENQ_T31] = "benq-t31",
10305 [ALC262_SONY_ASSAMD] = "sony-assamd",
10306 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10307 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10308 [ALC262_ULTRA] = "ultra",
10309 [ALC262_LENOVO_3000] = "lenovo-3000",
10310 [ALC262_NEC] = "nec",
10311 [ALC262_AUTO] = "auto",
10314 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10315 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10316 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10317 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10318 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10319 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10320 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10321 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10322 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10323 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10324 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10325 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10326 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10327 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10328 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10329 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10330 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10331 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10332 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10333 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10334 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10335 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10336 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10337 ALC262_HP_TC_T5735),
10338 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10339 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10340 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10341 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10342 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10343 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10344 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10345 ALC262_TOSHIBA_RX1),
10346 SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06),
10347 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10348 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10349 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10350 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10351 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10352 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10353 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10354 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10358 static struct alc_config_preset alc262_presets[] = {
10360 .mixers = { alc262_base_mixer },
10361 .init_verbs = { alc262_init_verbs },
10362 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10363 .dac_nids = alc262_dac_nids,
10365 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10366 .channel_mode = alc262_modes,
10367 .input_mux = &alc262_capture_source,
10370 .mixers = { alc262_base_mixer },
10371 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10372 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10373 .dac_nids = alc262_dac_nids,
10375 .dig_out_nid = ALC262_DIGOUT_NID,
10376 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10377 .channel_mode = alc262_modes,
10378 .input_mux = &alc262_capture_source,
10379 .unsol_event = alc262_hippo_unsol_event,
10380 .init_hook = alc262_hippo_automute,
10382 [ALC262_HIPPO_1] = {
10383 .mixers = { alc262_hippo1_mixer },
10384 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10385 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10386 .dac_nids = alc262_dac_nids,
10388 .dig_out_nid = ALC262_DIGOUT_NID,
10389 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10390 .channel_mode = alc262_modes,
10391 .input_mux = &alc262_capture_source,
10392 .unsol_event = alc262_hippo1_unsol_event,
10393 .init_hook = alc262_hippo1_automute,
10395 [ALC262_FUJITSU] = {
10396 .mixers = { alc262_fujitsu_mixer },
10397 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10398 alc262_fujitsu_unsol_verbs },
10399 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10400 .dac_nids = alc262_dac_nids,
10402 .dig_out_nid = ALC262_DIGOUT_NID,
10403 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10404 .channel_mode = alc262_modes,
10405 .input_mux = &alc262_fujitsu_capture_source,
10406 .unsol_event = alc262_fujitsu_unsol_event,
10407 .init_hook = alc262_fujitsu_init_hook,
10409 [ALC262_HP_BPC] = {
10410 .mixers = { alc262_HP_BPC_mixer },
10411 .init_verbs = { alc262_HP_BPC_init_verbs },
10412 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10413 .dac_nids = alc262_dac_nids,
10415 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10416 .channel_mode = alc262_modes,
10417 .input_mux = &alc262_HP_capture_source,
10418 .unsol_event = alc262_hp_bpc_unsol_event,
10419 .init_hook = alc262_hp_bpc_automute,
10421 [ALC262_HP_BPC_D7000_WF] = {
10422 .mixers = { alc262_HP_BPC_WildWest_mixer },
10423 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10424 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10425 .dac_nids = alc262_dac_nids,
10427 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10428 .channel_mode = alc262_modes,
10429 .input_mux = &alc262_HP_D7000_capture_source,
10430 .unsol_event = alc262_hp_wildwest_unsol_event,
10431 .init_hook = alc262_hp_wildwest_automute,
10433 [ALC262_HP_BPC_D7000_WL] = {
10434 .mixers = { alc262_HP_BPC_WildWest_mixer,
10435 alc262_HP_BPC_WildWest_option_mixer },
10436 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10437 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10438 .dac_nids = alc262_dac_nids,
10440 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10441 .channel_mode = alc262_modes,
10442 .input_mux = &alc262_HP_D7000_capture_source,
10443 .unsol_event = alc262_hp_wildwest_unsol_event,
10444 .init_hook = alc262_hp_wildwest_automute,
10446 [ALC262_HP_TC_T5735] = {
10447 .mixers = { alc262_hp_t5735_mixer },
10448 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10449 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10450 .dac_nids = alc262_dac_nids,
10452 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10453 .channel_mode = alc262_modes,
10454 .input_mux = &alc262_capture_source,
10455 .unsol_event = alc262_hp_t5735_unsol_event,
10456 .init_hook = alc262_hp_t5735_init_hook,
10458 [ALC262_HP_RP5700] = {
10459 .mixers = { alc262_hp_rp5700_mixer },
10460 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10461 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10462 .dac_nids = alc262_dac_nids,
10463 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10464 .channel_mode = alc262_modes,
10465 .input_mux = &alc262_hp_rp5700_capture_source,
10467 [ALC262_BENQ_ED8] = {
10468 .mixers = { alc262_base_mixer },
10469 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10470 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10471 .dac_nids = alc262_dac_nids,
10473 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10474 .channel_mode = alc262_modes,
10475 .input_mux = &alc262_capture_source,
10477 [ALC262_SONY_ASSAMD] = {
10478 .mixers = { alc262_sony_mixer },
10479 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10480 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10481 .dac_nids = alc262_dac_nids,
10483 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10484 .channel_mode = alc262_modes,
10485 .input_mux = &alc262_capture_source,
10486 .unsol_event = alc262_hippo_unsol_event,
10487 .init_hook = alc262_hippo_automute,
10489 [ALC262_BENQ_T31] = {
10490 .mixers = { alc262_benq_t31_mixer },
10491 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10492 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10493 .dac_nids = alc262_dac_nids,
10495 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10496 .channel_mode = alc262_modes,
10497 .input_mux = &alc262_capture_source,
10498 .unsol_event = alc262_hippo_unsol_event,
10499 .init_hook = alc262_hippo_automute,
10502 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
10503 .init_verbs = { alc262_ultra_verbs },
10504 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10505 .dac_nids = alc262_dac_nids,
10506 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10507 .channel_mode = alc262_modes,
10508 .input_mux = &alc262_ultra_capture_source,
10509 .adc_nids = alc262_adc_nids, /* ADC0 */
10510 .capsrc_nids = alc262_capsrc_nids,
10511 .num_adc_nids = 1, /* single ADC */
10512 .unsol_event = alc262_ultra_unsol_event,
10513 .init_hook = alc262_ultra_automute,
10515 [ALC262_LENOVO_3000] = {
10516 .mixers = { alc262_lenovo_3000_mixer },
10517 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10518 alc262_lenovo_3000_unsol_verbs },
10519 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10520 .dac_nids = alc262_dac_nids,
10522 .dig_out_nid = ALC262_DIGOUT_NID,
10523 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10524 .channel_mode = alc262_modes,
10525 .input_mux = &alc262_fujitsu_capture_source,
10526 .unsol_event = alc262_lenovo_3000_unsol_event,
10529 .mixers = { alc262_nec_mixer },
10530 .init_verbs = { alc262_nec_verbs },
10531 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10532 .dac_nids = alc262_dac_nids,
10534 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10535 .channel_mode = alc262_modes,
10536 .input_mux = &alc262_capture_source,
10538 [ALC262_TOSHIBA_S06] = {
10539 .mixers = { alc262_toshiba_s06_mixer },
10540 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10541 alc262_eapd_verbs },
10542 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10543 .capsrc_nids = alc262_dmic_capsrc_nids,
10544 .dac_nids = alc262_dac_nids,
10545 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10546 .dig_out_nid = ALC262_DIGOUT_NID,
10547 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10548 .channel_mode = alc262_modes,
10549 .input_mux = &alc262_dmic_capture_source,
10550 .unsol_event = alc262_toshiba_s06_unsol_event,
10551 .init_hook = alc262_toshiba_s06_init_hook,
10553 [ALC262_TOSHIBA_RX1] = {
10554 .mixers = { alc262_toshiba_rx1_mixer },
10555 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10556 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10557 .dac_nids = alc262_dac_nids,
10559 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10560 .channel_mode = alc262_modes,
10561 .input_mux = &alc262_capture_source,
10562 .unsol_event = alc262_hippo_unsol_event,
10563 .init_hook = alc262_hippo_automute,
10567 static int patch_alc262(struct hda_codec *codec)
10569 struct alc_spec *spec;
10573 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10577 codec->spec = spec;
10579 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10584 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10585 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10586 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10587 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10591 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10593 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10597 if (board_config < 0) {
10598 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10599 "trying auto-probe from BIOS...\n");
10600 board_config = ALC262_AUTO;
10603 if (board_config == ALC262_AUTO) {
10604 /* automatic parse from the BIOS config */
10605 err = alc262_parse_auto_config(codec);
10611 "hda_codec: Cannot set up configuration "
10612 "from BIOS. Using base mode...\n");
10613 board_config = ALC262_BASIC;
10617 if (board_config != ALC262_AUTO)
10618 setup_preset(spec, &alc262_presets[board_config]);
10620 spec->stream_name_analog = "ALC262 Analog";
10621 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10622 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10624 spec->stream_name_digital = "ALC262 Digital";
10625 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10626 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10628 if (!spec->adc_nids && spec->input_mux) {
10629 /* check whether NID 0x07 is valid */
10630 unsigned int wcap = get_wcaps(codec, 0x07);
10633 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10634 if (wcap != AC_WID_AUD_IN) {
10635 spec->adc_nids = alc262_adc_nids_alt;
10636 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10637 spec->capsrc_nids = alc262_capsrc_nids_alt;
10638 spec->mixers[spec->num_mixers] =
10639 alc262_capture_alt_mixer;
10640 spec->num_mixers++;
10642 spec->adc_nids = alc262_adc_nids;
10643 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10644 spec->capsrc_nids = alc262_capsrc_nids;
10645 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
10646 spec->num_mixers++;
10650 spec->vmaster_nid = 0x0c;
10652 codec->patch_ops = alc_patch_ops;
10653 if (board_config == ALC262_AUTO)
10654 spec->init_hook = alc262_auto_init;
10655 #ifdef CONFIG_SND_HDA_POWER_SAVE
10656 if (!spec->loopback.amplist)
10657 spec->loopback.amplist = alc262_loopbacks;
10664 * ALC268 channel source setting (2 channel)
10666 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10667 #define alc268_modes alc260_modes
10669 static hda_nid_t alc268_dac_nids[2] = {
10674 static hda_nid_t alc268_adc_nids[2] = {
10679 static hda_nid_t alc268_adc_nids_alt[1] = {
10684 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10686 static struct snd_kcontrol_new alc268_base_mixer[] = {
10687 /* output mixer control */
10688 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10689 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10690 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10692 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10693 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10694 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10698 /* bind Beep switches of both NID 0x0f and 0x10 */
10699 static struct hda_bind_ctls alc268_bind_beep_sw = {
10700 .ops = &snd_hda_bind_sw,
10702 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10703 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10708 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10709 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10710 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10714 static struct hda_verb alc268_eapd_verbs[] = {
10715 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10716 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10720 /* Toshiba specific */
10721 #define alc268_toshiba_automute alc262_hippo_automute
10723 static struct hda_verb alc268_toshiba_verbs[] = {
10724 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10728 static struct hda_input_mux alc268_acer_lc_capture_source = {
10736 /* Acer specific */
10737 /* bind volumes of both NID 0x02 and 0x03 */
10738 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10739 .ops = &snd_hda_bind_vol,
10741 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10742 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10747 /* mute/unmute internal speaker according to the hp jack and mute state */
10748 static void alc268_acer_automute(struct hda_codec *codec, int force)
10750 struct alc_spec *spec = codec->spec;
10753 if (force || !spec->sense_updated) {
10754 unsigned int present;
10755 present = snd_hda_codec_read(codec, 0x14, 0,
10756 AC_VERB_GET_PIN_SENSE, 0);
10757 spec->jack_present = (present & 0x80000000) != 0;
10758 spec->sense_updated = 1;
10760 if (spec->jack_present)
10761 mute = HDA_AMP_MUTE; /* mute internal speaker */
10762 else /* unmute internal speaker if necessary */
10763 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10764 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10765 HDA_AMP_MUTE, mute);
10769 /* bind hp and internal speaker mute (with plug check) */
10770 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10771 struct snd_ctl_elem_value *ucontrol)
10773 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10774 long *valp = ucontrol->value.integer.value;
10777 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10779 valp[0] ? 0 : HDA_AMP_MUTE);
10780 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10782 valp[1] ? 0 : HDA_AMP_MUTE);
10784 alc268_acer_automute(codec, 0);
10788 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10789 /* output mixer control */
10790 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10792 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10793 .name = "Master Playback Switch",
10794 .info = snd_hda_mixer_amp_switch_info,
10795 .get = snd_hda_mixer_amp_switch_get,
10796 .put = alc268_acer_master_sw_put,
10797 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10799 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10803 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10804 /* output mixer control */
10805 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10808 .name = "Master Playback Switch",
10809 .info = snd_hda_mixer_amp_switch_info,
10810 .get = snd_hda_mixer_amp_switch_get,
10811 .put = alc268_acer_master_sw_put,
10812 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10814 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10815 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10816 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10820 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10821 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10823 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10824 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10825 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10826 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10830 static struct hda_verb alc268_acer_verbs[] = {
10831 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10832 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10833 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10835 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10836 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10837 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10841 /* unsolicited event for HP jack sensing */
10842 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10845 if ((res >> 26) != ALC880_HP_EVENT)
10847 alc268_toshiba_automute(codec);
10850 static void alc268_acer_unsol_event(struct hda_codec *codec,
10853 if ((res >> 26) != ALC880_HP_EVENT)
10855 alc268_acer_automute(codec, 1);
10858 static void alc268_acer_init_hook(struct hda_codec *codec)
10860 alc268_acer_automute(codec, 1);
10863 /* toggle speaker-output according to the hp-jack state */
10864 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10866 unsigned int present;
10867 unsigned char bits;
10869 present = snd_hda_codec_read(codec, 0x15, 0,
10870 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10871 bits = present ? AMP_IN_MUTE(0) : 0;
10872 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10873 AMP_IN_MUTE(0), bits);
10874 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10875 AMP_IN_MUTE(0), bits);
10879 static void alc268_acer_mic_automute(struct hda_codec *codec)
10881 unsigned int present;
10883 present = snd_hda_codec_read(codec, 0x18, 0,
10884 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10885 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
10886 present ? 0x0 : 0x6);
10889 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
10892 if ((res >> 26) == ALC880_HP_EVENT)
10893 alc268_aspire_one_speaker_automute(codec);
10894 if ((res >> 26) == ALC880_MIC_EVENT)
10895 alc268_acer_mic_automute(codec);
10898 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
10900 alc268_aspire_one_speaker_automute(codec);
10901 alc268_acer_mic_automute(codec);
10904 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10905 /* output mixer control */
10906 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10907 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10910 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10911 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10915 static struct hda_verb alc268_dell_verbs[] = {
10916 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10917 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10918 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10922 /* mute/unmute internal speaker according to the hp jack and mute state */
10923 static void alc268_dell_automute(struct hda_codec *codec)
10925 unsigned int present;
10928 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10929 if (present & 0x80000000)
10930 mute = HDA_AMP_MUTE;
10932 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10933 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10934 HDA_AMP_MUTE, mute);
10937 static void alc268_dell_unsol_event(struct hda_codec *codec,
10940 if ((res >> 26) != ALC880_HP_EVENT)
10942 alc268_dell_automute(codec);
10945 #define alc268_dell_init_hook alc268_dell_automute
10947 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10948 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10949 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10950 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10952 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10953 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10954 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10955 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10959 static struct hda_verb alc267_quanta_il1_verbs[] = {
10960 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10961 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10965 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10967 unsigned int present;
10969 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10970 & AC_PINSENSE_PRESENCE;
10971 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10972 present ? 0 : PIN_OUT);
10975 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10977 unsigned int present;
10979 present = snd_hda_codec_read(codec, 0x18, 0,
10980 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10981 snd_hda_codec_write(codec, 0x23, 0,
10982 AC_VERB_SET_CONNECT_SEL,
10983 present ? 0x00 : 0x01);
10986 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10988 alc267_quanta_il1_hp_automute(codec);
10989 alc267_quanta_il1_mic_automute(codec);
10992 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10995 switch (res >> 26) {
10996 case ALC880_HP_EVENT:
10997 alc267_quanta_il1_hp_automute(codec);
10999 case ALC880_MIC_EVENT:
11000 alc267_quanta_il1_mic_automute(codec);
11006 * generic initialization of ADC, input mixers and output mixers
11008 static struct hda_verb alc268_base_init_verbs[] = {
11009 /* Unmute DAC0-1 and set vol = 0 */
11010 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11011 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11012 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11013 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11014 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11015 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11018 * Set up output mixers (0x0c - 0x0e)
11020 /* set vol=0 to output mixers */
11021 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11023 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11024 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11026 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11027 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11030 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11031 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11032 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11033 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11034 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11035 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11036 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11038 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11039 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11040 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11041 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11042 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11043 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11044 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11046 /* set PCBEEP vol = 0, mute connections */
11047 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11048 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11049 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11051 /* Unmute Selector 23h,24h and set the default input to mic-in */
11053 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11054 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11055 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11056 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11062 * generic initialization of ADC, input mixers and output mixers
11064 static struct hda_verb alc268_volume_init_verbs[] = {
11065 /* set output DAC */
11066 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11067 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11068 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11069 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11071 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11073 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11074 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11075 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11077 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11079 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11080 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11081 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11083 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11084 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11085 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11086 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11088 /* set PCBEEP vol = 0, mute connections */
11089 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11091 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11096 #define alc268_mux_enum_info alc_mux_enum_info
11097 #define alc268_mux_enum_get alc_mux_enum_get
11098 #define alc268_mux_enum_put alc_mux_enum_put
11100 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11101 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11102 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11105 /* The multiple "Capture Source" controls confuse alsamixer
11106 * So call somewhat different..
11108 /* .name = "Capture Source", */
11109 .name = "Input Source",
11111 .info = alc268_mux_enum_info,
11112 .get = alc268_mux_enum_get,
11113 .put = alc268_mux_enum_put,
11118 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11119 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11120 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11121 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11122 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11125 /* The multiple "Capture Source" controls confuse alsamixer
11126 * So call somewhat different..
11128 /* .name = "Capture Source", */
11129 .name = "Input Source",
11131 .info = alc268_mux_enum_info,
11132 .get = alc268_mux_enum_get,
11133 .put = alc268_mux_enum_put,
11138 static struct hda_input_mux alc268_capture_source = {
11142 { "Front Mic", 0x1 },
11148 static struct hda_input_mux alc268_acer_capture_source = {
11152 { "Internal Mic", 0x6 },
11157 #ifdef CONFIG_SND_DEBUG
11158 static struct snd_kcontrol_new alc268_test_mixer[] = {
11159 /* Volume widgets */
11160 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11161 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11162 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11163 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11164 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11165 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11166 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11167 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11168 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11169 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11170 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11171 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11172 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11173 /* The below appears problematic on some hardwares */
11174 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11175 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11176 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11177 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11178 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11180 /* Modes for retasking pin widgets */
11181 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11182 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11183 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11184 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11186 /* Controls for GPIO pins, assuming they are configured as outputs */
11187 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11188 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11189 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11190 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11192 /* Switches to allow the digital SPDIF output pin to be enabled.
11193 * The ALC268 does not have an SPDIF input.
11195 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11197 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11198 * this output to turn on an external amplifier.
11200 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11201 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11207 /* create input playback/capture controls for the given pin */
11208 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11209 const char *ctlname, int idx)
11214 sprintf(name, "%s Playback Volume", ctlname);
11216 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11217 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11221 } else if (nid == 0x15) {
11222 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11223 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11229 sprintf(name, "%s Playback Switch", ctlname);
11230 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11231 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11237 /* add playback controls from the parsed DAC table */
11238 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11239 const struct auto_pin_cfg *cfg)
11244 spec->multiout.num_dacs = 2; /* only use one dac */
11245 spec->multiout.dac_nids = spec->private_dac_nids;
11246 spec->multiout.dac_nids[0] = 2;
11247 spec->multiout.dac_nids[1] = 3;
11249 nid = cfg->line_out_pins[0];
11251 alc268_new_analog_output(spec, nid, "Front", 0);
11253 nid = cfg->speaker_pins[0];
11255 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11256 "Speaker Playback Volume",
11257 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11261 nid = cfg->hp_pins[0];
11263 alc268_new_analog_output(spec, nid, "Headphone", 0);
11265 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11267 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11268 "Mono Playback Switch",
11269 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11276 /* create playback/capture controls for input pins */
11277 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11278 const struct auto_pin_cfg *cfg)
11280 struct hda_input_mux *imux = &spec->private_imux;
11283 for (i = 0; i < AUTO_PIN_LAST; i++) {
11284 switch(cfg->input_pins[i]) {
11286 idx1 = 0; /* Mic 1 */
11289 idx1 = 1; /* Mic 2 */
11292 idx1 = 2; /* Line In */
11299 idx1 = 6; /* digital mics */
11304 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11305 imux->items[imux->num_items].index = idx1;
11311 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11313 struct alc_spec *spec = codec->spec;
11314 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11315 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11316 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11317 unsigned int dac_vol1, dac_vol2;
11320 snd_hda_codec_write(codec, speaker_nid, 0,
11321 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11322 snd_hda_codec_write(codec, 0x0f, 0,
11323 AC_VERB_SET_AMP_GAIN_MUTE,
11325 snd_hda_codec_write(codec, 0x10, 0,
11326 AC_VERB_SET_AMP_GAIN_MUTE,
11329 snd_hda_codec_write(codec, 0x0f, 0,
11330 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11331 snd_hda_codec_write(codec, 0x10, 0,
11332 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11335 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11336 if (line_nid == 0x14)
11337 dac_vol2 = AMP_OUT_ZERO;
11338 else if (line_nid == 0x15)
11339 dac_vol1 = AMP_OUT_ZERO;
11340 if (hp_nid == 0x14)
11341 dac_vol2 = AMP_OUT_ZERO;
11342 else if (hp_nid == 0x15)
11343 dac_vol1 = AMP_OUT_ZERO;
11344 if (line_nid != 0x16 || hp_nid != 0x16 ||
11345 spec->autocfg.line_out_pins[1] != 0x16 ||
11346 spec->autocfg.line_out_pins[2] != 0x16)
11347 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11349 snd_hda_codec_write(codec, 0x02, 0,
11350 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11351 snd_hda_codec_write(codec, 0x03, 0,
11352 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11355 /* pcm configuration: identiacal with ALC880 */
11356 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11357 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11358 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11359 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11362 * BIOS auto configuration
11364 static int alc268_parse_auto_config(struct hda_codec *codec)
11366 struct alc_spec *spec = codec->spec;
11368 static hda_nid_t alc268_ignore[] = { 0 };
11370 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11374 if (!spec->autocfg.line_outs)
11375 return 0; /* can't find valid BIOS pin config */
11377 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11380 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11384 spec->multiout.max_channels = 2;
11386 /* digital only support output */
11387 if (spec->autocfg.dig_out_pin)
11388 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11390 if (spec->kctl_alloc)
11391 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11393 if (spec->autocfg.speaker_pins[0] != 0x1d)
11394 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
11396 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
11397 spec->num_mux_defs = 1;
11398 spec->input_mux = &spec->private_imux;
11400 err = alc_auto_add_mic_boost(codec);
11407 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11408 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11409 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11411 /* init callback for auto-configuration model -- overriding the default init */
11412 static void alc268_auto_init(struct hda_codec *codec)
11414 struct alc_spec *spec = codec->spec;
11415 alc268_auto_init_multi_out(codec);
11416 alc268_auto_init_hp_out(codec);
11417 alc268_auto_init_mono_speaker_out(codec);
11418 alc268_auto_init_analog_input(codec);
11419 if (spec->unsol_event)
11420 alc_sku_automute(codec);
11424 * configuration and preset
11426 static const char *alc268_models[ALC268_MODEL_LAST] = {
11427 [ALC267_QUANTA_IL1] = "quanta-il1",
11428 [ALC268_3ST] = "3stack",
11429 [ALC268_TOSHIBA] = "toshiba",
11430 [ALC268_ACER] = "acer",
11431 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11432 [ALC268_DELL] = "dell",
11433 [ALC268_ZEPTO] = "zepto",
11434 #ifdef CONFIG_SND_DEBUG
11435 [ALC268_TEST] = "test",
11437 [ALC268_AUTO] = "auto",
11440 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11441 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11442 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11443 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11444 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11445 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11446 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11447 ALC268_ACER_ASPIRE_ONE),
11448 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11449 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11450 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11451 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11452 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11453 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11454 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11455 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11456 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11457 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11461 static struct alc_config_preset alc268_presets[] = {
11462 [ALC267_QUANTA_IL1] = {
11463 .mixers = { alc267_quanta_il1_mixer },
11464 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11465 alc267_quanta_il1_verbs },
11466 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11467 .dac_nids = alc268_dac_nids,
11468 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11469 .adc_nids = alc268_adc_nids_alt,
11471 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11472 .channel_mode = alc268_modes,
11473 .input_mux = &alc268_capture_source,
11474 .unsol_event = alc267_quanta_il1_unsol_event,
11475 .init_hook = alc267_quanta_il1_automute,
11478 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11479 alc268_beep_mixer },
11480 .init_verbs = { alc268_base_init_verbs },
11481 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11482 .dac_nids = alc268_dac_nids,
11483 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11484 .adc_nids = alc268_adc_nids_alt,
11485 .capsrc_nids = alc268_capsrc_nids,
11487 .dig_out_nid = ALC268_DIGOUT_NID,
11488 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11489 .channel_mode = alc268_modes,
11490 .input_mux = &alc268_capture_source,
11492 [ALC268_TOSHIBA] = {
11493 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11494 alc268_beep_mixer },
11495 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11496 alc268_toshiba_verbs },
11497 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11498 .dac_nids = alc268_dac_nids,
11499 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11500 .adc_nids = alc268_adc_nids_alt,
11501 .capsrc_nids = alc268_capsrc_nids,
11503 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11504 .channel_mode = alc268_modes,
11505 .input_mux = &alc268_capture_source,
11506 .unsol_event = alc268_toshiba_unsol_event,
11507 .init_hook = alc268_toshiba_automute,
11510 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11511 alc268_beep_mixer },
11512 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11513 alc268_acer_verbs },
11514 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11515 .dac_nids = alc268_dac_nids,
11516 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11517 .adc_nids = alc268_adc_nids_alt,
11518 .capsrc_nids = alc268_capsrc_nids,
11520 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11521 .channel_mode = alc268_modes,
11522 .input_mux = &alc268_acer_capture_source,
11523 .unsol_event = alc268_acer_unsol_event,
11524 .init_hook = alc268_acer_init_hook,
11526 [ALC268_ACER_ASPIRE_ONE] = {
11527 .mixers = { alc268_acer_aspire_one_mixer,
11528 alc268_capture_alt_mixer },
11529 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11530 alc268_acer_aspire_one_verbs },
11531 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11532 .dac_nids = alc268_dac_nids,
11533 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11534 .adc_nids = alc268_adc_nids_alt,
11535 .capsrc_nids = alc268_capsrc_nids,
11537 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11538 .channel_mode = alc268_modes,
11539 .input_mux = &alc268_acer_lc_capture_source,
11540 .unsol_event = alc268_acer_lc_unsol_event,
11541 .init_hook = alc268_acer_lc_init_hook,
11544 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11545 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11546 alc268_dell_verbs },
11547 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11548 .dac_nids = alc268_dac_nids,
11550 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11551 .channel_mode = alc268_modes,
11552 .unsol_event = alc268_dell_unsol_event,
11553 .init_hook = alc268_dell_init_hook,
11554 .input_mux = &alc268_capture_source,
11557 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11558 alc268_beep_mixer },
11559 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11560 alc268_toshiba_verbs },
11561 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11562 .dac_nids = alc268_dac_nids,
11563 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11564 .adc_nids = alc268_adc_nids_alt,
11565 .capsrc_nids = alc268_capsrc_nids,
11567 .dig_out_nid = ALC268_DIGOUT_NID,
11568 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11569 .channel_mode = alc268_modes,
11570 .input_mux = &alc268_capture_source,
11571 .unsol_event = alc268_toshiba_unsol_event,
11572 .init_hook = alc268_toshiba_automute
11574 #ifdef CONFIG_SND_DEBUG
11576 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11577 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11578 alc268_volume_init_verbs },
11579 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11580 .dac_nids = alc268_dac_nids,
11581 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11582 .adc_nids = alc268_adc_nids_alt,
11583 .capsrc_nids = alc268_capsrc_nids,
11585 .dig_out_nid = ALC268_DIGOUT_NID,
11586 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11587 .channel_mode = alc268_modes,
11588 .input_mux = &alc268_capture_source,
11593 static int patch_alc268(struct hda_codec *codec)
11595 struct alc_spec *spec;
11599 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11603 codec->spec = spec;
11605 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11609 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11610 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11611 "trying auto-probe from BIOS...\n");
11612 board_config = ALC268_AUTO;
11615 if (board_config == ALC268_AUTO) {
11616 /* automatic parse from the BIOS config */
11617 err = alc268_parse_auto_config(codec);
11623 "hda_codec: Cannot set up configuration "
11624 "from BIOS. Using base mode...\n");
11625 board_config = ALC268_3ST;
11629 if (board_config != ALC268_AUTO)
11630 setup_preset(spec, &alc268_presets[board_config]);
11632 if (codec->vendor_id == 0x10ec0267) {
11633 spec->stream_name_analog = "ALC267 Analog";
11634 spec->stream_name_digital = "ALC267 Digital";
11636 spec->stream_name_analog = "ALC268 Analog";
11637 spec->stream_name_digital = "ALC268 Digital";
11640 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11641 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11642 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11644 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11646 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11647 /* override the amp caps for beep generator */
11648 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11649 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11650 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11651 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11652 (0 << AC_AMPCAP_MUTE_SHIFT));
11654 if (!spec->adc_nids && spec->input_mux) {
11655 /* check whether NID 0x07 is valid */
11656 unsigned int wcap = get_wcaps(codec, 0x07);
11660 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11661 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11662 spec->adc_nids = alc268_adc_nids_alt;
11663 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11664 spec->mixers[spec->num_mixers] =
11665 alc268_capture_alt_mixer;
11666 spec->num_mixers++;
11668 spec->adc_nids = alc268_adc_nids;
11669 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11670 spec->mixers[spec->num_mixers] =
11671 alc268_capture_mixer;
11672 spec->num_mixers++;
11674 spec->capsrc_nids = alc268_capsrc_nids;
11675 /* set default input source */
11676 for (i = 0; i < spec->num_adc_nids; i++)
11677 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11678 0, AC_VERB_SET_CONNECT_SEL,
11679 spec->input_mux->items[0].index);
11682 spec->vmaster_nid = 0x02;
11684 codec->patch_ops = alc_patch_ops;
11685 if (board_config == ALC268_AUTO)
11686 spec->init_hook = alc268_auto_init;
11692 * ALC269 channel source setting (2 channel)
11694 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11696 #define alc269_dac_nids alc260_dac_nids
11698 static hda_nid_t alc269_adc_nids[1] = {
11703 static hda_nid_t alc269_capsrc_nids[1] = {
11707 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11711 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11719 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11727 #define alc269_modes alc260_modes
11728 #define alc269_capture_source alc880_lg_lw_capture_source
11730 static struct snd_kcontrol_new alc269_base_mixer[] = {
11731 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11732 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11733 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11734 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11737 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11738 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11739 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11740 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11741 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11742 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11743 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11744 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11748 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11749 /* output mixer control */
11750 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11752 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11753 .name = "Master Playback Switch",
11754 .info = snd_hda_mixer_amp_switch_info,
11755 .get = snd_hda_mixer_amp_switch_get,
11756 .put = alc268_acer_master_sw_put,
11757 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11761 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11762 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11763 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11764 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11765 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11766 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11770 /* bind volumes of both NID 0x0c and 0x0d */
11771 static struct hda_bind_ctls alc269_epc_bind_vol = {
11772 .ops = &snd_hda_bind_vol,
11774 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11775 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11780 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11781 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11782 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11783 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11787 /* capture mixer elements */
11788 static struct snd_kcontrol_new alc269_capture_mixer[] = {
11789 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11790 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11792 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11793 /* The multiple "Capture Source" controls confuse alsamixer
11794 * So call somewhat different..
11796 /* .name = "Capture Source", */
11797 .name = "Input Source",
11799 .info = alc_mux_enum_info,
11800 .get = alc_mux_enum_get,
11801 .put = alc_mux_enum_put,
11806 /* capture mixer elements */
11807 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11808 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11809 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11814 static struct snd_kcontrol_new alc269_beep_mixer[] = {
11815 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11816 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11820 static struct hda_verb alc269_quanta_fl1_verbs[] = {
11821 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11822 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11823 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11824 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11825 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11826 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11830 /* toggle speaker-output according to the hp-jack state */
11831 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11833 unsigned int present;
11834 unsigned char bits;
11836 present = snd_hda_codec_read(codec, 0x15, 0,
11837 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11838 bits = present ? AMP_IN_MUTE(0) : 0;
11839 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11840 AMP_IN_MUTE(0), bits);
11841 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11842 AMP_IN_MUTE(0), bits);
11844 snd_hda_codec_write(codec, 0x20, 0,
11845 AC_VERB_SET_COEF_INDEX, 0x0c);
11846 snd_hda_codec_write(codec, 0x20, 0,
11847 AC_VERB_SET_PROC_COEF, 0x680);
11849 snd_hda_codec_write(codec, 0x20, 0,
11850 AC_VERB_SET_COEF_INDEX, 0x0c);
11851 snd_hda_codec_write(codec, 0x20, 0,
11852 AC_VERB_SET_PROC_COEF, 0x480);
11855 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11857 unsigned int present;
11859 present = snd_hda_codec_read(codec, 0x18, 0,
11860 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11861 snd_hda_codec_write(codec, 0x23, 0,
11862 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11865 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11868 if ((res >> 26) == ALC880_HP_EVENT)
11869 alc269_quanta_fl1_speaker_automute(codec);
11870 if ((res >> 26) == ALC880_MIC_EVENT)
11871 alc269_quanta_fl1_mic_automute(codec);
11874 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
11876 alc269_quanta_fl1_speaker_automute(codec);
11877 alc269_quanta_fl1_mic_automute(codec);
11880 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11881 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11882 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
11883 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11884 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
11885 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11886 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11887 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11891 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11892 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11893 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
11894 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11895 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
11896 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11897 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11901 /* toggle speaker-output according to the hp-jack state */
11902 static void alc269_speaker_automute(struct hda_codec *codec)
11904 unsigned int present;
11905 unsigned char bits;
11907 present = snd_hda_codec_read(codec, 0x15, 0,
11908 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11909 bits = present ? AMP_IN_MUTE(0) : 0;
11910 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11911 AMP_IN_MUTE(0), bits);
11912 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11913 AMP_IN_MUTE(0), bits);
11916 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11918 unsigned int present;
11920 present = snd_hda_codec_read(codec, 0x18, 0,
11921 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11922 snd_hda_codec_write(codec, 0x23, 0,
11923 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
11926 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11928 unsigned int present;
11930 present = snd_hda_codec_read(codec, 0x18, 0,
11931 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11932 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11933 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11934 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11935 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11938 /* unsolicited event for HP jack sensing */
11939 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11942 if ((res >> 26) == ALC880_HP_EVENT)
11943 alc269_speaker_automute(codec);
11945 if ((res >> 26) == ALC880_MIC_EVENT)
11946 alc269_eeepc_dmic_automute(codec);
11949 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11951 alc269_speaker_automute(codec);
11952 alc269_eeepc_dmic_automute(codec);
11955 /* unsolicited event for HP jack sensing */
11956 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
11959 if ((res >> 26) == ALC880_HP_EVENT)
11960 alc269_speaker_automute(codec);
11962 if ((res >> 26) == ALC880_MIC_EVENT)
11963 alc269_eeepc_amic_automute(codec);
11966 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
11968 alc269_speaker_automute(codec);
11969 alc269_eeepc_amic_automute(codec);
11973 * generic initialization of ADC, input mixers and output mixers
11975 static struct hda_verb alc269_init_verbs[] = {
11977 * Unmute ADC0 and set the default input to mic-in
11979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11981 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11982 * analog-loopback mixer widget
11983 * Note: PASD motherboards uses the Line In 2 as the input for
11984 * front panel mic (mic 2)
11986 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11990 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11994 * Set up output mixers (0x0c - 0x0e)
11996 /* set vol=0 to output mixers */
11997 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11998 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12000 /* set up input amps for analog loopback */
12001 /* Amp Indices: DAC = 0, mixer = 1 */
12002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12004 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12005 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12006 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12007 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12009 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12012 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12013 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12014 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12015 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12017 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12018 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12019 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12020 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12021 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12022 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12023 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12025 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12026 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12028 /* FIXME: use matrix-type input source selection */
12029 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12030 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12033 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12034 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12037 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12038 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12042 /* add playback controls from the parsed DAC table */
12043 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12044 const struct auto_pin_cfg *cfg)
12049 spec->multiout.num_dacs = 1; /* only use one dac */
12050 spec->multiout.dac_nids = spec->private_dac_nids;
12051 spec->multiout.dac_nids[0] = 2;
12053 nid = cfg->line_out_pins[0];
12055 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12056 "Front Playback Volume",
12057 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12060 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12061 "Front Playback Switch",
12062 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12067 nid = cfg->speaker_pins[0];
12069 if (!cfg->line_out_pins[0]) {
12070 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12071 "Speaker Playback Volume",
12072 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12078 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12079 "Speaker Playback Switch",
12080 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12085 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12086 "Speaker Playback Switch",
12087 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12093 nid = cfg->hp_pins[0];
12095 /* spec->multiout.hp_nid = 2; */
12096 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12097 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12098 "Headphone Playback Volume",
12099 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12105 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12106 "Headphone Playback Switch",
12107 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12112 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12113 "Headphone Playback Switch",
12114 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12123 #define alc269_auto_create_analog_input_ctls \
12124 alc880_auto_create_analog_input_ctls
12126 #ifdef CONFIG_SND_HDA_POWER_SAVE
12127 #define alc269_loopbacks alc880_loopbacks
12130 /* pcm configuration: identiacal with ALC880 */
12131 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12132 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12133 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12134 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12137 * BIOS auto configuration
12139 static int alc269_parse_auto_config(struct hda_codec *codec)
12141 struct alc_spec *spec = codec->spec;
12143 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12145 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12150 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12153 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12157 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12159 if (spec->autocfg.dig_out_pin)
12160 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12162 if (spec->kctl_alloc)
12163 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12165 /* create a beep mixer control if the pin 0x1d isn't assigned */
12166 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12167 if (spec->autocfg.input_pins[i] == 0x1d)
12169 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12170 spec->mixers[spec->num_mixers++] = alc269_beep_mixer;
12172 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
12173 spec->num_mux_defs = 1;
12174 spec->input_mux = &spec->private_imux;
12175 /* set default input source */
12176 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12177 0, AC_VERB_SET_CONNECT_SEL,
12178 spec->input_mux->items[0].index);
12180 err = alc_auto_add_mic_boost(codec);
12184 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
12185 spec->num_mixers++;
12190 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12191 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12192 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12195 /* init callback for auto-configuration model -- overriding the default init */
12196 static void alc269_auto_init(struct hda_codec *codec)
12198 struct alc_spec *spec = codec->spec;
12199 alc269_auto_init_multi_out(codec);
12200 alc269_auto_init_hp_out(codec);
12201 alc269_auto_init_analog_input(codec);
12202 if (spec->unsol_event)
12203 alc_sku_automute(codec);
12207 * configuration and preset
12209 static const char *alc269_models[ALC269_MODEL_LAST] = {
12210 [ALC269_BASIC] = "basic",
12211 [ALC269_QUANTA_FL1] = "quanta",
12212 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12213 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901"
12216 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12217 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12218 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12219 ALC269_ASUS_EEEPC_P703),
12220 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12221 ALC269_ASUS_EEEPC_P901),
12222 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12223 ALC269_ASUS_EEEPC_P901),
12227 static struct alc_config_preset alc269_presets[] = {
12229 .mixers = { alc269_base_mixer, alc269_capture_mixer },
12230 .init_verbs = { alc269_init_verbs },
12231 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12232 .dac_nids = alc269_dac_nids,
12234 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12235 .channel_mode = alc269_modes,
12236 .input_mux = &alc269_capture_source,
12238 [ALC269_QUANTA_FL1] = {
12239 .mixers = { alc269_quanta_fl1_mixer },
12240 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12241 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12242 .dac_nids = alc269_dac_nids,
12244 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12245 .channel_mode = alc269_modes,
12246 .input_mux = &alc269_capture_source,
12247 .unsol_event = alc269_quanta_fl1_unsol_event,
12248 .init_hook = alc269_quanta_fl1_init_hook,
12250 [ALC269_ASUS_EEEPC_P703] = {
12251 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer },
12252 .init_verbs = { alc269_init_verbs,
12253 alc269_eeepc_amic_init_verbs },
12254 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12255 .dac_nids = alc269_dac_nids,
12257 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12258 .channel_mode = alc269_modes,
12259 .input_mux = &alc269_eeepc_amic_capture_source,
12260 .unsol_event = alc269_eeepc_amic_unsol_event,
12261 .init_hook = alc269_eeepc_amic_inithook,
12263 [ALC269_ASUS_EEEPC_P901] = {
12264 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer},
12265 .init_verbs = { alc269_init_verbs,
12266 alc269_eeepc_dmic_init_verbs },
12267 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12268 .dac_nids = alc269_dac_nids,
12270 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12271 .channel_mode = alc269_modes,
12272 .input_mux = &alc269_eeepc_dmic_capture_source,
12273 .unsol_event = alc269_eeepc_dmic_unsol_event,
12274 .init_hook = alc269_eeepc_dmic_inithook,
12278 static int patch_alc269(struct hda_codec *codec)
12280 struct alc_spec *spec;
12284 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12288 codec->spec = spec;
12290 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12292 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12296 if (board_config < 0) {
12297 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12298 "trying auto-probe from BIOS...\n");
12299 board_config = ALC269_AUTO;
12302 if (board_config == ALC269_AUTO) {
12303 /* automatic parse from the BIOS config */
12304 err = alc269_parse_auto_config(codec);
12310 "hda_codec: Cannot set up configuration "
12311 "from BIOS. Using base mode...\n");
12312 board_config = ALC269_BASIC;
12316 if (board_config != ALC269_AUTO)
12317 setup_preset(spec, &alc269_presets[board_config]);
12319 spec->stream_name_analog = "ALC269 Analog";
12320 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12321 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12323 spec->stream_name_digital = "ALC269 Digital";
12324 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12325 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12327 spec->adc_nids = alc269_adc_nids;
12328 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12329 spec->capsrc_nids = alc269_capsrc_nids;
12331 codec->patch_ops = alc_patch_ops;
12332 if (board_config == ALC269_AUTO)
12333 spec->init_hook = alc269_auto_init;
12334 #ifdef CONFIG_SND_HDA_POWER_SAVE
12335 if (!spec->loopback.amplist)
12336 spec->loopback.amplist = alc269_loopbacks;
12343 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12347 * set the path ways for 2 channel output
12348 * need to set the codec line out and mic 1 pin widgets to inputs
12350 static struct hda_verb alc861_threestack_ch2_init[] = {
12351 /* set pin widget 1Ah (line in) for input */
12352 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12353 /* set pin widget 18h (mic1/2) for input, for mic also enable
12356 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12358 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12360 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12361 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12367 * need to set the codec line out and mic 1 pin widgets to outputs
12369 static struct hda_verb alc861_threestack_ch6_init[] = {
12370 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12371 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12372 /* set pin widget 18h (mic1) for output (CLFE)*/
12373 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12375 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12376 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12378 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12380 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12381 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12386 static struct hda_channel_mode alc861_threestack_modes[2] = {
12387 { 2, alc861_threestack_ch2_init },
12388 { 6, alc861_threestack_ch6_init },
12390 /* Set mic1 as input and unmute the mixer */
12391 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12392 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12393 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12396 /* Set mic1 as output and mute mixer */
12397 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12398 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12399 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12403 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12404 { 2, alc861_uniwill_m31_ch2_init },
12405 { 4, alc861_uniwill_m31_ch4_init },
12408 /* Set mic1 and line-in as input and unmute the mixer */
12409 static struct hda_verb alc861_asus_ch2_init[] = {
12410 /* set pin widget 1Ah (line in) for input */
12411 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12412 /* set pin widget 18h (mic1/2) for input, for mic also enable
12415 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12417 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12419 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12420 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12424 /* Set mic1 nad line-in as output and mute mixer */
12425 static struct hda_verb alc861_asus_ch6_init[] = {
12426 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12427 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12428 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12429 /* set pin widget 18h (mic1) for output (CLFE)*/
12430 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12431 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12432 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12433 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12435 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12437 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12438 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12443 static struct hda_channel_mode alc861_asus_modes[2] = {
12444 { 2, alc861_asus_ch2_init },
12445 { 6, alc861_asus_ch6_init },
12450 static struct snd_kcontrol_new alc861_base_mixer[] = {
12451 /* output mixer control */
12452 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12453 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12454 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12455 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12456 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12458 /*Input mixer control */
12459 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12460 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12461 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12462 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12463 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12464 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12466 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12470 /* Capture mixer control */
12471 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12472 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12474 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12475 .name = "Capture Source",
12477 .info = alc_mux_enum_info,
12478 .get = alc_mux_enum_get,
12479 .put = alc_mux_enum_put,
12484 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12485 /* output mixer control */
12486 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12487 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12488 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12489 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12490 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12492 /* Input mixer control */
12493 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12494 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12495 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12496 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12497 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12498 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12500 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12501 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12504 /* Capture mixer control */
12505 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12506 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12509 .name = "Capture Source",
12511 .info = alc_mux_enum_info,
12512 .get = alc_mux_enum_get,
12513 .put = alc_mux_enum_put,
12516 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12517 .name = "Channel Mode",
12518 .info = alc_ch_mode_info,
12519 .get = alc_ch_mode_get,
12520 .put = alc_ch_mode_put,
12521 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12526 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12527 /* output mixer control */
12528 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12530 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12532 /*Capture mixer control */
12533 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12534 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12536 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12537 .name = "Capture Source",
12539 .info = alc_mux_enum_info,
12540 .get = alc_mux_enum_get,
12541 .put = alc_mux_enum_put,
12547 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12548 /* output mixer control */
12549 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12550 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12551 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12552 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12553 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12555 /* Input mixer control */
12556 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12557 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12558 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12559 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12560 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12561 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12563 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12564 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12565 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12567 /* Capture mixer control */
12568 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12569 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12571 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12572 .name = "Capture Source",
12574 .info = alc_mux_enum_info,
12575 .get = alc_mux_enum_get,
12576 .put = alc_mux_enum_put,
12579 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12580 .name = "Channel Mode",
12581 .info = alc_ch_mode_info,
12582 .get = alc_ch_mode_get,
12583 .put = alc_ch_mode_put,
12584 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12589 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12590 /* output mixer control */
12591 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12592 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12593 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12594 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12595 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12597 /* Input mixer control */
12598 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12599 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12600 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12601 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12602 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12603 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12605 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12606 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12609 /* Capture mixer control */
12610 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12611 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12613 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12614 .name = "Capture Source",
12616 .info = alc_mux_enum_info,
12617 .get = alc_mux_enum_get,
12618 .put = alc_mux_enum_put,
12621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12622 .name = "Channel Mode",
12623 .info = alc_ch_mode_info,
12624 .get = alc_ch_mode_get,
12625 .put = alc_ch_mode_put,
12626 .private_value = ARRAY_SIZE(alc861_asus_modes),
12631 /* additional mixer */
12632 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12633 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12634 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12635 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12636 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12641 * generic initialization of ADC, input mixers and output mixers
12643 static struct hda_verb alc861_base_init_verbs[] = {
12645 * Unmute ADC0 and set the default input to mic-in
12647 /* port-A for surround (rear panel) */
12648 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12649 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
12650 /* port-B for mic-in (rear panel) with vref */
12651 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12652 /* port-C for line-in (rear panel) */
12653 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12654 /* port-D for Front */
12655 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12656 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12657 /* port-E for HP out (front panel) */
12658 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12659 /* route front PCM to HP */
12660 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12661 /* port-F for mic-in (front panel) with vref */
12662 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12663 /* port-G for CLFE (rear panel) */
12664 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12665 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12666 /* port-H for side (rear panel) */
12667 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12668 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
12670 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12671 /* route front mic to ADC1*/
12672 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12673 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12675 /* Unmute DAC0~3 & spdif out*/
12676 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12677 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12678 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12679 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12680 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12682 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12683 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12684 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12685 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12686 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12688 /* Unmute Stereo Mixer 15 */
12689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12694 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12695 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12696 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12697 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12698 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12699 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12700 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12701 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12702 /* hp used DAC 3 (Front) */
12703 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12704 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12709 static struct hda_verb alc861_threestack_init_verbs[] = {
12711 * Unmute ADC0 and set the default input to mic-in
12713 /* port-A for surround (rear panel) */
12714 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12715 /* port-B for mic-in (rear panel) with vref */
12716 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12717 /* port-C for line-in (rear panel) */
12718 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12719 /* port-D for Front */
12720 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12721 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12722 /* port-E for HP out (front panel) */
12723 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12724 /* route front PCM to HP */
12725 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12726 /* port-F for mic-in (front panel) with vref */
12727 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12728 /* port-G for CLFE (rear panel) */
12729 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12730 /* port-H for side (rear panel) */
12731 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12733 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12734 /* route front mic to ADC1*/
12735 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12736 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12737 /* Unmute DAC0~3 & spdif out*/
12738 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12739 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12740 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12741 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12744 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12745 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12746 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12747 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12748 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12750 /* Unmute Stereo Mixer 15 */
12751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12754 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12756 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12757 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12758 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12759 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12761 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12763 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12764 /* hp used DAC 3 (Front) */
12765 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12770 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
12772 * Unmute ADC0 and set the default input to mic-in
12774 /* port-A for surround (rear panel) */
12775 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12776 /* port-B for mic-in (rear panel) with vref */
12777 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12778 /* port-C for line-in (rear panel) */
12779 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12780 /* port-D for Front */
12781 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12782 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12783 /* port-E for HP out (front panel) */
12784 /* this has to be set to VREF80 */
12785 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12786 /* route front PCM to HP */
12787 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12788 /* port-F for mic-in (front panel) with vref */
12789 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12790 /* port-G for CLFE (rear panel) */
12791 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12792 /* port-H for side (rear panel) */
12793 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12795 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12796 /* route front mic to ADC1*/
12797 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12798 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12799 /* Unmute DAC0~3 & spdif out*/
12800 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12801 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12802 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12803 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12806 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12807 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12808 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12809 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12810 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12812 /* Unmute Stereo Mixer 15 */
12813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12815 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12818 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12819 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12820 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12822 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12826 /* hp used DAC 3 (Front) */
12827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12828 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12832 static struct hda_verb alc861_asus_init_verbs[] = {
12834 * Unmute ADC0 and set the default input to mic-in
12836 /* port-A for surround (rear panel)
12837 * according to codec#0 this is the HP jack
12839 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12840 /* route front PCM to HP */
12841 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12842 /* port-B for mic-in (rear panel) with vref */
12843 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12844 /* port-C for line-in (rear panel) */
12845 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12846 /* port-D for Front */
12847 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12848 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12849 /* port-E for HP out (front panel) */
12850 /* this has to be set to VREF80 */
12851 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12852 /* route front PCM to HP */
12853 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12854 /* port-F for mic-in (front panel) with vref */
12855 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12856 /* port-G for CLFE (rear panel) */
12857 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12858 /* port-H for side (rear panel) */
12859 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12861 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12862 /* route front mic to ADC1*/
12863 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12864 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12865 /* Unmute DAC0~3 & spdif out*/
12866 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12867 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12868 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12869 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12870 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12871 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12872 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12873 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12874 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12875 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12877 /* Unmute Stereo Mixer 15 */
12878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12885 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12886 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12887 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12888 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12889 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12890 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12891 /* hp used DAC 3 (Front) */
12892 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12897 /* additional init verbs for ASUS laptops */
12898 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
12899 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
12900 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
12905 * generic initialization of ADC, input mixers and output mixers
12907 static struct hda_verb alc861_auto_init_verbs[] = {
12909 * Unmute ADC0 and set the default input to mic-in
12911 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12912 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12914 /* Unmute DAC0~3 & spdif out*/
12915 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12916 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12917 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12918 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12921 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12922 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12923 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12924 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12925 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12927 /* Unmute Stereo Mixer 15 */
12928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
12933 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12934 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12935 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12936 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12937 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12938 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12939 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12940 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12942 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12944 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12946 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12947 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12948 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12949 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12951 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
12956 static struct hda_verb alc861_toshiba_init_verbs[] = {
12957 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12962 /* toggle speaker-output according to the hp-jack state */
12963 static void alc861_toshiba_automute(struct hda_codec *codec)
12965 unsigned int present;
12967 present = snd_hda_codec_read(codec, 0x0f, 0,
12968 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12969 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
12970 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12971 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
12972 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
12975 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
12978 if ((res >> 26) == ALC880_HP_EVENT)
12979 alc861_toshiba_automute(codec);
12982 /* pcm configuration: identiacal with ALC880 */
12983 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
12984 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
12985 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
12986 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
12989 #define ALC861_DIGOUT_NID 0x07
12991 static struct hda_channel_mode alc861_8ch_modes[1] = {
12995 static hda_nid_t alc861_dac_nids[4] = {
12996 /* front, surround, clfe, side */
12997 0x03, 0x06, 0x05, 0x04
13000 static hda_nid_t alc660_dac_nids[3] = {
13001 /* front, clfe, surround */
13005 static hda_nid_t alc861_adc_nids[1] = {
13010 static struct hda_input_mux alc861_capture_source = {
13014 { "Front Mic", 0x3 },
13021 /* fill in the dac_nids table from the parsed pin configuration */
13022 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13023 const struct auto_pin_cfg *cfg)
13028 spec->multiout.dac_nids = spec->private_dac_nids;
13029 for (i = 0; i < cfg->line_outs; i++) {
13030 nid = cfg->line_out_pins[i];
13032 if (i >= ARRAY_SIZE(alc861_dac_nids))
13034 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13037 spec->multiout.num_dacs = cfg->line_outs;
13041 /* add playback controls from the parsed DAC table */
13042 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13043 const struct auto_pin_cfg *cfg)
13046 static const char *chname[4] = {
13047 "Front", "Surround", NULL /*CLFE*/, "Side"
13052 for (i = 0; i < cfg->line_outs; i++) {
13053 nid = spec->multiout.dac_nids[i];
13058 err = add_control(spec, ALC_CTL_BIND_MUTE,
13059 "Center Playback Switch",
13060 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13064 err = add_control(spec, ALC_CTL_BIND_MUTE,
13065 "LFE Playback Switch",
13066 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13071 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13073 if (nid == alc861_dac_nids[idx])
13075 sprintf(name, "%s Playback Switch", chname[idx]);
13076 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13077 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13086 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13094 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13096 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13097 "Headphone Playback Switch",
13098 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13101 spec->multiout.hp_nid = nid;
13106 /* create playback/capture controls for input pins */
13107 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13108 const struct auto_pin_cfg *cfg)
13110 struct hda_input_mux *imux = &spec->private_imux;
13111 int i, err, idx, idx1;
13113 for (i = 0; i < AUTO_PIN_LAST; i++) {
13114 switch (cfg->input_pins[i]) {
13117 idx = 2; /* Line In */
13121 idx = 2; /* Line In */
13125 idx = 1; /* Mic In */
13129 idx = 1; /* Mic In */
13139 err = new_analog_input(spec, cfg->input_pins[i],
13140 auto_pin_cfg_labels[i], idx, 0x15);
13144 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13145 imux->items[imux->num_items].index = idx1;
13151 static struct snd_kcontrol_new alc861_capture_mixer[] = {
13152 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13153 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13156 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13157 /* The multiple "Capture Source" controls confuse alsamixer
13158 * So call somewhat different..
13160 /* .name = "Capture Source", */
13161 .name = "Input Source",
13163 .info = alc_mux_enum_info,
13164 .get = alc_mux_enum_get,
13165 .put = alc_mux_enum_put,
13170 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13172 int pin_type, int dac_idx)
13174 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13176 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13180 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13182 struct alc_spec *spec = codec->spec;
13185 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13186 for (i = 0; i < spec->autocfg.line_outs; i++) {
13187 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13188 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13190 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13191 spec->multiout.dac_nids[i]);
13195 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13197 struct alc_spec *spec = codec->spec;
13200 pin = spec->autocfg.hp_pins[0];
13201 if (pin) /* connect to front */
13202 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13203 spec->multiout.dac_nids[0]);
13204 pin = spec->autocfg.speaker_pins[0];
13206 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13209 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13211 struct alc_spec *spec = codec->spec;
13214 for (i = 0; i < AUTO_PIN_LAST; i++) {
13215 hda_nid_t nid = spec->autocfg.input_pins[i];
13216 if (nid >= 0x0c && nid <= 0x11) {
13217 snd_hda_codec_write(codec, nid, 0,
13218 AC_VERB_SET_PIN_WIDGET_CONTROL,
13219 i <= AUTO_PIN_FRONT_MIC ?
13220 PIN_VREF80 : PIN_IN);
13225 /* parse the BIOS configuration and set up the alc_spec */
13226 /* return 1 if successful, 0 if the proper config is not found,
13227 * or a negative error code
13229 static int alc861_parse_auto_config(struct hda_codec *codec)
13231 struct alc_spec *spec = codec->spec;
13233 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13235 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13239 if (!spec->autocfg.line_outs)
13240 return 0; /* can't find valid BIOS pin config */
13242 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13245 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13248 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13251 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13255 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13257 if (spec->autocfg.dig_out_pin)
13258 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13260 if (spec->kctl_alloc)
13261 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13263 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
13265 spec->num_mux_defs = 1;
13266 spec->input_mux = &spec->private_imux;
13268 spec->adc_nids = alc861_adc_nids;
13269 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13270 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
13271 spec->num_mixers++;
13276 /* additional initialization for auto-configuration model */
13277 static void alc861_auto_init(struct hda_codec *codec)
13279 struct alc_spec *spec = codec->spec;
13280 alc861_auto_init_multi_out(codec);
13281 alc861_auto_init_hp_out(codec);
13282 alc861_auto_init_analog_input(codec);
13283 if (spec->unsol_event)
13284 alc_sku_automute(codec);
13287 #ifdef CONFIG_SND_HDA_POWER_SAVE
13288 static struct hda_amp_list alc861_loopbacks[] = {
13289 { 0x15, HDA_INPUT, 0 },
13290 { 0x15, HDA_INPUT, 1 },
13291 { 0x15, HDA_INPUT, 2 },
13292 { 0x15, HDA_INPUT, 3 },
13299 * configuration and preset
13301 static const char *alc861_models[ALC861_MODEL_LAST] = {
13302 [ALC861_3ST] = "3stack",
13303 [ALC660_3ST] = "3stack-660",
13304 [ALC861_3ST_DIG] = "3stack-dig",
13305 [ALC861_6ST_DIG] = "6stack-dig",
13306 [ALC861_UNIWILL_M31] = "uniwill-m31",
13307 [ALC861_TOSHIBA] = "toshiba",
13308 [ALC861_ASUS] = "asus",
13309 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13310 [ALC861_AUTO] = "auto",
13313 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13314 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13315 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13316 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13317 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13318 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13319 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13320 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13321 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13322 * Any other models that need this preset?
13324 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13325 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13326 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13327 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13328 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13329 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13330 /* FIXME: the below seems conflict */
13331 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13332 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13333 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13337 static struct alc_config_preset alc861_presets[] = {
13339 .mixers = { alc861_3ST_mixer },
13340 .init_verbs = { alc861_threestack_init_verbs },
13341 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13342 .dac_nids = alc861_dac_nids,
13343 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13344 .channel_mode = alc861_threestack_modes,
13346 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13347 .adc_nids = alc861_adc_nids,
13348 .input_mux = &alc861_capture_source,
13350 [ALC861_3ST_DIG] = {
13351 .mixers = { alc861_base_mixer },
13352 .init_verbs = { alc861_threestack_init_verbs },
13353 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13354 .dac_nids = alc861_dac_nids,
13355 .dig_out_nid = ALC861_DIGOUT_NID,
13356 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13357 .channel_mode = alc861_threestack_modes,
13359 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13360 .adc_nids = alc861_adc_nids,
13361 .input_mux = &alc861_capture_source,
13363 [ALC861_6ST_DIG] = {
13364 .mixers = { alc861_base_mixer },
13365 .init_verbs = { alc861_base_init_verbs },
13366 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13367 .dac_nids = alc861_dac_nids,
13368 .dig_out_nid = ALC861_DIGOUT_NID,
13369 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13370 .channel_mode = alc861_8ch_modes,
13371 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13372 .adc_nids = alc861_adc_nids,
13373 .input_mux = &alc861_capture_source,
13376 .mixers = { alc861_3ST_mixer },
13377 .init_verbs = { alc861_threestack_init_verbs },
13378 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13379 .dac_nids = alc660_dac_nids,
13380 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13381 .channel_mode = alc861_threestack_modes,
13383 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13384 .adc_nids = alc861_adc_nids,
13385 .input_mux = &alc861_capture_source,
13387 [ALC861_UNIWILL_M31] = {
13388 .mixers = { alc861_uniwill_m31_mixer },
13389 .init_verbs = { alc861_uniwill_m31_init_verbs },
13390 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13391 .dac_nids = alc861_dac_nids,
13392 .dig_out_nid = ALC861_DIGOUT_NID,
13393 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13394 .channel_mode = alc861_uniwill_m31_modes,
13396 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13397 .adc_nids = alc861_adc_nids,
13398 .input_mux = &alc861_capture_source,
13400 [ALC861_TOSHIBA] = {
13401 .mixers = { alc861_toshiba_mixer },
13402 .init_verbs = { alc861_base_init_verbs,
13403 alc861_toshiba_init_verbs },
13404 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13405 .dac_nids = alc861_dac_nids,
13406 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13407 .channel_mode = alc883_3ST_2ch_modes,
13408 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13409 .adc_nids = alc861_adc_nids,
13410 .input_mux = &alc861_capture_source,
13411 .unsol_event = alc861_toshiba_unsol_event,
13412 .init_hook = alc861_toshiba_automute,
13415 .mixers = { alc861_asus_mixer },
13416 .init_verbs = { alc861_asus_init_verbs },
13417 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13418 .dac_nids = alc861_dac_nids,
13419 .dig_out_nid = ALC861_DIGOUT_NID,
13420 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13421 .channel_mode = alc861_asus_modes,
13424 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13425 .adc_nids = alc861_adc_nids,
13426 .input_mux = &alc861_capture_source,
13428 [ALC861_ASUS_LAPTOP] = {
13429 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13430 .init_verbs = { alc861_asus_init_verbs,
13431 alc861_asus_laptop_init_verbs },
13432 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13433 .dac_nids = alc861_dac_nids,
13434 .dig_out_nid = ALC861_DIGOUT_NID,
13435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13436 .channel_mode = alc883_3ST_2ch_modes,
13438 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13439 .adc_nids = alc861_adc_nids,
13440 .input_mux = &alc861_capture_source,
13445 static int patch_alc861(struct hda_codec *codec)
13447 struct alc_spec *spec;
13451 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13455 codec->spec = spec;
13457 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13461 if (board_config < 0) {
13462 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13463 "trying auto-probe from BIOS...\n");
13464 board_config = ALC861_AUTO;
13467 if (board_config == ALC861_AUTO) {
13468 /* automatic parse from the BIOS config */
13469 err = alc861_parse_auto_config(codec);
13475 "hda_codec: Cannot set up configuration "
13476 "from BIOS. Using base mode...\n");
13477 board_config = ALC861_3ST_DIG;
13481 if (board_config != ALC861_AUTO)
13482 setup_preset(spec, &alc861_presets[board_config]);
13484 spec->stream_name_analog = "ALC861 Analog";
13485 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13486 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13488 spec->stream_name_digital = "ALC861 Digital";
13489 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13490 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13492 spec->vmaster_nid = 0x03;
13494 codec->patch_ops = alc_patch_ops;
13495 if (board_config == ALC861_AUTO)
13496 spec->init_hook = alc861_auto_init;
13497 #ifdef CONFIG_SND_HDA_POWER_SAVE
13498 if (!spec->loopback.amplist)
13499 spec->loopback.amplist = alc861_loopbacks;
13506 * ALC861-VD support
13510 * In addition, an independent DAC
13512 #define ALC861VD_DIGOUT_NID 0x06
13514 static hda_nid_t alc861vd_dac_nids[4] = {
13515 /* front, surr, clfe, side surr */
13516 0x02, 0x03, 0x04, 0x05
13519 /* dac_nids for ALC660vd are in a different order - according to
13520 * Realtek's driver.
13521 * This should probably tesult in a different mixer for 6stack models
13522 * of ALC660vd codecs, but for now there is only 3stack mixer
13523 * - and it is the same as in 861vd.
13524 * adc_nids in ALC660vd are (is) the same as in 861vd
13526 static hda_nid_t alc660vd_dac_nids[3] = {
13527 /* front, rear, clfe, rear_surr */
13531 static hda_nid_t alc861vd_adc_nids[1] = {
13536 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13539 /* FIXME: should be a matrix-type input source selection */
13540 static struct hda_input_mux alc861vd_capture_source = {
13544 { "Front Mic", 0x1 },
13550 static struct hda_input_mux alc861vd_dallas_capture_source = {
13553 { "Ext Mic", 0x0 },
13554 { "Int Mic", 0x1 },
13558 static struct hda_input_mux alc861vd_hp_capture_source = {
13561 { "Front Mic", 0x0 },
13562 { "ATAPI Mic", 0x1 },
13566 #define alc861vd_mux_enum_info alc_mux_enum_info
13567 #define alc861vd_mux_enum_get alc_mux_enum_get
13568 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
13569 #define alc861vd_mux_enum_put alc882_mux_enum_put
13574 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13581 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13582 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13583 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13584 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13585 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13592 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13593 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13594 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13595 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13596 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13600 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13601 { 6, alc861vd_6stack_ch6_init },
13602 { 8, alc861vd_6stack_ch8_init },
13605 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13607 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13608 .name = "Channel Mode",
13609 .info = alc_ch_mode_info,
13610 .get = alc_ch_mode_get,
13611 .put = alc_ch_mode_put,
13616 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
13617 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13618 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13622 /* The multiple "Capture Source" controls confuse alsamixer
13623 * So call somewhat different..
13625 /* .name = "Capture Source", */
13626 .name = "Input Source",
13628 .info = alc861vd_mux_enum_info,
13629 .get = alc861vd_mux_enum_get,
13630 .put = alc861vd_mux_enum_put,
13635 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13636 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13638 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13639 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13640 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13642 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13643 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13645 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13647 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13649 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13650 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13652 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13653 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13659 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13661 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13662 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13666 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13668 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13669 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13671 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13672 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13677 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13678 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13679 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13685 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13687 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13688 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13689 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13691 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13692 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13694 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13695 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13697 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13698 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13703 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
13704 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13705 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13706 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13708 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13710 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13712 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13714 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13715 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13716 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13718 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13719 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13724 /* Pin assignment: Speaker=0x14, HP = 0x15,
13725 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
13727 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
13728 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13729 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
13730 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13731 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13732 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13733 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13734 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13735 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13736 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13737 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13738 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
13739 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
13743 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
13744 * Front Mic=0x18, ATAPI Mic = 0x19,
13746 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
13747 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13748 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13749 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13750 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13751 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13752 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13753 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13754 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13760 * generic initialization of ADC, input mixers and output mixers
13762 static struct hda_verb alc861vd_volume_init_verbs[] = {
13764 * Unmute ADC0 and set the default input to mic-in
13766 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13767 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13769 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13770 * the analog-loopback mixer widget
13772 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13773 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13774 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13775 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13776 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13777 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13779 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13783 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13786 * Set up output mixers (0x02 - 0x05)
13788 /* set vol=0 to output mixers */
13789 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13790 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13791 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13792 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13794 /* set up input amps for analog loopback */
13795 /* Amp Indices: DAC = 0, mixer = 1 */
13796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13798 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13799 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13800 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13801 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13802 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13803 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13809 * 3-stack pin configuration:
13810 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13812 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13814 * Set pin mode and muting
13816 /* set front pin widgets 0x14 for output */
13817 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13818 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13819 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13821 /* Mic (rear) pin: input vref at 80% */
13822 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13824 /* Front Mic pin: input vref at 80% */
13825 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13827 /* Line In pin: input */
13828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13830 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13832 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13833 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13834 /* CD pin widget for input */
13835 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13841 * 6-stack pin configuration:
13843 static struct hda_verb alc861vd_6stack_init_verbs[] = {
13845 * Set pin mode and muting
13847 /* set front pin widgets 0x14 for output */
13848 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13849 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13850 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13852 /* Rear Pin: output 1 (0x0d) */
13853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13856 /* CLFE Pin: output 2 (0x0e) */
13857 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13858 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13859 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13860 /* Side Pin: output 3 (0x0f) */
13861 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13862 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13863 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13865 /* Mic (rear) pin: input vref at 80% */
13866 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13867 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13868 /* Front Mic pin: input vref at 80% */
13869 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13870 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13871 /* Line In pin: input */
13872 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13873 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13874 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13875 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13876 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13877 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13878 /* CD pin widget for input */
13879 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13884 static struct hda_verb alc861vd_eapd_verbs[] = {
13885 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13889 static struct hda_verb alc660vd_eapd_verbs[] = {
13890 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13891 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13895 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13896 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13897 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13898 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13899 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13900 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13904 /* toggle speaker-output according to the hp-jack state */
13905 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
13907 unsigned int present;
13908 unsigned char bits;
13910 present = snd_hda_codec_read(codec, 0x1b, 0,
13911 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13912 bits = present ? HDA_AMP_MUTE : 0;
13913 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13914 HDA_AMP_MUTE, bits);
13917 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
13919 unsigned int present;
13920 unsigned char bits;
13922 present = snd_hda_codec_read(codec, 0x18, 0,
13923 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13924 bits = present ? HDA_AMP_MUTE : 0;
13925 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
13926 HDA_AMP_MUTE, bits);
13929 static void alc861vd_lenovo_automute(struct hda_codec *codec)
13931 alc861vd_lenovo_hp_automute(codec);
13932 alc861vd_lenovo_mic_automute(codec);
13935 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
13938 switch (res >> 26) {
13939 case ALC880_HP_EVENT:
13940 alc861vd_lenovo_hp_automute(codec);
13942 case ALC880_MIC_EVENT:
13943 alc861vd_lenovo_mic_automute(codec);
13948 static struct hda_verb alc861vd_dallas_verbs[] = {
13949 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13950 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13951 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13952 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13957 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13959 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13960 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13961 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13963 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13964 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13967 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13968 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13969 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13970 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13972 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13973 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13974 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13975 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13976 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13977 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13978 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13979 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13983 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13987 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13988 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13993 /* toggle speaker-output according to the hp-jack state */
13994 static void alc861vd_dallas_automute(struct hda_codec *codec)
13996 unsigned int present;
13998 present = snd_hda_codec_read(codec, 0x15, 0,
13999 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14000 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14001 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14004 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14006 if ((res >> 26) == ALC880_HP_EVENT)
14007 alc861vd_dallas_automute(codec);
14010 #ifdef CONFIG_SND_HDA_POWER_SAVE
14011 #define alc861vd_loopbacks alc880_loopbacks
14014 /* pcm configuration: identiacal with ALC880 */
14015 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14016 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14017 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14018 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14021 * configuration and preset
14023 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14024 [ALC660VD_3ST] = "3stack-660",
14025 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14026 [ALC861VD_3ST] = "3stack",
14027 [ALC861VD_3ST_DIG] = "3stack-digout",
14028 [ALC861VD_6ST_DIG] = "6stack-digout",
14029 [ALC861VD_LENOVO] = "lenovo",
14030 [ALC861VD_DALLAS] = "dallas",
14031 [ALC861VD_HP] = "hp",
14032 [ALC861VD_AUTO] = "auto",
14035 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14036 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14037 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14038 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14039 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14040 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO),
14041 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14042 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14043 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14044 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14045 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14046 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14047 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14048 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14049 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14050 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14051 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14052 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14056 static struct alc_config_preset alc861vd_presets[] = {
14058 .mixers = { alc861vd_3st_mixer },
14059 .init_verbs = { alc861vd_volume_init_verbs,
14060 alc861vd_3stack_init_verbs },
14061 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14062 .dac_nids = alc660vd_dac_nids,
14063 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14064 .channel_mode = alc861vd_3stack_2ch_modes,
14065 .input_mux = &alc861vd_capture_source,
14067 [ALC660VD_3ST_DIG] = {
14068 .mixers = { alc861vd_3st_mixer },
14069 .init_verbs = { alc861vd_volume_init_verbs,
14070 alc861vd_3stack_init_verbs },
14071 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14072 .dac_nids = alc660vd_dac_nids,
14073 .dig_out_nid = ALC861VD_DIGOUT_NID,
14074 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14075 .channel_mode = alc861vd_3stack_2ch_modes,
14076 .input_mux = &alc861vd_capture_source,
14079 .mixers = { alc861vd_3st_mixer },
14080 .init_verbs = { alc861vd_volume_init_verbs,
14081 alc861vd_3stack_init_verbs },
14082 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14083 .dac_nids = alc861vd_dac_nids,
14084 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14085 .channel_mode = alc861vd_3stack_2ch_modes,
14086 .input_mux = &alc861vd_capture_source,
14088 [ALC861VD_3ST_DIG] = {
14089 .mixers = { alc861vd_3st_mixer },
14090 .init_verbs = { alc861vd_volume_init_verbs,
14091 alc861vd_3stack_init_verbs },
14092 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14093 .dac_nids = alc861vd_dac_nids,
14094 .dig_out_nid = ALC861VD_DIGOUT_NID,
14095 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14096 .channel_mode = alc861vd_3stack_2ch_modes,
14097 .input_mux = &alc861vd_capture_source,
14099 [ALC861VD_6ST_DIG] = {
14100 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14101 .init_verbs = { alc861vd_volume_init_verbs,
14102 alc861vd_6stack_init_verbs },
14103 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14104 .dac_nids = alc861vd_dac_nids,
14105 .dig_out_nid = ALC861VD_DIGOUT_NID,
14106 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14107 .channel_mode = alc861vd_6stack_modes,
14108 .input_mux = &alc861vd_capture_source,
14110 [ALC861VD_LENOVO] = {
14111 .mixers = { alc861vd_lenovo_mixer },
14112 .init_verbs = { alc861vd_volume_init_verbs,
14113 alc861vd_3stack_init_verbs,
14114 alc861vd_eapd_verbs,
14115 alc861vd_lenovo_unsol_verbs },
14116 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14117 .dac_nids = alc660vd_dac_nids,
14118 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14119 .channel_mode = alc861vd_3stack_2ch_modes,
14120 .input_mux = &alc861vd_capture_source,
14121 .unsol_event = alc861vd_lenovo_unsol_event,
14122 .init_hook = alc861vd_lenovo_automute,
14124 [ALC861VD_DALLAS] = {
14125 .mixers = { alc861vd_dallas_mixer },
14126 .init_verbs = { alc861vd_dallas_verbs },
14127 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14128 .dac_nids = alc861vd_dac_nids,
14129 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14130 .channel_mode = alc861vd_3stack_2ch_modes,
14131 .input_mux = &alc861vd_dallas_capture_source,
14132 .unsol_event = alc861vd_dallas_unsol_event,
14133 .init_hook = alc861vd_dallas_automute,
14136 .mixers = { alc861vd_hp_mixer },
14137 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14138 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14139 .dac_nids = alc861vd_dac_nids,
14140 .dig_out_nid = ALC861VD_DIGOUT_NID,
14141 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14142 .channel_mode = alc861vd_3stack_2ch_modes,
14143 .input_mux = &alc861vd_hp_capture_source,
14144 .unsol_event = alc861vd_dallas_unsol_event,
14145 .init_hook = alc861vd_dallas_automute,
14150 * BIOS auto configuration
14152 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14153 hda_nid_t nid, int pin_type, int dac_idx)
14155 alc_set_pin_output(codec, nid, pin_type);
14158 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14160 struct alc_spec *spec = codec->spec;
14163 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14164 for (i = 0; i <= HDA_SIDE; i++) {
14165 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14166 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14168 alc861vd_auto_set_output_and_unmute(codec, nid,
14174 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14176 struct alc_spec *spec = codec->spec;
14179 pin = spec->autocfg.hp_pins[0];
14180 if (pin) /* connect to front and use dac 0 */
14181 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14182 pin = spec->autocfg.speaker_pins[0];
14184 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14187 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14188 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14190 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14192 struct alc_spec *spec = codec->spec;
14195 for (i = 0; i < AUTO_PIN_LAST; i++) {
14196 hda_nid_t nid = spec->autocfg.input_pins[i];
14197 if (alc861vd_is_input_pin(nid)) {
14198 snd_hda_codec_write(codec, nid, 0,
14199 AC_VERB_SET_PIN_WIDGET_CONTROL,
14200 i <= AUTO_PIN_FRONT_MIC ?
14201 PIN_VREF80 : PIN_IN);
14202 if (nid != ALC861VD_PIN_CD_NID)
14203 snd_hda_codec_write(codec, nid, 0,
14204 AC_VERB_SET_AMP_GAIN_MUTE,
14210 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14212 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14213 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14215 /* add playback controls from the parsed DAC table */
14216 /* Based on ALC880 version. But ALC861VD has separate,
14217 * different NIDs for mute/unmute switch and volume control */
14218 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14219 const struct auto_pin_cfg *cfg)
14222 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14223 hda_nid_t nid_v, nid_s;
14226 for (i = 0; i < cfg->line_outs; i++) {
14227 if (!spec->multiout.dac_nids[i])
14229 nid_v = alc861vd_idx_to_mixer_vol(
14231 spec->multiout.dac_nids[i]));
14232 nid_s = alc861vd_idx_to_mixer_switch(
14234 spec->multiout.dac_nids[i]));
14238 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14239 "Center Playback Volume",
14240 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14244 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14245 "LFE Playback Volume",
14246 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14250 err = add_control(spec, ALC_CTL_BIND_MUTE,
14251 "Center Playback Switch",
14252 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14256 err = add_control(spec, ALC_CTL_BIND_MUTE,
14257 "LFE Playback Switch",
14258 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14263 sprintf(name, "%s Playback Volume", chname[i]);
14264 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14265 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14269 sprintf(name, "%s Playback Switch", chname[i]);
14270 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14271 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14280 /* add playback controls for speaker and HP outputs */
14281 /* Based on ALC880 version. But ALC861VD has separate,
14282 * different NIDs for mute/unmute switch and volume control */
14283 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14284 hda_nid_t pin, const char *pfx)
14286 hda_nid_t nid_v, nid_s;
14293 if (alc880_is_fixed_pin(pin)) {
14294 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14295 /* specify the DAC as the extra output */
14296 if (!spec->multiout.hp_nid)
14297 spec->multiout.hp_nid = nid_v;
14299 spec->multiout.extra_out_nid[0] = nid_v;
14300 /* control HP volume/switch on the output mixer amp */
14301 nid_v = alc861vd_idx_to_mixer_vol(
14302 alc880_fixed_pin_idx(pin));
14303 nid_s = alc861vd_idx_to_mixer_switch(
14304 alc880_fixed_pin_idx(pin));
14306 sprintf(name, "%s Playback Volume", pfx);
14307 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14308 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14311 sprintf(name, "%s Playback Switch", pfx);
14312 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14313 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14316 } else if (alc880_is_multi_pin(pin)) {
14317 /* set manual connection */
14318 /* we have only a switch on HP-out PIN */
14319 sprintf(name, "%s Playback Switch", pfx);
14320 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14321 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14328 /* parse the BIOS configuration and set up the alc_spec
14329 * return 1 if successful, 0 if the proper config is not found,
14330 * or a negative error code
14331 * Based on ALC880 version - had to change it to override
14332 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14333 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14335 struct alc_spec *spec = codec->spec;
14337 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14339 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14343 if (!spec->autocfg.line_outs)
14344 return 0; /* can't find valid BIOS pin config */
14346 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14349 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14352 err = alc861vd_auto_create_extra_out(spec,
14353 spec->autocfg.speaker_pins[0],
14357 err = alc861vd_auto_create_extra_out(spec,
14358 spec->autocfg.hp_pins[0],
14362 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14366 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14368 if (spec->autocfg.dig_out_pin)
14369 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14371 if (spec->kctl_alloc)
14372 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14374 spec->init_verbs[spec->num_init_verbs++]
14375 = alc861vd_volume_init_verbs;
14377 spec->num_mux_defs = 1;
14378 spec->input_mux = &spec->private_imux;
14380 err = alc_auto_add_mic_boost(codec);
14387 /* additional initialization for auto-configuration model */
14388 static void alc861vd_auto_init(struct hda_codec *codec)
14390 struct alc_spec *spec = codec->spec;
14391 alc861vd_auto_init_multi_out(codec);
14392 alc861vd_auto_init_hp_out(codec);
14393 alc861vd_auto_init_analog_input(codec);
14394 alc861vd_auto_init_input_src(codec);
14395 if (spec->unsol_event)
14396 alc_sku_automute(codec);
14399 static int patch_alc861vd(struct hda_codec *codec)
14401 struct alc_spec *spec;
14402 int err, board_config;
14404 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14408 codec->spec = spec;
14410 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14414 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14415 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14416 "ALC861VD, trying auto-probe from BIOS...\n");
14417 board_config = ALC861VD_AUTO;
14420 if (board_config == ALC861VD_AUTO) {
14421 /* automatic parse from the BIOS config */
14422 err = alc861vd_parse_auto_config(codec);
14428 "hda_codec: Cannot set up configuration "
14429 "from BIOS. Using base mode...\n");
14430 board_config = ALC861VD_3ST;
14434 if (board_config != ALC861VD_AUTO)
14435 setup_preset(spec, &alc861vd_presets[board_config]);
14437 if (codec->vendor_id == 0x10ec0660) {
14438 spec->stream_name_analog = "ALC660-VD Analog";
14439 spec->stream_name_digital = "ALC660-VD Digital";
14440 /* always turn on EAPD */
14441 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
14443 spec->stream_name_analog = "ALC861VD Analog";
14444 spec->stream_name_digital = "ALC861VD Digital";
14447 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14448 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14450 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14451 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14453 spec->adc_nids = alc861vd_adc_nids;
14454 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14455 spec->capsrc_nids = alc861vd_capsrc_nids;
14457 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
14458 spec->num_mixers++;
14460 spec->vmaster_nid = 0x02;
14462 codec->patch_ops = alc_patch_ops;
14464 if (board_config == ALC861VD_AUTO)
14465 spec->init_hook = alc861vd_auto_init;
14466 #ifdef CONFIG_SND_HDA_POWER_SAVE
14467 if (!spec->loopback.amplist)
14468 spec->loopback.amplist = alc861vd_loopbacks;
14477 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14478 * configuration. Each pin widget can choose any input DACs and a mixer.
14479 * Each ADC is connected from a mixer of all inputs. This makes possible
14480 * 6-channel independent captures.
14482 * In addition, an independent DAC for the multi-playback (not used in this
14485 #define ALC662_DIGOUT_NID 0x06
14486 #define ALC662_DIGIN_NID 0x0a
14488 static hda_nid_t alc662_dac_nids[4] = {
14489 /* front, rear, clfe, rear_surr */
14493 static hda_nid_t alc662_adc_nids[1] = {
14498 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14501 /* FIXME: should be a matrix-type input source selection */
14502 static struct hda_input_mux alc662_capture_source = {
14506 { "Front Mic", 0x1 },
14512 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14520 static struct hda_input_mux alc662_eeepc_capture_source = {
14528 static struct hda_input_mux alc663_capture_source = {
14532 { "Front Mic", 0x1 },
14537 static struct hda_input_mux alc663_m51va_capture_source = {
14540 { "Ext-Mic", 0x0 },
14545 #define alc662_mux_enum_info alc_mux_enum_info
14546 #define alc662_mux_enum_get alc_mux_enum_get
14547 #define alc662_mux_enum_put alc882_mux_enum_put
14552 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14559 static struct hda_verb alc662_3ST_ch2_init[] = {
14560 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14561 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14562 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14563 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14570 static struct hda_verb alc662_3ST_ch6_init[] = {
14571 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14572 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14573 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14574 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14575 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14576 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14580 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14581 { 2, alc662_3ST_ch2_init },
14582 { 6, alc662_3ST_ch6_init },
14588 static struct hda_verb alc662_sixstack_ch6_init[] = {
14589 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14590 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14591 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14598 static struct hda_verb alc662_sixstack_ch8_init[] = {
14599 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14600 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14601 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14605 static struct hda_channel_mode alc662_5stack_modes[2] = {
14606 { 2, alc662_sixstack_ch6_init },
14607 { 6, alc662_sixstack_ch8_init },
14610 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14611 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14614 static struct snd_kcontrol_new alc662_base_mixer[] = {
14615 /* output mixer control */
14616 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14617 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14618 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14619 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14620 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14621 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14622 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14623 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14624 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14626 /*Input mixer control */
14627 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14628 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14629 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14630 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14631 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14632 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14633 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14634 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14638 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14639 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14640 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14642 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14643 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14644 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14645 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14646 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14647 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14648 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14649 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14650 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14651 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14655 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14656 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14657 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14658 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14659 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14660 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14661 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14662 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14663 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14665 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14666 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14667 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14668 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14671 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14672 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14673 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14674 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14678 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
14679 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14680 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
14681 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14682 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
14683 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14684 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14685 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14687 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14691 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
14692 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14694 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14695 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14697 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
14698 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14699 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14701 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
14702 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14703 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14707 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
14708 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14709 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14710 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14711 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
14712 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14713 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14714 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
14715 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
14716 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14717 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
14718 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14719 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14721 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14725 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14726 .ops = &snd_hda_bind_vol,
14728 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14729 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14734 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14735 .ops = &snd_hda_bind_sw,
14737 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14738 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14743 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14744 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14745 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14746 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14747 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14751 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14752 .ops = &snd_hda_bind_sw,
14754 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14755 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14756 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14761 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14762 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14763 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14766 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14767 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14772 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14773 .ops = &snd_hda_bind_sw,
14775 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14776 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14777 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14782 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14783 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14784 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14787 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14788 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14792 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
14793 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14794 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14798 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14799 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14803 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14804 .ops = &snd_hda_bind_vol,
14806 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14807 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14812 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14813 .ops = &snd_hda_bind_sw,
14815 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14816 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14821 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14822 HDA_BIND_VOL("Master Playback Volume",
14823 &alc663_asus_two_bind_master_vol),
14824 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14825 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14826 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14832 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14833 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14834 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14835 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14842 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
14843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14844 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14845 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14846 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14847 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14850 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14851 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14852 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14856 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
14857 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14858 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14859 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14863 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14864 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14865 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14866 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14870 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
14872 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14873 .name = "Channel Mode",
14874 .info = alc_ch_mode_info,
14875 .get = alc_ch_mode_get,
14876 .put = alc_ch_mode_put,
14881 static struct hda_verb alc662_init_verbs[] = {
14882 /* ADC: mute amp left and right */
14883 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14884 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14885 /* Front mixer: unmute input/output amp left and right (volume = 0) */
14887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14889 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14891 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14900 /* Front Pin: output 0 (0x0c) */
14901 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14902 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14904 /* Rear Pin: output 1 (0x0d) */
14905 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14906 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14908 /* CLFE Pin: output 2 (0x0e) */
14909 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14910 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14912 /* Mic (rear) pin: input vref at 80% */
14913 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14914 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14915 /* Front Mic pin: input vref at 80% */
14916 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14917 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14918 /* Line In pin: input */
14919 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14920 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14921 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14922 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14923 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14924 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14925 /* CD pin widget for input */
14926 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14928 /* FIXME: use matrix-type input source selection */
14929 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14936 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14937 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14938 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14939 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14941 /* always trun on EAPD */
14942 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14943 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14948 static struct hda_verb alc662_sue_init_verbs[] = {
14949 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14950 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14954 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
14955 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14956 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14960 /* Set Unsolicited Event*/
14961 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
14962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14963 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14968 * generic initialization of ADC, input mixers and output mixers
14970 static struct hda_verb alc662_auto_init_verbs[] = {
14972 * Unmute ADC and set the default input to mic-in
14974 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14975 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14977 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
14979 * Note: PASD motherboards uses the Line In 2 as the input for front
14980 * panel mic (mic 2)
14982 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14983 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14984 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14990 * Set up output mixers (0x0c - 0x0f)
14992 /* set vol=0 to output mixers */
14993 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14994 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14995 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14997 /* set up input amps for analog loopback */
14998 /* Amp Indices: DAC = 0, mixer = 1 */
14999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15001 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15002 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15007 /* FIXME: use matrix-type input source selection */
15008 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15011 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15015 /* additional verbs for ALC663 */
15016 static struct hda_verb alc663_auto_init_verbs[] = {
15017 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15018 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15022 static struct hda_verb alc663_m51va_init_verbs[] = {
15023 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15024 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15025 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15026 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15027 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15030 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15031 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15035 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15036 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15037 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15038 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15041 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15042 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15046 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15049 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15050 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15054 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15058 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15061 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15064 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15065 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15069 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15071 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15072 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15073 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15074 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15076 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15079 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15080 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15081 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15085 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15086 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15087 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15089 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15090 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15092 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15096 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15097 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15101 static struct hda_verb alc663_g71v_init_verbs[] = {
15102 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15103 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15104 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15106 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15107 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15108 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15110 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15111 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15112 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15116 static struct hda_verb alc663_g50v_init_verbs[] = {
15117 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15118 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15119 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15121 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15122 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15126 static struct hda_verb alc662_ecs_init_verbs[] = {
15127 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15129 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15130 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15134 /* capture mixer elements */
15135 static struct snd_kcontrol_new alc662_capture_mixer[] = {
15136 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15137 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15139 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15140 /* The multiple "Capture Source" controls confuse alsamixer
15141 * So call somewhat different..
15143 /* .name = "Capture Source", */
15144 .name = "Input Source",
15146 .info = alc662_mux_enum_info,
15147 .get = alc662_mux_enum_get,
15148 .put = alc662_mux_enum_put,
15153 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15154 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15155 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15159 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15161 unsigned int present;
15162 unsigned char bits;
15164 present = snd_hda_codec_read(codec, 0x14, 0,
15165 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15166 bits = present ? HDA_AMP_MUTE : 0;
15167 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15168 HDA_AMP_MUTE, bits);
15171 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15173 unsigned int present;
15174 unsigned char bits;
15176 present = snd_hda_codec_read(codec, 0x1b, 0,
15177 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15178 bits = present ? HDA_AMP_MUTE : 0;
15179 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15180 HDA_AMP_MUTE, bits);
15181 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15182 HDA_AMP_MUTE, bits);
15185 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15188 if ((res >> 26) == ALC880_HP_EVENT)
15189 alc662_lenovo_101e_all_automute(codec);
15190 if ((res >> 26) == ALC880_FRONT_EVENT)
15191 alc662_lenovo_101e_ispeaker_automute(codec);
15194 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15196 unsigned int present;
15198 present = snd_hda_codec_read(codec, 0x18, 0,
15199 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15200 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15201 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15202 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15203 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15204 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15205 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15206 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15207 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15210 /* unsolicited event for HP jack sensing */
15211 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15214 if ((res >> 26) == ALC880_HP_EVENT)
15215 alc262_hippo1_automute( codec );
15217 if ((res >> 26) == ALC880_MIC_EVENT)
15218 alc662_eeepc_mic_automute(codec);
15221 static void alc662_eeepc_inithook(struct hda_codec *codec)
15223 alc262_hippo1_automute( codec );
15224 alc662_eeepc_mic_automute(codec);
15227 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15230 unsigned int present;
15232 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15233 present = snd_hda_codec_read(codec, 0x14, 0,
15234 AC_VERB_GET_PIN_SENSE, 0);
15235 present = (present & 0x80000000) != 0;
15237 /* mute internal speaker */
15238 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15239 HDA_AMP_MUTE, HDA_AMP_MUTE);
15241 /* unmute internal speaker if necessary */
15242 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15243 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15244 HDA_AMP_MUTE, mute);
15248 /* unsolicited event for HP jack sensing */
15249 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15252 if ((res >> 26) == ALC880_HP_EVENT)
15253 alc662_eeepc_ep20_automute(codec);
15256 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15258 alc662_eeepc_ep20_automute(codec);
15261 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15263 unsigned int present;
15264 unsigned char bits;
15266 present = snd_hda_codec_read(codec, 0x21, 0,
15267 AC_VERB_GET_PIN_SENSE, 0)
15268 & AC_PINSENSE_PRESENCE;
15269 bits = present ? HDA_AMP_MUTE : 0;
15270 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15271 AMP_IN_MUTE(0), bits);
15272 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15273 AMP_IN_MUTE(0), bits);
15276 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15278 unsigned int present;
15279 unsigned char bits;
15281 present = snd_hda_codec_read(codec, 0x21, 0,
15282 AC_VERB_GET_PIN_SENSE, 0)
15283 & AC_PINSENSE_PRESENCE;
15284 bits = present ? HDA_AMP_MUTE : 0;
15285 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15286 AMP_IN_MUTE(0), bits);
15287 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15288 AMP_IN_MUTE(0), bits);
15289 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15290 AMP_IN_MUTE(0), bits);
15291 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15292 AMP_IN_MUTE(0), bits);
15295 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15297 unsigned int present;
15298 unsigned char bits;
15300 present = snd_hda_codec_read(codec, 0x15, 0,
15301 AC_VERB_GET_PIN_SENSE, 0)
15302 & AC_PINSENSE_PRESENCE;
15303 bits = present ? HDA_AMP_MUTE : 0;
15304 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15305 AMP_IN_MUTE(0), bits);
15306 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15307 AMP_IN_MUTE(0), bits);
15308 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15309 AMP_IN_MUTE(0), bits);
15310 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15311 AMP_IN_MUTE(0), bits);
15314 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15316 unsigned int present;
15317 unsigned char bits;
15319 present = snd_hda_codec_read(codec, 0x1b, 0,
15320 AC_VERB_GET_PIN_SENSE, 0)
15321 & AC_PINSENSE_PRESENCE;
15322 bits = present ? 0 : PIN_OUT;
15323 snd_hda_codec_write(codec, 0x14, 0,
15324 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15327 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15329 unsigned int present1, present2;
15331 present1 = snd_hda_codec_read(codec, 0x21, 0,
15332 AC_VERB_GET_PIN_SENSE, 0)
15333 & AC_PINSENSE_PRESENCE;
15334 present2 = snd_hda_codec_read(codec, 0x15, 0,
15335 AC_VERB_GET_PIN_SENSE, 0)
15336 & AC_PINSENSE_PRESENCE;
15338 if (present1 || present2) {
15339 snd_hda_codec_write_cache(codec, 0x14, 0,
15340 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15342 snd_hda_codec_write_cache(codec, 0x14, 0,
15343 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15347 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15349 unsigned int present1, present2;
15351 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15352 AC_VERB_GET_PIN_SENSE, 0)
15353 & AC_PINSENSE_PRESENCE;
15354 present2 = snd_hda_codec_read(codec, 0x15, 0,
15355 AC_VERB_GET_PIN_SENSE, 0)
15356 & AC_PINSENSE_PRESENCE;
15358 if (present1 || present2) {
15359 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15360 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15361 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15362 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15364 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15365 AMP_IN_MUTE(0), 0);
15366 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15367 AMP_IN_MUTE(0), 0);
15371 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15373 unsigned int present;
15375 present = snd_hda_codec_read(codec, 0x18, 0,
15376 AC_VERB_GET_PIN_SENSE, 0)
15377 & AC_PINSENSE_PRESENCE;
15378 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15379 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15380 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15381 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15382 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15383 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15384 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15385 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15388 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15391 switch (res >> 26) {
15392 case ALC880_HP_EVENT:
15393 alc663_m51va_speaker_automute(codec);
15395 case ALC880_MIC_EVENT:
15396 alc663_m51va_mic_automute(codec);
15401 static void alc663_m51va_inithook(struct hda_codec *codec)
15403 alc663_m51va_speaker_automute(codec);
15404 alc663_m51va_mic_automute(codec);
15407 /* ***************** Mode1 ******************************/
15408 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15411 switch (res >> 26) {
15412 case ALC880_HP_EVENT:
15413 alc663_m51va_speaker_automute(codec);
15415 case ALC880_MIC_EVENT:
15416 alc662_eeepc_mic_automute(codec);
15421 static void alc663_mode1_inithook(struct hda_codec *codec)
15423 alc663_m51va_speaker_automute(codec);
15424 alc662_eeepc_mic_automute(codec);
15426 /* ***************** Mode2 ******************************/
15427 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15430 switch (res >> 26) {
15431 case ALC880_HP_EVENT:
15432 alc662_f5z_speaker_automute(codec);
15434 case ALC880_MIC_EVENT:
15435 alc662_eeepc_mic_automute(codec);
15440 static void alc662_mode2_inithook(struct hda_codec *codec)
15442 alc662_f5z_speaker_automute(codec);
15443 alc662_eeepc_mic_automute(codec);
15445 /* ***************** Mode3 ******************************/
15446 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15449 switch (res >> 26) {
15450 case ALC880_HP_EVENT:
15451 alc663_two_hp_m1_speaker_automute(codec);
15453 case ALC880_MIC_EVENT:
15454 alc662_eeepc_mic_automute(codec);
15459 static void alc663_mode3_inithook(struct hda_codec *codec)
15461 alc663_two_hp_m1_speaker_automute(codec);
15462 alc662_eeepc_mic_automute(codec);
15464 /* ***************** Mode4 ******************************/
15465 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15468 switch (res >> 26) {
15469 case ALC880_HP_EVENT:
15470 alc663_21jd_two_speaker_automute(codec);
15472 case ALC880_MIC_EVENT:
15473 alc662_eeepc_mic_automute(codec);
15478 static void alc663_mode4_inithook(struct hda_codec *codec)
15480 alc663_21jd_two_speaker_automute(codec);
15481 alc662_eeepc_mic_automute(codec);
15483 /* ***************** Mode5 ******************************/
15484 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15487 switch (res >> 26) {
15488 case ALC880_HP_EVENT:
15489 alc663_15jd_two_speaker_automute(codec);
15491 case ALC880_MIC_EVENT:
15492 alc662_eeepc_mic_automute(codec);
15497 static void alc663_mode5_inithook(struct hda_codec *codec)
15499 alc663_15jd_two_speaker_automute(codec);
15500 alc662_eeepc_mic_automute(codec);
15502 /* ***************** Mode6 ******************************/
15503 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15506 switch (res >> 26) {
15507 case ALC880_HP_EVENT:
15508 alc663_two_hp_m2_speaker_automute(codec);
15510 case ALC880_MIC_EVENT:
15511 alc662_eeepc_mic_automute(codec);
15516 static void alc663_mode6_inithook(struct hda_codec *codec)
15518 alc663_two_hp_m2_speaker_automute(codec);
15519 alc662_eeepc_mic_automute(codec);
15522 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15524 unsigned int present;
15525 unsigned char bits;
15527 present = snd_hda_codec_read(codec, 0x21, 0,
15528 AC_VERB_GET_PIN_SENSE, 0)
15529 & AC_PINSENSE_PRESENCE;
15530 bits = present ? HDA_AMP_MUTE : 0;
15531 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15532 HDA_AMP_MUTE, bits);
15533 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15534 HDA_AMP_MUTE, bits);
15537 static void alc663_g71v_front_automute(struct hda_codec *codec)
15539 unsigned int present;
15540 unsigned char bits;
15542 present = snd_hda_codec_read(codec, 0x15, 0,
15543 AC_VERB_GET_PIN_SENSE, 0)
15544 & AC_PINSENSE_PRESENCE;
15545 bits = present ? HDA_AMP_MUTE : 0;
15546 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15547 HDA_AMP_MUTE, bits);
15550 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15553 switch (res >> 26) {
15554 case ALC880_HP_EVENT:
15555 alc663_g71v_hp_automute(codec);
15557 case ALC880_FRONT_EVENT:
15558 alc663_g71v_front_automute(codec);
15560 case ALC880_MIC_EVENT:
15561 alc662_eeepc_mic_automute(codec);
15566 static void alc663_g71v_inithook(struct hda_codec *codec)
15568 alc663_g71v_front_automute(codec);
15569 alc663_g71v_hp_automute(codec);
15570 alc662_eeepc_mic_automute(codec);
15573 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15576 switch (res >> 26) {
15577 case ALC880_HP_EVENT:
15578 alc663_m51va_speaker_automute(codec);
15580 case ALC880_MIC_EVENT:
15581 alc662_eeepc_mic_automute(codec);
15586 static void alc663_g50v_inithook(struct hda_codec *codec)
15588 alc663_m51va_speaker_automute(codec);
15589 alc662_eeepc_mic_automute(codec);
15592 /* bind hp and internal speaker mute (with plug check) */
15593 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15594 struct snd_ctl_elem_value *ucontrol)
15596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15597 long *valp = ucontrol->value.integer.value;
15600 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15602 valp[0] ? 0 : HDA_AMP_MUTE);
15603 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15605 valp[1] ? 0 : HDA_AMP_MUTE);
15607 alc262_hippo1_automute(codec);
15611 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15612 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15614 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15615 .name = "Master Playback Switch",
15616 .info = snd_hda_mixer_amp_switch_info,
15617 .get = snd_hda_mixer_amp_switch_get,
15618 .put = alc662_ecs_master_sw_put,
15619 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15622 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15623 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15624 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15626 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15627 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15628 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15632 #ifdef CONFIG_SND_HDA_POWER_SAVE
15633 #define alc662_loopbacks alc880_loopbacks
15637 /* pcm configuration: identiacal with ALC880 */
15638 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15639 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15640 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15641 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15644 * configuration and preset
15646 static const char *alc662_models[ALC662_MODEL_LAST] = {
15647 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15648 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15649 [ALC662_3ST_6ch] = "3stack-6ch",
15650 [ALC662_5ST_DIG] = "6stack-dig",
15651 [ALC662_LENOVO_101E] = "lenovo-101e",
15652 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15653 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15654 [ALC662_ECS] = "ecs",
15655 [ALC663_ASUS_M51VA] = "m51va",
15656 [ALC663_ASUS_G71V] = "g71v",
15657 [ALC663_ASUS_H13] = "h13",
15658 [ALC663_ASUS_G50V] = "g50v",
15659 [ALC663_ASUS_MODE1] = "asus-mode1",
15660 [ALC662_ASUS_MODE2] = "asus-mode2",
15661 [ALC663_ASUS_MODE3] = "asus-mode3",
15662 [ALC663_ASUS_MODE4] = "asus-mode4",
15663 [ALC663_ASUS_MODE5] = "asus-mode5",
15664 [ALC663_ASUS_MODE6] = "asus-mode6",
15665 [ALC662_AUTO] = "auto",
15668 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15669 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15670 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
15671 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15672 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15673 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15674 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15675 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15676 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15677 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15678 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15679 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15680 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15681 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15682 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15683 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15684 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15685 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15686 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15687 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15688 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15689 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15690 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15691 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15692 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15693 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15694 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15695 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15696 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15697 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15698 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15699 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15700 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15701 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15702 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15703 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15704 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15705 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15706 ALC662_3ST_6ch_DIG),
15707 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15708 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15709 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15710 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15711 ALC662_3ST_6ch_DIG),
15712 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15713 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15714 ALC662_3ST_6ch_DIG),
15715 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15716 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15717 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
15721 static struct alc_config_preset alc662_presets[] = {
15722 [ALC662_3ST_2ch_DIG] = {
15723 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
15724 .init_verbs = { alc662_init_verbs },
15725 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15726 .dac_nids = alc662_dac_nids,
15727 .dig_out_nid = ALC662_DIGOUT_NID,
15728 .dig_in_nid = ALC662_DIGIN_NID,
15729 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15730 .channel_mode = alc662_3ST_2ch_modes,
15731 .input_mux = &alc662_capture_source,
15733 [ALC662_3ST_6ch_DIG] = {
15734 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
15735 alc662_capture_mixer },
15736 .init_verbs = { alc662_init_verbs },
15737 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15738 .dac_nids = alc662_dac_nids,
15739 .dig_out_nid = ALC662_DIGOUT_NID,
15740 .dig_in_nid = ALC662_DIGIN_NID,
15741 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15742 .channel_mode = alc662_3ST_6ch_modes,
15744 .input_mux = &alc662_capture_source,
15746 [ALC662_3ST_6ch] = {
15747 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
15748 alc662_capture_mixer },
15749 .init_verbs = { alc662_init_verbs },
15750 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15751 .dac_nids = alc662_dac_nids,
15752 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15753 .channel_mode = alc662_3ST_6ch_modes,
15755 .input_mux = &alc662_capture_source,
15757 [ALC662_5ST_DIG] = {
15758 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
15759 alc662_capture_mixer },
15760 .init_verbs = { alc662_init_verbs },
15761 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15762 .dac_nids = alc662_dac_nids,
15763 .dig_out_nid = ALC662_DIGOUT_NID,
15764 .dig_in_nid = ALC662_DIGIN_NID,
15765 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
15766 .channel_mode = alc662_5stack_modes,
15767 .input_mux = &alc662_capture_source,
15769 [ALC662_LENOVO_101E] = {
15770 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
15771 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
15772 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15773 .dac_nids = alc662_dac_nids,
15774 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15775 .channel_mode = alc662_3ST_2ch_modes,
15776 .input_mux = &alc662_lenovo_101e_capture_source,
15777 .unsol_event = alc662_lenovo_101e_unsol_event,
15778 .init_hook = alc662_lenovo_101e_all_automute,
15780 [ALC662_ASUS_EEEPC_P701] = {
15781 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
15782 .init_verbs = { alc662_init_verbs,
15783 alc662_eeepc_sue_init_verbs },
15784 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15785 .dac_nids = alc662_dac_nids,
15786 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15787 .channel_mode = alc662_3ST_2ch_modes,
15788 .input_mux = &alc662_eeepc_capture_source,
15789 .unsol_event = alc662_eeepc_unsol_event,
15790 .init_hook = alc662_eeepc_inithook,
15792 [ALC662_ASUS_EEEPC_EP20] = {
15793 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
15794 alc662_chmode_mixer },
15795 .init_verbs = { alc662_init_verbs,
15796 alc662_eeepc_ep20_sue_init_verbs },
15797 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15798 .dac_nids = alc662_dac_nids,
15799 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15800 .channel_mode = alc662_3ST_6ch_modes,
15801 .input_mux = &alc662_lenovo_101e_capture_source,
15802 .unsol_event = alc662_eeepc_ep20_unsol_event,
15803 .init_hook = alc662_eeepc_ep20_inithook,
15806 .mixers = { alc662_ecs_mixer, alc662_capture_mixer },
15807 .init_verbs = { alc662_init_verbs,
15808 alc662_ecs_init_verbs },
15809 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15810 .dac_nids = alc662_dac_nids,
15811 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15812 .channel_mode = alc662_3ST_2ch_modes,
15813 .input_mux = &alc662_eeepc_capture_source,
15814 .unsol_event = alc662_eeepc_unsol_event,
15815 .init_hook = alc662_eeepc_inithook,
15817 [ALC663_ASUS_M51VA] = {
15818 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15819 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15820 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15821 .dac_nids = alc662_dac_nids,
15822 .dig_out_nid = ALC662_DIGOUT_NID,
15823 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15824 .channel_mode = alc662_3ST_2ch_modes,
15825 .input_mux = &alc663_m51va_capture_source,
15826 .unsol_event = alc663_m51va_unsol_event,
15827 .init_hook = alc663_m51va_inithook,
15829 [ALC663_ASUS_G71V] = {
15830 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
15831 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
15832 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15833 .dac_nids = alc662_dac_nids,
15834 .dig_out_nid = ALC662_DIGOUT_NID,
15835 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15836 .channel_mode = alc662_3ST_2ch_modes,
15837 .input_mux = &alc662_eeepc_capture_source,
15838 .unsol_event = alc663_g71v_unsol_event,
15839 .init_hook = alc663_g71v_inithook,
15841 [ALC663_ASUS_H13] = {
15842 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15843 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15844 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15845 .dac_nids = alc662_dac_nids,
15846 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15847 .channel_mode = alc662_3ST_2ch_modes,
15848 .input_mux = &alc663_m51va_capture_source,
15849 .unsol_event = alc663_m51va_unsol_event,
15850 .init_hook = alc663_m51va_inithook,
15852 [ALC663_ASUS_G50V] = {
15853 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
15854 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
15855 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15856 .dac_nids = alc662_dac_nids,
15857 .dig_out_nid = ALC662_DIGOUT_NID,
15858 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15859 .channel_mode = alc662_3ST_6ch_modes,
15860 .input_mux = &alc663_capture_source,
15861 .unsol_event = alc663_g50v_unsol_event,
15862 .init_hook = alc663_g50v_inithook,
15864 [ALC663_ASUS_MODE1] = {
15865 .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer },
15866 .init_verbs = { alc662_init_verbs,
15867 alc663_21jd_amic_init_verbs },
15868 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15870 .dac_nids = alc662_dac_nids,
15871 .dig_out_nid = ALC662_DIGOUT_NID,
15872 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15873 .channel_mode = alc662_3ST_2ch_modes,
15874 .input_mux = &alc662_eeepc_capture_source,
15875 .unsol_event = alc663_mode1_unsol_event,
15876 .init_hook = alc663_mode1_inithook,
15878 [ALC662_ASUS_MODE2] = {
15879 .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer },
15880 .init_verbs = { alc662_init_verbs,
15881 alc662_1bjd_amic_init_verbs },
15882 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15883 .dac_nids = alc662_dac_nids,
15884 .dig_out_nid = ALC662_DIGOUT_NID,
15885 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15886 .channel_mode = alc662_3ST_2ch_modes,
15887 .input_mux = &alc662_eeepc_capture_source,
15888 .unsol_event = alc662_mode2_unsol_event,
15889 .init_hook = alc662_mode2_inithook,
15891 [ALC663_ASUS_MODE3] = {
15892 .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer },
15893 .init_verbs = { alc662_init_verbs,
15894 alc663_two_hp_amic_m1_init_verbs },
15895 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15897 .dac_nids = alc662_dac_nids,
15898 .dig_out_nid = ALC662_DIGOUT_NID,
15899 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15900 .channel_mode = alc662_3ST_2ch_modes,
15901 .input_mux = &alc662_eeepc_capture_source,
15902 .unsol_event = alc663_mode3_unsol_event,
15903 .init_hook = alc663_mode3_inithook,
15905 [ALC663_ASUS_MODE4] = {
15906 .mixers = { alc663_asus_21jd_clfe_mixer,
15907 alc662_auto_capture_mixer},
15908 .init_verbs = { alc662_init_verbs,
15909 alc663_21jd_amic_init_verbs},
15910 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15912 .dac_nids = alc662_dac_nids,
15913 .dig_out_nid = ALC662_DIGOUT_NID,
15914 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15915 .channel_mode = alc662_3ST_2ch_modes,
15916 .input_mux = &alc662_eeepc_capture_source,
15917 .unsol_event = alc663_mode4_unsol_event,
15918 .init_hook = alc663_mode4_inithook,
15920 [ALC663_ASUS_MODE5] = {
15921 .mixers = { alc663_asus_15jd_clfe_mixer,
15922 alc662_auto_capture_mixer },
15923 .init_verbs = { alc662_init_verbs,
15924 alc663_15jd_amic_init_verbs },
15925 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15927 .dac_nids = alc662_dac_nids,
15928 .dig_out_nid = ALC662_DIGOUT_NID,
15929 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15930 .channel_mode = alc662_3ST_2ch_modes,
15931 .input_mux = &alc662_eeepc_capture_source,
15932 .unsol_event = alc663_mode5_unsol_event,
15933 .init_hook = alc663_mode5_inithook,
15935 [ALC663_ASUS_MODE6] = {
15936 .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer },
15937 .init_verbs = { alc662_init_verbs,
15938 alc663_two_hp_amic_m2_init_verbs },
15939 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15941 .dac_nids = alc662_dac_nids,
15942 .dig_out_nid = ALC662_DIGOUT_NID,
15943 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15944 .channel_mode = alc662_3ST_2ch_modes,
15945 .input_mux = &alc662_eeepc_capture_source,
15946 .unsol_event = alc663_mode6_unsol_event,
15947 .init_hook = alc663_mode6_inithook,
15953 * BIOS auto configuration
15956 /* add playback controls from the parsed DAC table */
15957 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
15958 const struct auto_pin_cfg *cfg)
15961 static const char *chname[4] = {
15962 "Front", "Surround", NULL /*CLFE*/, "Side"
15967 for (i = 0; i < cfg->line_outs; i++) {
15968 if (!spec->multiout.dac_nids[i])
15970 nid = alc880_idx_to_dac(i);
15973 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15974 "Center Playback Volume",
15975 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
15979 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15980 "LFE Playback Volume",
15981 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
15985 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
15986 "Center Playback Switch",
15987 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
15991 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
15992 "LFE Playback Switch",
15993 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
15998 sprintf(name, "%s Playback Volume", chname[i]);
15999 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16000 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16004 sprintf(name, "%s Playback Switch", chname[i]);
16005 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16006 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16015 /* add playback controls for speaker and HP outputs */
16016 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16027 /* ALC663 has a mono output pin on 0x17 */
16028 sprintf(name, "%s Playback Switch", pfx);
16029 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16030 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16034 if (alc880_is_fixed_pin(pin)) {
16035 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16036 /* printk("DAC nid=%x\n",nid); */
16037 /* specify the DAC as the extra output */
16038 if (!spec->multiout.hp_nid)
16039 spec->multiout.hp_nid = nid;
16041 spec->multiout.extra_out_nid[0] = nid;
16042 /* control HP volume/switch on the output mixer amp */
16043 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16044 sprintf(name, "%s Playback Volume", pfx);
16045 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16046 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16049 sprintf(name, "%s Playback Switch", pfx);
16050 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16051 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16054 } else if (alc880_is_multi_pin(pin)) {
16055 /* set manual connection */
16056 /* we have only a switch on HP-out PIN */
16057 sprintf(name, "%s Playback Switch", pfx);
16058 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16059 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16066 /* create playback/capture controls for input pins */
16067 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16068 const struct auto_pin_cfg *cfg)
16070 struct hda_input_mux *imux = &spec->private_imux;
16073 for (i = 0; i < AUTO_PIN_LAST; i++) {
16074 if (alc880_is_input_pin(cfg->input_pins[i])) {
16075 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16076 err = new_analog_input(spec, cfg->input_pins[i],
16077 auto_pin_cfg_labels[i],
16081 imux->items[imux->num_items].label =
16082 auto_pin_cfg_labels[i];
16083 imux->items[imux->num_items].index =
16084 alc880_input_pin_idx(cfg->input_pins[i]);
16091 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16092 hda_nid_t nid, int pin_type,
16095 alc_set_pin_output(codec, nid, pin_type);
16096 /* need the manual connection? */
16097 if (alc880_is_multi_pin(nid)) {
16098 struct alc_spec *spec = codec->spec;
16099 int idx = alc880_multi_pin_idx(nid);
16100 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16101 AC_VERB_SET_CONNECT_SEL,
16102 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16106 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16108 struct alc_spec *spec = codec->spec;
16111 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16112 for (i = 0; i <= HDA_SIDE; i++) {
16113 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16114 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16116 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16121 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16123 struct alc_spec *spec = codec->spec;
16126 pin = spec->autocfg.hp_pins[0];
16127 if (pin) /* connect to front */
16129 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16130 pin = spec->autocfg.speaker_pins[0];
16132 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16135 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16136 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16138 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16140 struct alc_spec *spec = codec->spec;
16143 for (i = 0; i < AUTO_PIN_LAST; i++) {
16144 hda_nid_t nid = spec->autocfg.input_pins[i];
16145 if (alc662_is_input_pin(nid)) {
16146 snd_hda_codec_write(codec, nid, 0,
16147 AC_VERB_SET_PIN_WIDGET_CONTROL,
16148 (i <= AUTO_PIN_FRONT_MIC ?
16149 PIN_VREF80 : PIN_IN));
16150 if (nid != ALC662_PIN_CD_NID)
16151 snd_hda_codec_write(codec, nid, 0,
16152 AC_VERB_SET_AMP_GAIN_MUTE,
16158 #define alc662_auto_init_input_src alc882_auto_init_input_src
16160 static int alc662_parse_auto_config(struct hda_codec *codec)
16162 struct alc_spec *spec = codec->spec;
16164 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16166 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16170 if (!spec->autocfg.line_outs)
16171 return 0; /* can't find valid BIOS pin config */
16173 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16176 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16179 err = alc662_auto_create_extra_out(spec,
16180 spec->autocfg.speaker_pins[0],
16184 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16188 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16192 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16194 if (spec->autocfg.dig_out_pin)
16195 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16197 if (spec->kctl_alloc)
16198 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
16200 spec->num_mux_defs = 1;
16201 spec->input_mux = &spec->private_imux;
16203 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
16204 if (codec->vendor_id == 0x10ec0663)
16205 spec->init_verbs[spec->num_init_verbs++] =
16206 alc663_auto_init_verbs;
16208 err = alc_auto_add_mic_boost(codec);
16212 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
16213 spec->num_mixers++;
16217 /* additional initialization for auto-configuration model */
16218 static void alc662_auto_init(struct hda_codec *codec)
16220 struct alc_spec *spec = codec->spec;
16221 alc662_auto_init_multi_out(codec);
16222 alc662_auto_init_hp_out(codec);
16223 alc662_auto_init_analog_input(codec);
16224 alc662_auto_init_input_src(codec);
16225 if (spec->unsol_event)
16226 alc_sku_automute(codec);
16229 static int patch_alc662(struct hda_codec *codec)
16231 struct alc_spec *spec;
16232 int err, board_config;
16234 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16238 codec->spec = spec;
16240 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16242 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16245 if (board_config < 0) {
16246 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16247 "trying auto-probe from BIOS...\n");
16248 board_config = ALC662_AUTO;
16251 if (board_config == ALC662_AUTO) {
16252 /* automatic parse from the BIOS config */
16253 err = alc662_parse_auto_config(codec);
16259 "hda_codec: Cannot set up configuration "
16260 "from BIOS. Using base mode...\n");
16261 board_config = ALC662_3ST_2ch_DIG;
16265 if (board_config != ALC662_AUTO)
16266 setup_preset(spec, &alc662_presets[board_config]);
16268 if (codec->vendor_id == 0x10ec0663) {
16269 spec->stream_name_analog = "ALC663 Analog";
16270 spec->stream_name_digital = "ALC663 Digital";
16272 spec->stream_name_analog = "ALC662 Analog";
16273 spec->stream_name_digital = "ALC662 Digital";
16276 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16277 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16279 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16280 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16282 spec->adc_nids = alc662_adc_nids;
16283 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16284 spec->capsrc_nids = alc662_capsrc_nids;
16286 spec->vmaster_nid = 0x02;
16288 codec->patch_ops = alc_patch_ops;
16289 if (board_config == ALC662_AUTO)
16290 spec->init_hook = alc662_auto_init;
16291 #ifdef CONFIG_SND_HDA_POWER_SAVE
16292 if (!spec->loopback.amplist)
16293 spec->loopback.amplist = alc662_loopbacks;
16302 struct hda_codec_preset snd_hda_preset_realtek[] = {
16303 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16304 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16305 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16306 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16307 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16308 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16309 .patch = patch_alc861 },
16310 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16311 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16312 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16313 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16314 .patch = patch_alc883 },
16315 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16316 .patch = patch_alc662 },
16317 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16318 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16319 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16320 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16321 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16322 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16323 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16324 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16325 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16326 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16327 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16328 {} /* terminator */