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;
311 #ifdef SND_HDA_NEEDS_RESUME
312 #define ALC_MAX_PINS 16
313 unsigned int num_pins;
314 hda_nid_t pin_nids[ALC_MAX_PINS];
315 unsigned int pin_cfgs[ALC_MAX_PINS];
320 * configuration template - to be copied to the spec instance
322 struct alc_config_preset {
323 struct snd_kcontrol_new *mixers[5]; /* should be identical size
326 const struct hda_verb *init_verbs[5];
327 unsigned int num_dacs;
329 hda_nid_t dig_out_nid; /* optional */
330 hda_nid_t hp_nid; /* optional */
331 unsigned int num_adc_nids;
333 hda_nid_t *capsrc_nids;
334 hda_nid_t dig_in_nid;
335 unsigned int num_channel_mode;
336 const struct hda_channel_mode *channel_mode;
338 unsigned int num_mux_defs;
339 const struct hda_input_mux *input_mux;
340 void (*unsol_event)(struct hda_codec *, unsigned int);
341 void (*init_hook)(struct hda_codec *);
342 #ifdef CONFIG_SND_HDA_POWER_SAVE
343 struct hda_amp_list *loopbacks;
351 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
352 struct snd_ctl_elem_info *uinfo)
354 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
355 struct alc_spec *spec = codec->spec;
356 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
357 if (mux_idx >= spec->num_mux_defs)
359 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
362 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
363 struct snd_ctl_elem_value *ucontrol)
365 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
366 struct alc_spec *spec = codec->spec;
367 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
369 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
373 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
374 struct snd_ctl_elem_value *ucontrol)
376 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
377 struct alc_spec *spec = codec->spec;
378 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
379 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
380 hda_nid_t nid = spec->capsrc_nids ?
381 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
382 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
383 nid, &spec->cur_mux[adc_idx]);
388 * channel mode setting
390 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
391 struct snd_ctl_elem_info *uinfo)
393 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
394 struct alc_spec *spec = codec->spec;
395 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
396 spec->num_channel_mode);
399 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
400 struct snd_ctl_elem_value *ucontrol)
402 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
403 struct alc_spec *spec = codec->spec;
404 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
405 spec->num_channel_mode,
406 spec->multiout.max_channels);
409 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
410 struct snd_ctl_elem_value *ucontrol)
412 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
413 struct alc_spec *spec = codec->spec;
414 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
415 spec->num_channel_mode,
416 &spec->multiout.max_channels);
417 if (err >= 0 && spec->need_dac_fix)
418 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
423 * Control the mode of pin widget settings via the mixer. "pc" is used
424 * instead of "%" to avoid consequences of accidently treating the % as
425 * being part of a format specifier. Maximum allowed length of a value is
426 * 63 characters plus NULL terminator.
428 * Note: some retasking pin complexes seem to ignore requests for input
429 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
430 * are requested. Therefore order this list so that this behaviour will not
431 * cause problems when mixer clients move through the enum sequentially.
432 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
435 static char *alc_pin_mode_names[] = {
436 "Mic 50pc bias", "Mic 80pc bias",
437 "Line in", "Line out", "Headphone out",
439 static unsigned char alc_pin_mode_values[] = {
440 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
442 /* The control can present all 5 options, or it can limit the options based
443 * in the pin being assumed to be exclusively an input or an output pin. In
444 * addition, "input" pins may or may not process the mic bias option
445 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
446 * accept requests for bias as of chip versions up to March 2006) and/or
447 * wiring in the computer.
449 #define ALC_PIN_DIR_IN 0x00
450 #define ALC_PIN_DIR_OUT 0x01
451 #define ALC_PIN_DIR_INOUT 0x02
452 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
453 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
455 /* Info about the pin modes supported by the different pin direction modes.
456 * For each direction the minimum and maximum values are given.
458 static signed char alc_pin_mode_dir_info[5][2] = {
459 { 0, 2 }, /* ALC_PIN_DIR_IN */
460 { 3, 4 }, /* ALC_PIN_DIR_OUT */
461 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
462 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
463 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
465 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
466 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
467 #define alc_pin_mode_n_items(_dir) \
468 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
470 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
471 struct snd_ctl_elem_info *uinfo)
473 unsigned int item_num = uinfo->value.enumerated.item;
474 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
476 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
478 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
480 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
481 item_num = alc_pin_mode_min(dir);
482 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
486 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
487 struct snd_ctl_elem_value *ucontrol)
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 hda_nid_t nid = kcontrol->private_value & 0xffff;
492 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
493 long *valp = ucontrol->value.integer.value;
494 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
495 AC_VERB_GET_PIN_WIDGET_CONTROL,
498 /* Find enumerated value for current pinctl setting */
499 i = alc_pin_mode_min(dir);
500 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
502 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
506 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
507 struct snd_ctl_elem_value *ucontrol)
510 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
511 hda_nid_t nid = kcontrol->private_value & 0xffff;
512 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
513 long val = *ucontrol->value.integer.value;
514 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
515 AC_VERB_GET_PIN_WIDGET_CONTROL,
518 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
519 val = alc_pin_mode_min(dir);
521 change = pinctl != alc_pin_mode_values[val];
523 /* Set pin mode to that requested */
524 snd_hda_codec_write_cache(codec, nid, 0,
525 AC_VERB_SET_PIN_WIDGET_CONTROL,
526 alc_pin_mode_values[val]);
528 /* Also enable the retasking pin's input/output as required
529 * for the requested pin mode. Enum values of 2 or less are
532 * Dynamically switching the input/output buffers probably
533 * reduces noise slightly (particularly on input) so we'll
534 * do it. However, having both input and output buffers
535 * enabled simultaneously doesn't seem to be problematic if
536 * this turns out to be necessary in the future.
539 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
540 HDA_AMP_MUTE, HDA_AMP_MUTE);
541 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
544 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
545 HDA_AMP_MUTE, HDA_AMP_MUTE);
546 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
553 #define ALC_PIN_MODE(xname, nid, dir) \
554 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
555 .info = alc_pin_mode_info, \
556 .get = alc_pin_mode_get, \
557 .put = alc_pin_mode_put, \
558 .private_value = nid | (dir<<16) }
560 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
561 * together using a mask with more than one bit set. This control is
562 * currently used only by the ALC260 test model. At this stage they are not
563 * needed for any "production" models.
565 #ifdef CONFIG_SND_DEBUG
566 #define alc_gpio_data_info snd_ctl_boolean_mono_info
568 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
569 struct snd_ctl_elem_value *ucontrol)
571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
572 hda_nid_t nid = kcontrol->private_value & 0xffff;
573 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
574 long *valp = ucontrol->value.integer.value;
575 unsigned int val = snd_hda_codec_read(codec, nid, 0,
576 AC_VERB_GET_GPIO_DATA, 0x00);
578 *valp = (val & mask) != 0;
581 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
582 struct snd_ctl_elem_value *ucontrol)
585 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
586 hda_nid_t nid = kcontrol->private_value & 0xffff;
587 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
588 long val = *ucontrol->value.integer.value;
589 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
590 AC_VERB_GET_GPIO_DATA,
593 /* Set/unset the masked GPIO bit(s) as needed */
594 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
599 snd_hda_codec_write_cache(codec, nid, 0,
600 AC_VERB_SET_GPIO_DATA, gpio_data);
604 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
605 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
606 .info = alc_gpio_data_info, \
607 .get = alc_gpio_data_get, \
608 .put = alc_gpio_data_put, \
609 .private_value = nid | (mask<<16) }
610 #endif /* CONFIG_SND_DEBUG */
612 /* A switch control to allow the enabling of the digital IO pins on the
613 * ALC260. This is incredibly simplistic; the intention of this control is
614 * to provide something in the test model allowing digital outputs to be
615 * identified if present. If models are found which can utilise these
616 * outputs a more complete mixer control can be devised for those models if
619 #ifdef CONFIG_SND_DEBUG
620 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
622 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
623 struct snd_ctl_elem_value *ucontrol)
625 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
626 hda_nid_t nid = kcontrol->private_value & 0xffff;
627 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
628 long *valp = ucontrol->value.integer.value;
629 unsigned int val = snd_hda_codec_read(codec, nid, 0,
630 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
632 *valp = (val & mask) != 0;
635 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
636 struct snd_ctl_elem_value *ucontrol)
639 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
640 hda_nid_t nid = kcontrol->private_value & 0xffff;
641 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
642 long val = *ucontrol->value.integer.value;
643 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
644 AC_VERB_GET_DIGI_CONVERT_1,
647 /* Set/unset the masked control bit(s) as needed */
648 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
653 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
658 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
659 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
660 .info = alc_spdif_ctrl_info, \
661 .get = alc_spdif_ctrl_get, \
662 .put = alc_spdif_ctrl_put, \
663 .private_value = nid | (mask<<16) }
664 #endif /* CONFIG_SND_DEBUG */
666 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
667 * Again, this is only used in the ALC26x test models to help identify when
668 * the EAPD line must be asserted for features to work.
670 #ifdef CONFIG_SND_DEBUG
671 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
673 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
674 struct snd_ctl_elem_value *ucontrol)
676 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
677 hda_nid_t nid = kcontrol->private_value & 0xffff;
678 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
679 long *valp = ucontrol->value.integer.value;
680 unsigned int val = snd_hda_codec_read(codec, nid, 0,
681 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
683 *valp = (val & mask) != 0;
687 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
688 struct snd_ctl_elem_value *ucontrol)
691 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
692 hda_nid_t nid = kcontrol->private_value & 0xffff;
693 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
694 long val = *ucontrol->value.integer.value;
695 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
696 AC_VERB_GET_EAPD_BTLENABLE,
699 /* Set/unset the masked control bit(s) as needed */
700 change = (!val ? 0 : mask) != (ctrl_data & mask);
705 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
711 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
712 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
713 .info = alc_eapd_ctrl_info, \
714 .get = alc_eapd_ctrl_get, \
715 .put = alc_eapd_ctrl_put, \
716 .private_value = nid | (mask<<16) }
717 #endif /* CONFIG_SND_DEBUG */
720 * set up from the preset table
722 static void setup_preset(struct alc_spec *spec,
723 const struct alc_config_preset *preset)
727 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
728 spec->mixers[spec->num_mixers++] = preset->mixers[i];
729 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
731 spec->init_verbs[spec->num_init_verbs++] =
732 preset->init_verbs[i];
734 spec->channel_mode = preset->channel_mode;
735 spec->num_channel_mode = preset->num_channel_mode;
736 spec->need_dac_fix = preset->need_dac_fix;
738 spec->multiout.max_channels = spec->channel_mode[0].channels;
740 spec->multiout.num_dacs = preset->num_dacs;
741 spec->multiout.dac_nids = preset->dac_nids;
742 spec->multiout.dig_out_nid = preset->dig_out_nid;
743 spec->multiout.hp_nid = preset->hp_nid;
745 spec->num_mux_defs = preset->num_mux_defs;
746 if (!spec->num_mux_defs)
747 spec->num_mux_defs = 1;
748 spec->input_mux = preset->input_mux;
750 spec->num_adc_nids = preset->num_adc_nids;
751 spec->adc_nids = preset->adc_nids;
752 spec->capsrc_nids = preset->capsrc_nids;
753 spec->dig_in_nid = preset->dig_in_nid;
755 spec->unsol_event = preset->unsol_event;
756 spec->init_hook = preset->init_hook;
757 #ifdef CONFIG_SND_HDA_POWER_SAVE
758 spec->loopback.amplist = preset->loopbacks;
762 /* Enable GPIO mask and set output */
763 static struct hda_verb alc_gpio1_init_verbs[] = {
764 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
765 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
766 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
770 static struct hda_verb alc_gpio2_init_verbs[] = {
771 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
772 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
773 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
777 static struct hda_verb alc_gpio3_init_verbs[] = {
778 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
779 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
780 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
785 * Fix hardware PLL issue
786 * On some codecs, the analog PLL gating control must be off while
787 * the default value is 1.
789 static void alc_fix_pll(struct hda_codec *codec)
791 struct alc_spec *spec = codec->spec;
796 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
798 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
799 AC_VERB_GET_PROC_COEF, 0);
800 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
802 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
803 val & ~(1 << spec->pll_coef_bit));
806 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
807 unsigned int coef_idx, unsigned int coef_bit)
809 struct alc_spec *spec = codec->spec;
811 spec->pll_coef_idx = coef_idx;
812 spec->pll_coef_bit = coef_bit;
816 static void alc_sku_automute(struct hda_codec *codec)
818 struct alc_spec *spec = codec->spec;
819 unsigned int present;
820 unsigned int hp_nid = spec->autocfg.hp_pins[0];
821 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
823 /* need to execute and sync at first */
824 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
825 present = snd_hda_codec_read(codec, hp_nid, 0,
826 AC_VERB_GET_PIN_SENSE, 0);
827 spec->jack_present = (present & 0x80000000) != 0;
828 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
829 spec->jack_present ? 0 : PIN_OUT);
832 #if 0 /* it's broken in some acses -- temporarily disabled */
833 static void alc_mic_automute(struct hda_codec *codec)
835 struct alc_spec *spec = codec->spec;
836 unsigned int present;
837 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
838 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
839 unsigned int mix_nid = spec->capsrc_nids[0];
840 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
842 capsrc_idx_mic = mic_nid - 0x18;
843 capsrc_idx_fmic = fmic_nid - 0x18;
844 present = snd_hda_codec_read(codec, mic_nid, 0,
845 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
846 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
847 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
848 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
849 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
850 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
851 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
854 #define alc_mic_automute(codec) /* NOP */
855 #endif /* disabled */
857 /* unsolicited event for HP jack sensing */
858 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
860 if (codec->vendor_id == 0x10ec0880)
864 if (res == ALC880_HP_EVENT)
865 alc_sku_automute(codec);
867 if (res == ALC880_MIC_EVENT)
868 alc_mic_automute(codec);
871 static void alc_inithook(struct hda_codec *codec)
873 alc_sku_automute(codec);
874 alc_mic_automute(codec);
877 /* additional initialization for ALC888 variants */
878 static void alc888_coef_init(struct hda_codec *codec)
882 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
883 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
884 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
885 if ((tmp & 0xf0) == 2)
887 snd_hda_codec_read(codec, 0x20, 0,
888 AC_VERB_SET_PROC_COEF, 0x830);
891 snd_hda_codec_read(codec, 0x20, 0,
892 AC_VERB_SET_PROC_COEF, 0x3030);
895 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
896 * 31 ~ 16 : Manufacture ID
898 * 7 ~ 0 : Assembly ID
899 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
901 static void alc_subsystem_id(struct hda_codec *codec,
902 unsigned int porta, unsigned int porte,
905 unsigned int ass, tmp, i;
907 struct alc_spec *spec = codec->spec;
909 ass = codec->subsystem_id & 0xffff;
910 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
914 * 31~30 : port conetcivity
917 * 19~16 : Check sum (15:1)
922 if (codec->vendor_id == 0x10ec0260)
924 ass = snd_hda_codec_read(codec, nid, 0,
925 AC_VERB_GET_CONFIG_DEFAULT, 0);
926 if (!(ass & 1) && !(ass & 0x100000))
928 if ((ass >> 30) != 1) /* no physical connection */
933 for (i = 1; i < 16; i++) {
937 if (((ass >> 16) & 0xf) != tmp)
943 * 2 : 0 --> Desktop, 1 --> Laptop
944 * 3~5 : External Amplifier control
947 tmp = (ass & 0x38) >> 3; /* external Amp control */
950 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
953 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
956 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
958 case 5: /* set EAPD output high */
959 switch (codec->vendor_id) {
961 snd_hda_codec_write(codec, 0x0f, 0,
962 AC_VERB_SET_EAPD_BTLENABLE, 2);
963 snd_hda_codec_write(codec, 0x10, 0,
964 AC_VERB_SET_EAPD_BTLENABLE, 2);
975 snd_hda_codec_write(codec, 0x14, 0,
976 AC_VERB_SET_EAPD_BTLENABLE, 2);
977 snd_hda_codec_write(codec, 0x15, 0,
978 AC_VERB_SET_EAPD_BTLENABLE, 2);
981 switch (codec->vendor_id) {
983 snd_hda_codec_write(codec, 0x1a, 0,
984 AC_VERB_SET_COEF_INDEX, 7);
985 tmp = snd_hda_codec_read(codec, 0x1a, 0,
986 AC_VERB_GET_PROC_COEF, 0);
987 snd_hda_codec_write(codec, 0x1a, 0,
988 AC_VERB_SET_COEF_INDEX, 7);
989 snd_hda_codec_write(codec, 0x1a, 0,
990 AC_VERB_SET_PROC_COEF,
999 snd_hda_codec_write(codec, 0x20, 0,
1000 AC_VERB_SET_COEF_INDEX, 7);
1001 tmp = snd_hda_codec_read(codec, 0x20, 0,
1002 AC_VERB_GET_PROC_COEF, 0);
1003 snd_hda_codec_write(codec, 0x20, 0,
1004 AC_VERB_SET_COEF_INDEX, 7);
1005 snd_hda_codec_write(codec, 0x20, 0,
1006 AC_VERB_SET_PROC_COEF,
1010 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1014 snd_hda_codec_write(codec, 0x20, 0,
1015 AC_VERB_SET_COEF_INDEX, 7);
1016 tmp = snd_hda_codec_read(codec, 0x20, 0,
1017 AC_VERB_GET_PROC_COEF, 0);
1018 snd_hda_codec_write(codec, 0x20, 0,
1019 AC_VERB_SET_COEF_INDEX, 7);
1020 snd_hda_codec_write(codec, 0x20, 0,
1021 AC_VERB_SET_PROC_COEF,
1029 /* is laptop or Desktop and enable the function "Mute internal speaker
1030 * when the external headphone out jack is plugged"
1032 if (!(ass & 0x8000))
1035 * 10~8 : Jack location
1036 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1038 * 15 : 1 --> enable the function "Mute internal speaker
1039 * when the external headphone out jack is plugged"
1041 if (!spec->autocfg.speaker_pins[0]) {
1042 if (spec->autocfg.line_out_pins[0])
1043 spec->autocfg.speaker_pins[0] =
1044 spec->autocfg.line_out_pins[0];
1049 if (!spec->autocfg.hp_pins[0]) {
1050 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1052 spec->autocfg.hp_pins[0] = porta;
1054 spec->autocfg.hp_pins[0] = porte;
1056 spec->autocfg.hp_pins[0] = portd;
1060 if (spec->autocfg.hp_pins[0])
1061 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1062 AC_VERB_SET_UNSOLICITED_ENABLE,
1063 AC_USRSP_EN | ALC880_HP_EVENT);
1065 #if 0 /* it's broken in some acses -- temporarily disabled */
1066 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1067 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1068 snd_hda_codec_write(codec,
1069 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1070 AC_VERB_SET_UNSOLICITED_ENABLE,
1071 AC_USRSP_EN | ALC880_MIC_EVENT);
1072 #endif /* disabled */
1074 spec->unsol_event = alc_sku_unsol_event;
1078 * Fix-up pin default configurations
1086 static void alc_fix_pincfg(struct hda_codec *codec,
1087 const struct snd_pci_quirk *quirk,
1088 const struct alc_pincfg **pinfix)
1090 const struct alc_pincfg *cfg;
1092 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1096 cfg = pinfix[quirk->value];
1097 for (; cfg->nid; cfg++) {
1100 for (i = 0; i < 4; i++) {
1101 snd_hda_codec_write(codec, cfg->nid, 0,
1102 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1110 * ALC880 3-stack model
1112 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1113 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1114 * F-Mic = 0x1b, HP = 0x19
1117 static hda_nid_t alc880_dac_nids[4] = {
1118 /* front, rear, clfe, rear_surr */
1119 0x02, 0x05, 0x04, 0x03
1122 static hda_nid_t alc880_adc_nids[3] = {
1127 /* The datasheet says the node 0x07 is connected from inputs,
1128 * but it shows zero connection in the real implementation on some devices.
1129 * Note: this is a 915GAV bug, fixed on 915GLV
1131 static hda_nid_t alc880_adc_nids_alt[2] = {
1136 #define ALC880_DIGOUT_NID 0x06
1137 #define ALC880_DIGIN_NID 0x0a
1139 static struct hda_input_mux alc880_capture_source = {
1143 { "Front Mic", 0x3 },
1149 /* channel source setting (2/6 channel selection for 3-stack) */
1151 static struct hda_verb alc880_threestack_ch2_init[] = {
1152 /* set line-in to input, mute it */
1153 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1154 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1155 /* set mic-in to input vref 80%, mute it */
1156 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1157 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1162 static struct hda_verb alc880_threestack_ch6_init[] = {
1163 /* set line-in to output, unmute it */
1164 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1165 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1166 /* set mic-in to output, unmute it */
1167 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1168 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1172 static struct hda_channel_mode alc880_threestack_modes[2] = {
1173 { 2, alc880_threestack_ch2_init },
1174 { 6, alc880_threestack_ch6_init },
1177 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1178 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1179 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1180 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1181 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1182 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1183 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1184 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1185 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1186 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1187 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1188 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1189 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1192 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1193 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1194 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1195 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1196 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1198 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1199 .name = "Channel Mode",
1200 .info = alc_ch_mode_info,
1201 .get = alc_ch_mode_get,
1202 .put = alc_ch_mode_put,
1207 /* capture mixer elements */
1208 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1209 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1210 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1211 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1212 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1213 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1214 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1216 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1217 /* The multiple "Capture Source" controls confuse alsamixer
1218 * So call somewhat different..
1220 /* .name = "Capture Source", */
1221 .name = "Input Source",
1223 .info = alc_mux_enum_info,
1224 .get = alc_mux_enum_get,
1225 .put = alc_mux_enum_put,
1230 /* capture mixer elements (in case NID 0x07 not available) */
1231 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1232 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1233 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1234 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1235 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1238 /* The multiple "Capture Source" controls confuse alsamixer
1239 * So call somewhat different..
1241 /* .name = "Capture Source", */
1242 .name = "Input Source",
1244 .info = alc_mux_enum_info,
1245 .get = alc_mux_enum_get,
1246 .put = alc_mux_enum_put,
1254 * ALC880 5-stack model
1256 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1258 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1259 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1262 /* additional mixers to alc880_three_stack_mixer */
1263 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1264 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1265 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1269 /* channel source setting (6/8 channel selection for 5-stack) */
1271 static struct hda_verb alc880_fivestack_ch6_init[] = {
1272 /* set line-in to input, mute it */
1273 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1274 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1279 static struct hda_verb alc880_fivestack_ch8_init[] = {
1280 /* set line-in to output, unmute it */
1281 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1282 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1286 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1287 { 6, alc880_fivestack_ch6_init },
1288 { 8, alc880_fivestack_ch8_init },
1293 * ALC880 6-stack model
1295 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1296 * Side = 0x05 (0x0f)
1297 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1298 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1301 static hda_nid_t alc880_6st_dac_nids[4] = {
1302 /* front, rear, clfe, rear_surr */
1303 0x02, 0x03, 0x04, 0x05
1306 static struct hda_input_mux alc880_6stack_capture_source = {
1310 { "Front Mic", 0x1 },
1316 /* fixed 8-channels */
1317 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1321 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1322 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1323 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1324 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1325 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1326 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1327 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1328 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1329 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1330 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1331 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1332 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1333 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1334 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1335 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1338 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1339 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1340 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1341 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1343 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1344 .name = "Channel Mode",
1345 .info = alc_ch_mode_info,
1346 .get = alc_ch_mode_get,
1347 .put = alc_ch_mode_put,
1356 * W810 has rear IO for:
1359 * Center/LFE (DAC 04)
1362 * The system also has a pair of internal speakers, and a headphone jack.
1363 * These are both connected to Line2 on the codec, hence to DAC 02.
1365 * There is a variable resistor to control the speaker or headphone
1366 * volume. This is a hardware-only device without a software API.
1368 * Plugging headphones in will disable the internal speakers. This is
1369 * implemented in hardware, not via the driver using jack sense. In
1370 * a similar fashion, plugging into the rear socket marked "front" will
1371 * disable both the speakers and headphones.
1373 * For input, there's a microphone jack, and an "audio in" jack.
1374 * These may not do anything useful with this driver yet, because I
1375 * haven't setup any initialization verbs for these yet...
1378 static hda_nid_t alc880_w810_dac_nids[3] = {
1379 /* front, rear/surround, clfe */
1383 /* fixed 6 channels */
1384 static struct hda_channel_mode alc880_w810_modes[1] = {
1388 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1389 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1390 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1391 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1392 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1393 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1394 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1395 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1396 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1397 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1406 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1407 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1411 static hda_nid_t alc880_z71v_dac_nids[1] = {
1414 #define ALC880_Z71V_HP_DAC 0x03
1416 /* fixed 2 channels */
1417 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1421 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1422 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1423 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1424 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1425 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1426 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1427 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1435 * ALC880 F1734 model
1437 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1438 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1441 static hda_nid_t alc880_f1734_dac_nids[1] = {
1444 #define ALC880_F1734_HP_DAC 0x02
1446 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1447 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1448 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1449 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1450 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1451 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1452 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1458 static struct hda_input_mux alc880_f1734_capture_source = {
1470 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1471 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1472 * Mic = 0x18, Line = 0x1a
1475 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1476 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1478 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1479 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1480 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1481 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1482 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1483 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1484 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1485 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1486 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1487 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1488 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1489 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1490 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1492 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1494 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1495 .name = "Channel Mode",
1496 .info = alc_ch_mode_info,
1497 .get = alc_ch_mode_get,
1498 .put = alc_ch_mode_put,
1504 * ALC880 ASUS W1V model
1506 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1507 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1508 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1511 /* additional mixers to alc880_asus_mixer */
1512 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1513 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1514 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1518 /* additional mixers to alc880_asus_mixer */
1519 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1520 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1521 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1526 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1527 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1528 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1529 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1530 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1531 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1533 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1534 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1535 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1538 /* The multiple "Capture Source" controls confuse alsamixer
1539 * So call somewhat different..
1541 /* .name = "Capture Source", */
1542 .name = "Input Source",
1544 .info = alc_mux_enum_info,
1545 .get = alc_mux_enum_get,
1546 .put = alc_mux_enum_put,
1552 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1553 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1554 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1555 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1556 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1557 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1558 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1559 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1560 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1561 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1562 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1563 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1564 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1565 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1566 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1567 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1568 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1569 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1570 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1572 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1573 .name = "Channel Mode",
1574 .info = alc_ch_mode_info,
1575 .get = alc_ch_mode_get,
1576 .put = alc_ch_mode_put,
1581 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1582 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1583 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1584 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1585 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1586 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1587 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1588 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1589 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1590 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1591 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1595 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1596 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1597 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1598 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1599 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1600 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1601 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1606 * virtual master controls
1610 * slave controls for virtual master
1612 static const char *alc_slave_vols[] = {
1613 "Front Playback Volume",
1614 "Surround Playback Volume",
1615 "Center Playback Volume",
1616 "LFE Playback Volume",
1617 "Side Playback Volume",
1618 "Headphone Playback Volume",
1619 "Speaker Playback Volume",
1620 "Mono Playback Volume",
1621 "Line-Out Playback Volume",
1625 static const char *alc_slave_sws[] = {
1626 "Front Playback Switch",
1627 "Surround Playback Switch",
1628 "Center Playback Switch",
1629 "LFE Playback Switch",
1630 "Side Playback Switch",
1631 "Headphone Playback Switch",
1632 "Speaker Playback Switch",
1633 "Mono Playback Switch",
1634 "IEC958 Playback Switch",
1639 * build control elements
1641 static int alc_build_controls(struct hda_codec *codec)
1643 struct alc_spec *spec = codec->spec;
1647 for (i = 0; i < spec->num_mixers; i++) {
1648 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1653 if (spec->multiout.dig_out_nid) {
1654 err = snd_hda_create_spdif_out_ctls(codec,
1655 spec->multiout.dig_out_nid);
1658 err = snd_hda_create_spdif_share_sw(codec,
1662 spec->multiout.share_spdif = 1;
1664 if (spec->dig_in_nid) {
1665 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1670 /* if we have no master control, let's create it */
1671 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1672 unsigned int vmaster_tlv[4];
1673 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1674 HDA_OUTPUT, vmaster_tlv);
1675 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1676 vmaster_tlv, alc_slave_vols);
1680 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1681 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1682 NULL, alc_slave_sws);
1692 * initialize the codec volumes, etc
1696 * generic initialization of ADC, input mixers and output mixers
1698 static struct hda_verb alc880_volume_init_verbs[] = {
1700 * Unmute ADC0-2 and set the default input to mic-in
1702 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1704 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1705 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1706 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1707 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1709 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1711 * Note: PASD motherboards uses the Line In 2 as the input for front
1714 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1717 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1718 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1719 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1720 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1724 * Set up output mixers (0x0c - 0x0f)
1726 /* set vol=0 to output mixers */
1727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1728 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1731 /* set up input amps for analog loopback */
1732 /* Amp Indices: DAC = 0, mixer = 1 */
1733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1734 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1738 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1739 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1740 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1746 * 3-stack pin configuration:
1747 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1749 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1751 * preset connection lists of input pins
1752 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1754 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1755 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1756 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1759 * Set pin mode and muting
1761 /* set front pin widgets 0x14 for output */
1762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1764 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1765 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1766 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1767 /* Mic2 (as headphone out) for HP output */
1768 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1769 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1770 /* Line In pin widget for input */
1771 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1772 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1773 /* Line2 (as front mic) pin widget for input and vref at 80% */
1774 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1775 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1776 /* CD pin widget for input */
1777 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1783 * 5-stack pin configuration:
1784 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1785 * line-in/side = 0x1a, f-mic = 0x1b
1787 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1789 * preset connection lists of input pins
1790 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1792 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1793 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1796 * Set pin mode and muting
1798 /* set pin widgets 0x14-0x17 for output */
1799 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1801 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1802 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1803 /* unmute pins for output (no gain on this amp) */
1804 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1807 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1809 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1812 /* Mic2 (as headphone out) for HP output */
1813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1815 /* Line In pin widget for input */
1816 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1817 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1818 /* Line2 (as front mic) pin widget for input and vref at 80% */
1819 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1820 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1821 /* CD pin widget for input */
1822 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1828 * W810 pin configuration:
1829 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1831 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1832 /* hphone/speaker input selector: front DAC */
1833 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1839 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1840 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1842 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1843 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1849 * Z71V pin configuration:
1850 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1852 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1853 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1854 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1858 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1859 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1860 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1861 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1867 * 6-stack pin configuration:
1868 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1869 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1871 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1872 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1875 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1877 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1878 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1879 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1880 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1881 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1885 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1886 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1887 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1888 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1889 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1890 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1891 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1897 * Uniwill pin configuration:
1898 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1901 static struct hda_verb alc880_uniwill_init_verbs[] = {
1902 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1904 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1905 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1906 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1907 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1908 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1909 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1910 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1911 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1914 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1915 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1916 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1917 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1919 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1920 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1921 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1922 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1923 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1924 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1925 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1926 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1927 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1929 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1930 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1937 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1939 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1940 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1942 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1943 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1944 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1945 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1946 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1947 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1948 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1949 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1950 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1951 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1952 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1953 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1955 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1956 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1957 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1958 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1959 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1960 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1962 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1963 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1968 static struct hda_verb alc880_beep_init_verbs[] = {
1969 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1973 /* toggle speaker-output according to the hp-jack state */
1974 static void alc880_uniwill_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,
1983 HDA_AMP_MUTE, bits);
1984 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1985 HDA_AMP_MUTE, bits);
1988 /* auto-toggle front mic */
1989 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1991 unsigned int present;
1994 present = snd_hda_codec_read(codec, 0x18, 0,
1995 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1996 bits = present ? HDA_AMP_MUTE : 0;
1997 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2000 static void alc880_uniwill_automute(struct hda_codec *codec)
2002 alc880_uniwill_hp_automute(codec);
2003 alc880_uniwill_mic_automute(codec);
2006 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2009 /* Looks like the unsol event is incompatible with the standard
2010 * definition. 4bit tag is placed at 28 bit!
2012 switch (res >> 28) {
2013 case ALC880_HP_EVENT:
2014 alc880_uniwill_hp_automute(codec);
2016 case ALC880_MIC_EVENT:
2017 alc880_uniwill_mic_automute(codec);
2022 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2024 unsigned int present;
2027 present = snd_hda_codec_read(codec, 0x14, 0,
2028 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2029 bits = present ? HDA_AMP_MUTE : 0;
2030 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2033 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2035 unsigned int present;
2037 present = snd_hda_codec_read(codec, 0x21, 0,
2038 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2039 present &= HDA_AMP_VOLMASK;
2040 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2041 HDA_AMP_VOLMASK, present);
2042 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2043 HDA_AMP_VOLMASK, present);
2046 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2049 /* Looks like the unsol event is incompatible with the standard
2050 * definition. 4bit tag is placed at 28 bit!
2052 if ((res >> 28) == ALC880_HP_EVENT)
2053 alc880_uniwill_p53_hp_automute(codec);
2054 if ((res >> 28) == ALC880_DCVOL_EVENT)
2055 alc880_uniwill_p53_dcvol_automute(codec);
2059 * F1734 pin configuration:
2060 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2062 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2063 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2064 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2065 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2066 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2067 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2069 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2070 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2071 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2072 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2074 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2076 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2077 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2078 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2080 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2081 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2082 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2084 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2085 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2091 * ASUS pin configuration:
2092 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2094 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2095 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2096 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2097 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2098 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2100 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2101 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2102 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2103 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2104 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2106 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2109 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2110 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2111 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2112 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2113 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2114 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2116 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2117 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2122 /* Enable GPIO mask and set output */
2123 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2124 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2126 /* Clevo m520g init */
2127 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2128 /* headphone output */
2129 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2131 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2132 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2134 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2135 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2137 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2138 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2139 /* Mic1 (rear panel) */
2140 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2141 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2142 /* Mic2 (front panel) */
2143 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2144 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2146 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2147 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2148 /* change to EAPD mode */
2149 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2150 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2155 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2156 /* change to EAPD mode */
2157 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2158 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2160 /* Headphone output */
2161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2163 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2164 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2166 /* Line In pin widget for input */
2167 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2168 /* CD pin widget for input */
2169 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2170 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2171 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2173 /* change to EAPD mode */
2174 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2175 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2181 * LG m1 express dual
2184 * Rear Line-In/Out (blue): 0x14
2185 * Build-in Mic-In: 0x15
2187 * HP-Out (green): 0x1b
2188 * Mic-In/Out (red): 0x19
2192 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2193 static hda_nid_t alc880_lg_dac_nids[3] = {
2197 /* seems analog CD is not working */
2198 static struct hda_input_mux alc880_lg_capture_source = {
2203 { "Internal Mic", 0x6 },
2207 /* 2,4,6 channel modes */
2208 static struct hda_verb alc880_lg_ch2_init[] = {
2209 /* set line-in and mic-in to input */
2210 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2211 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2215 static struct hda_verb alc880_lg_ch4_init[] = {
2216 /* set line-in to out and mic-in to input */
2217 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2218 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2222 static struct hda_verb alc880_lg_ch6_init[] = {
2223 /* set line-in and mic-in to output */
2224 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2225 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2229 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2230 { 2, alc880_lg_ch2_init },
2231 { 4, alc880_lg_ch4_init },
2232 { 6, alc880_lg_ch6_init },
2235 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2236 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2237 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2238 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2239 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2240 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2241 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2242 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2243 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2247 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2248 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2249 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2252 .name = "Channel Mode",
2253 .info = alc_ch_mode_info,
2254 .get = alc_ch_mode_get,
2255 .put = alc_ch_mode_put,
2260 static struct hda_verb alc880_lg_init_verbs[] = {
2261 /* set capture source to mic-in */
2262 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2263 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2264 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2265 /* mute all amp mixer inputs */
2266 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2269 /* line-in to input */
2270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2273 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2274 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2276 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2277 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2278 /* mic-in to input */
2279 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2280 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2281 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2283 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2284 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2285 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2287 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2291 /* toggle speaker-output according to the hp-jack state */
2292 static void alc880_lg_automute(struct hda_codec *codec)
2294 unsigned int present;
2297 present = snd_hda_codec_read(codec, 0x1b, 0,
2298 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2299 bits = present ? HDA_AMP_MUTE : 0;
2300 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2301 HDA_AMP_MUTE, bits);
2304 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2306 /* Looks like the unsol event is incompatible with the standard
2307 * definition. 4bit tag is placed at 28 bit!
2309 if ((res >> 28) == 0x01)
2310 alc880_lg_automute(codec);
2319 * Built-in Mic-In: 0x19
2325 static struct hda_input_mux alc880_lg_lw_capture_source = {
2329 { "Internal Mic", 0x1 },
2334 #define alc880_lg_lw_modes alc880_threestack_modes
2336 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2340 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2341 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2342 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2343 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2344 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2345 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2346 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2348 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2350 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2352 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2353 .name = "Channel Mode",
2354 .info = alc_ch_mode_info,
2355 .get = alc_ch_mode_get,
2356 .put = alc_ch_mode_put,
2361 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2362 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2363 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2364 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2366 /* set capture source to mic-in */
2367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2368 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2369 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2373 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2375 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2376 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2377 /* mic-in to input */
2378 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2379 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2381 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2382 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2384 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2388 /* toggle speaker-output according to the hp-jack state */
2389 static void alc880_lg_lw_automute(struct hda_codec *codec)
2391 unsigned int present;
2394 present = snd_hda_codec_read(codec, 0x1b, 0,
2395 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2396 bits = present ? HDA_AMP_MUTE : 0;
2397 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2398 HDA_AMP_MUTE, bits);
2401 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2403 /* Looks like the unsol event is incompatible with the standard
2404 * definition. 4bit tag is placed at 28 bit!
2406 if ((res >> 28) == 0x01)
2407 alc880_lg_lw_automute(codec);
2410 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2411 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2412 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2414 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2415 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2416 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2420 static struct hda_input_mux alc880_medion_rim_capture_source = {
2424 { "Internal Mic", 0x1 },
2428 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2429 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2432 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2434 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2435 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2436 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2437 /* Mic2 (as headphone out) for HP output */
2438 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2439 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2440 /* Internal Speaker */
2441 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2442 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2444 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2445 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2447 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2451 /* toggle speaker-output according to the hp-jack state */
2452 static void alc880_medion_rim_automute(struct hda_codec *codec)
2454 unsigned int present;
2457 present = snd_hda_codec_read(codec, 0x14, 0,
2458 AC_VERB_GET_PIN_SENSE, 0)
2459 & AC_PINSENSE_PRESENCE;
2460 bits = present ? HDA_AMP_MUTE : 0;
2461 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2462 HDA_AMP_MUTE, bits);
2464 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2466 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2469 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2472 /* Looks like the unsol event is incompatible with the standard
2473 * definition. 4bit tag is placed at 28 bit!
2475 if ((res >> 28) == ALC880_HP_EVENT)
2476 alc880_medion_rim_automute(codec);
2479 #ifdef CONFIG_SND_HDA_POWER_SAVE
2480 static struct hda_amp_list alc880_loopbacks[] = {
2481 { 0x0b, HDA_INPUT, 0 },
2482 { 0x0b, HDA_INPUT, 1 },
2483 { 0x0b, HDA_INPUT, 2 },
2484 { 0x0b, HDA_INPUT, 3 },
2485 { 0x0b, HDA_INPUT, 4 },
2489 static struct hda_amp_list alc880_lg_loopbacks[] = {
2490 { 0x0b, HDA_INPUT, 1 },
2491 { 0x0b, HDA_INPUT, 6 },
2492 { 0x0b, HDA_INPUT, 7 },
2501 static int alc_init(struct hda_codec *codec)
2503 struct alc_spec *spec = codec->spec;
2507 if (codec->vendor_id == 0x10ec0888)
2508 alc888_coef_init(codec);
2510 for (i = 0; i < spec->num_init_verbs; i++)
2511 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2513 if (spec->init_hook)
2514 spec->init_hook(codec);
2519 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2521 struct alc_spec *spec = codec->spec;
2523 if (spec->unsol_event)
2524 spec->unsol_event(codec, res);
2527 #ifdef CONFIG_SND_HDA_POWER_SAVE
2528 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2530 struct alc_spec *spec = codec->spec;
2531 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2536 * Analog playback callbacks
2538 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2539 struct hda_codec *codec,
2540 struct snd_pcm_substream *substream)
2542 struct alc_spec *spec = codec->spec;
2543 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2547 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2548 struct hda_codec *codec,
2549 unsigned int stream_tag,
2550 unsigned int format,
2551 struct snd_pcm_substream *substream)
2553 struct alc_spec *spec = codec->spec;
2554 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2555 stream_tag, format, substream);
2558 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2559 struct hda_codec *codec,
2560 struct snd_pcm_substream *substream)
2562 struct alc_spec *spec = codec->spec;
2563 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2569 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2570 struct hda_codec *codec,
2571 struct snd_pcm_substream *substream)
2573 struct alc_spec *spec = codec->spec;
2574 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2577 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2578 struct hda_codec *codec,
2579 unsigned int stream_tag,
2580 unsigned int format,
2581 struct snd_pcm_substream *substream)
2583 struct alc_spec *spec = codec->spec;
2584 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2585 stream_tag, format, substream);
2588 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2589 struct hda_codec *codec,
2590 struct snd_pcm_substream *substream)
2592 struct alc_spec *spec = codec->spec;
2593 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2599 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2600 struct hda_codec *codec,
2601 unsigned int stream_tag,
2602 unsigned int format,
2603 struct snd_pcm_substream *substream)
2605 struct alc_spec *spec = codec->spec;
2607 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2608 stream_tag, 0, format);
2612 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2613 struct hda_codec *codec,
2614 struct snd_pcm_substream *substream)
2616 struct alc_spec *spec = codec->spec;
2618 snd_hda_codec_cleanup_stream(codec,
2619 spec->adc_nids[substream->number + 1]);
2626 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2630 /* NID is set in alc_build_pcms */
2632 .open = alc880_playback_pcm_open,
2633 .prepare = alc880_playback_pcm_prepare,
2634 .cleanup = alc880_playback_pcm_cleanup
2638 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2642 /* NID is set in alc_build_pcms */
2645 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2649 /* NID is set in alc_build_pcms */
2652 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2653 .substreams = 2, /* can be overridden */
2656 /* NID is set in alc_build_pcms */
2658 .prepare = alc880_alt_capture_pcm_prepare,
2659 .cleanup = alc880_alt_capture_pcm_cleanup
2663 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2667 /* NID is set in alc_build_pcms */
2669 .open = alc880_dig_playback_pcm_open,
2670 .close = alc880_dig_playback_pcm_close,
2671 .prepare = alc880_dig_playback_pcm_prepare
2675 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2679 /* NID is set in alc_build_pcms */
2682 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2683 static struct hda_pcm_stream alc_pcm_null_stream = {
2689 static int alc_build_pcms(struct hda_codec *codec)
2691 struct alc_spec *spec = codec->spec;
2692 struct hda_pcm *info = spec->pcm_rec;
2695 codec->num_pcms = 1;
2696 codec->pcm_info = info;
2698 info->name = spec->stream_name_analog;
2699 if (spec->stream_analog_playback) {
2700 if (snd_BUG_ON(!spec->multiout.dac_nids))
2702 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2703 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2705 if (spec->stream_analog_capture) {
2706 if (snd_BUG_ON(!spec->adc_nids))
2708 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2709 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2712 if (spec->channel_mode) {
2713 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2714 for (i = 0; i < spec->num_channel_mode; i++) {
2715 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2716 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2721 /* SPDIF for stream index #1 */
2722 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2723 codec->num_pcms = 2;
2724 info = spec->pcm_rec + 1;
2725 info->name = spec->stream_name_digital;
2726 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2727 if (spec->multiout.dig_out_nid &&
2728 spec->stream_digital_playback) {
2729 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2730 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2732 if (spec->dig_in_nid &&
2733 spec->stream_digital_capture) {
2734 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2735 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2737 /* FIXME: do we need this for all Realtek codec models? */
2738 codec->spdif_status_reset = 1;
2741 /* If the use of more than one ADC is requested for the current
2742 * model, configure a second analog capture-only PCM.
2744 /* Additional Analaog capture for index #2 */
2745 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2746 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2747 codec->num_pcms = 3;
2748 info = spec->pcm_rec + 2;
2749 info->name = spec->stream_name_analog;
2750 if (spec->alt_dac_nid) {
2751 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2752 *spec->stream_analog_alt_playback;
2753 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2756 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2757 alc_pcm_null_stream;
2758 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2760 if (spec->num_adc_nids > 1) {
2761 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2762 *spec->stream_analog_alt_capture;
2763 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2765 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2766 spec->num_adc_nids - 1;
2768 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2769 alc_pcm_null_stream;
2770 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2777 static void alc_free(struct hda_codec *codec)
2779 struct alc_spec *spec = codec->spec;
2785 if (spec->kctl_alloc) {
2786 for (i = 0; i < spec->num_kctl_used; i++)
2787 kfree(spec->kctl_alloc[i].name);
2788 kfree(spec->kctl_alloc);
2791 codec->spec = NULL; /* to be sure */
2794 #ifdef SND_HDA_NEEDS_RESUME
2795 static void store_pin_configs(struct hda_codec *codec)
2797 struct alc_spec *spec = codec->spec;
2798 hda_nid_t nid, end_nid;
2800 end_nid = codec->start_nid + codec->num_nodes;
2801 for (nid = codec->start_nid; nid < end_nid; nid++) {
2802 unsigned int wid_caps = get_wcaps(codec, nid);
2803 unsigned int wid_type =
2804 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2805 if (wid_type != AC_WID_PIN)
2807 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
2809 spec->pin_nids[spec->num_pins] = nid;
2810 spec->pin_cfgs[spec->num_pins] =
2811 snd_hda_codec_read(codec, nid, 0,
2812 AC_VERB_GET_CONFIG_DEFAULT, 0);
2817 static void resume_pin_configs(struct hda_codec *codec)
2819 struct alc_spec *spec = codec->spec;
2822 for (i = 0; i < spec->num_pins; i++) {
2823 hda_nid_t pin_nid = spec->pin_nids[i];
2824 unsigned int pin_config = spec->pin_cfgs[i];
2825 snd_hda_codec_write(codec, pin_nid, 0,
2826 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2827 pin_config & 0x000000ff);
2828 snd_hda_codec_write(codec, pin_nid, 0,
2829 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2830 (pin_config & 0x0000ff00) >> 8);
2831 snd_hda_codec_write(codec, pin_nid, 0,
2832 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2833 (pin_config & 0x00ff0000) >> 16);
2834 snd_hda_codec_write(codec, pin_nid, 0,
2835 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2840 static int alc_resume(struct hda_codec *codec)
2842 resume_pin_configs(codec);
2843 codec->patch_ops.init(codec);
2844 snd_hda_codec_resume_amp(codec);
2845 snd_hda_codec_resume_cache(codec);
2849 #define store_pin_configs(codec)
2854 static struct hda_codec_ops alc_patch_ops = {
2855 .build_controls = alc_build_controls,
2856 .build_pcms = alc_build_pcms,
2859 .unsol_event = alc_unsol_event,
2860 #ifdef SND_HDA_NEEDS_RESUME
2861 .resume = alc_resume,
2863 #ifdef CONFIG_SND_HDA_POWER_SAVE
2864 .check_power_status = alc_check_power_status,
2870 * Test configuration for debugging
2872 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2875 #ifdef CONFIG_SND_DEBUG
2876 static hda_nid_t alc880_test_dac_nids[4] = {
2877 0x02, 0x03, 0x04, 0x05
2880 static struct hda_input_mux alc880_test_capture_source = {
2889 { "Surround", 0x6 },
2893 static struct hda_channel_mode alc880_test_modes[4] = {
2900 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2901 struct snd_ctl_elem_info *uinfo)
2903 static char *texts[] = {
2904 "N/A", "Line Out", "HP Out",
2905 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2907 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2909 uinfo->value.enumerated.items = 8;
2910 if (uinfo->value.enumerated.item >= 8)
2911 uinfo->value.enumerated.item = 7;
2912 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2916 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2917 struct snd_ctl_elem_value *ucontrol)
2919 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2920 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2921 unsigned int pin_ctl, item = 0;
2923 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2924 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2925 if (pin_ctl & AC_PINCTL_OUT_EN) {
2926 if (pin_ctl & AC_PINCTL_HP_EN)
2930 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2931 switch (pin_ctl & AC_PINCTL_VREFEN) {
2932 case AC_PINCTL_VREF_HIZ: item = 3; break;
2933 case AC_PINCTL_VREF_50: item = 4; break;
2934 case AC_PINCTL_VREF_GRD: item = 5; break;
2935 case AC_PINCTL_VREF_80: item = 6; break;
2936 case AC_PINCTL_VREF_100: item = 7; break;
2939 ucontrol->value.enumerated.item[0] = item;
2943 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2944 struct snd_ctl_elem_value *ucontrol)
2946 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2947 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2948 static unsigned int ctls[] = {
2949 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2950 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2951 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2952 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2953 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2954 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2956 unsigned int old_ctl, new_ctl;
2958 old_ctl = snd_hda_codec_read(codec, nid, 0,
2959 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2960 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2961 if (old_ctl != new_ctl) {
2963 snd_hda_codec_write_cache(codec, nid, 0,
2964 AC_VERB_SET_PIN_WIDGET_CONTROL,
2966 val = ucontrol->value.enumerated.item[0] >= 3 ?
2968 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2975 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2976 struct snd_ctl_elem_info *uinfo)
2978 static char *texts[] = {
2979 "Front", "Surround", "CLFE", "Side"
2981 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2983 uinfo->value.enumerated.items = 4;
2984 if (uinfo->value.enumerated.item >= 4)
2985 uinfo->value.enumerated.item = 3;
2986 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2990 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2991 struct snd_ctl_elem_value *ucontrol)
2993 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2994 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2997 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2998 ucontrol->value.enumerated.item[0] = sel & 3;
3002 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3003 struct snd_ctl_elem_value *ucontrol)
3005 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3006 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3009 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3010 if (ucontrol->value.enumerated.item[0] != sel) {
3011 sel = ucontrol->value.enumerated.item[0] & 3;
3012 snd_hda_codec_write_cache(codec, nid, 0,
3013 AC_VERB_SET_CONNECT_SEL, sel);
3019 #define PIN_CTL_TEST(xname,nid) { \
3020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3022 .info = alc_test_pin_ctl_info, \
3023 .get = alc_test_pin_ctl_get, \
3024 .put = alc_test_pin_ctl_put, \
3025 .private_value = nid \
3028 #define PIN_SRC_TEST(xname,nid) { \
3029 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3031 .info = alc_test_pin_src_info, \
3032 .get = alc_test_pin_src_get, \
3033 .put = alc_test_pin_src_put, \
3034 .private_value = nid \
3037 static struct snd_kcontrol_new alc880_test_mixer[] = {
3038 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3039 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3040 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3041 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3043 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3044 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3045 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3046 PIN_CTL_TEST("Front Pin Mode", 0x14),
3047 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3048 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3049 PIN_CTL_TEST("Side Pin Mode", 0x17),
3050 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3051 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3052 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3053 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3054 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3055 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3056 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3057 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3058 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3059 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3060 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3061 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3062 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3063 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3064 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3065 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3066 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3067 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3069 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3070 .name = "Channel Mode",
3071 .info = alc_ch_mode_info,
3072 .get = alc_ch_mode_get,
3073 .put = alc_ch_mode_put,
3078 static struct hda_verb alc880_test_init_verbs[] = {
3079 /* Unmute inputs of 0x0c - 0x0f */
3080 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3082 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3083 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3084 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3085 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3086 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3087 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3088 /* Vol output for 0x0c-0x0f */
3089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3090 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3091 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3092 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3093 /* Set output pins 0x14-0x17 */
3094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3096 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3097 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3098 /* Unmute output pins 0x14-0x17 */
3099 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3100 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3101 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3102 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3103 /* Set input pins 0x18-0x1c */
3104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3105 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3106 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3107 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3108 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3109 /* Mute input pins 0x18-0x1b */
3110 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3111 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3112 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3113 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3116 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3118 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3120 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3121 /* Analog input/passthru */
3122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3123 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3124 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3134 static const char *alc880_models[ALC880_MODEL_LAST] = {
3135 [ALC880_3ST] = "3stack",
3136 [ALC880_TCL_S700] = "tcl",
3137 [ALC880_3ST_DIG] = "3stack-digout",
3138 [ALC880_CLEVO] = "clevo",
3139 [ALC880_5ST] = "5stack",
3140 [ALC880_5ST_DIG] = "5stack-digout",
3141 [ALC880_W810] = "w810",
3142 [ALC880_Z71V] = "z71v",
3143 [ALC880_6ST] = "6stack",
3144 [ALC880_6ST_DIG] = "6stack-digout",
3145 [ALC880_ASUS] = "asus",
3146 [ALC880_ASUS_W1V] = "asus-w1v",
3147 [ALC880_ASUS_DIG] = "asus-dig",
3148 [ALC880_ASUS_DIG2] = "asus-dig2",
3149 [ALC880_UNIWILL_DIG] = "uniwill",
3150 [ALC880_UNIWILL_P53] = "uniwill-p53",
3151 [ALC880_FUJITSU] = "fujitsu",
3152 [ALC880_F1734] = "F1734",
3154 [ALC880_LG_LW] = "lg-lw",
3155 [ALC880_MEDION_RIM] = "medion",
3156 #ifdef CONFIG_SND_DEBUG
3157 [ALC880_TEST] = "test",
3159 [ALC880_AUTO] = "auto",
3162 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3163 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3164 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3165 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3166 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3167 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3168 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3169 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3170 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3171 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3172 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3173 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3174 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3175 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3176 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3177 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3178 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3179 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3180 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3181 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3182 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3183 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3184 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3185 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3186 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3187 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3188 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3189 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3190 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3191 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3192 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3193 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3194 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3195 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3196 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3197 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3198 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3199 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3200 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3201 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3202 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3203 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3204 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3205 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3206 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3207 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3208 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3209 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3210 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3211 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3212 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3213 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3214 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3215 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3216 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3217 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3218 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3219 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3220 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3221 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3222 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3223 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3224 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3225 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3226 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3227 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3228 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3229 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3230 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3231 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3232 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3233 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3238 * ALC880 codec presets
3240 static struct alc_config_preset alc880_presets[] = {
3242 .mixers = { alc880_three_stack_mixer },
3243 .init_verbs = { alc880_volume_init_verbs,
3244 alc880_pin_3stack_init_verbs },
3245 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3246 .dac_nids = alc880_dac_nids,
3247 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3248 .channel_mode = alc880_threestack_modes,
3250 .input_mux = &alc880_capture_source,
3252 [ALC880_3ST_DIG] = {
3253 .mixers = { alc880_three_stack_mixer },
3254 .init_verbs = { alc880_volume_init_verbs,
3255 alc880_pin_3stack_init_verbs },
3256 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3257 .dac_nids = alc880_dac_nids,
3258 .dig_out_nid = ALC880_DIGOUT_NID,
3259 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3260 .channel_mode = alc880_threestack_modes,
3262 .input_mux = &alc880_capture_source,
3264 [ALC880_TCL_S700] = {
3265 .mixers = { alc880_tcl_s700_mixer },
3266 .init_verbs = { alc880_volume_init_verbs,
3267 alc880_pin_tcl_S700_init_verbs,
3268 alc880_gpio2_init_verbs },
3269 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3270 .dac_nids = alc880_dac_nids,
3272 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3273 .channel_mode = alc880_2_jack_modes,
3274 .input_mux = &alc880_capture_source,
3277 .mixers = { alc880_three_stack_mixer,
3278 alc880_five_stack_mixer},
3279 .init_verbs = { alc880_volume_init_verbs,
3280 alc880_pin_5stack_init_verbs },
3281 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3282 .dac_nids = alc880_dac_nids,
3283 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3284 .channel_mode = alc880_fivestack_modes,
3285 .input_mux = &alc880_capture_source,
3287 [ALC880_5ST_DIG] = {
3288 .mixers = { alc880_three_stack_mixer,
3289 alc880_five_stack_mixer },
3290 .init_verbs = { alc880_volume_init_verbs,
3291 alc880_pin_5stack_init_verbs },
3292 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3293 .dac_nids = alc880_dac_nids,
3294 .dig_out_nid = ALC880_DIGOUT_NID,
3295 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3296 .channel_mode = alc880_fivestack_modes,
3297 .input_mux = &alc880_capture_source,
3300 .mixers = { alc880_six_stack_mixer },
3301 .init_verbs = { alc880_volume_init_verbs,
3302 alc880_pin_6stack_init_verbs },
3303 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3304 .dac_nids = alc880_6st_dac_nids,
3305 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3306 .channel_mode = alc880_sixstack_modes,
3307 .input_mux = &alc880_6stack_capture_source,
3309 [ALC880_6ST_DIG] = {
3310 .mixers = { alc880_six_stack_mixer },
3311 .init_verbs = { alc880_volume_init_verbs,
3312 alc880_pin_6stack_init_verbs },
3313 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3314 .dac_nids = alc880_6st_dac_nids,
3315 .dig_out_nid = ALC880_DIGOUT_NID,
3316 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3317 .channel_mode = alc880_sixstack_modes,
3318 .input_mux = &alc880_6stack_capture_source,
3321 .mixers = { alc880_w810_base_mixer },
3322 .init_verbs = { alc880_volume_init_verbs,
3323 alc880_pin_w810_init_verbs,
3324 alc880_gpio2_init_verbs },
3325 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3326 .dac_nids = alc880_w810_dac_nids,
3327 .dig_out_nid = ALC880_DIGOUT_NID,
3328 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3329 .channel_mode = alc880_w810_modes,
3330 .input_mux = &alc880_capture_source,
3333 .mixers = { alc880_z71v_mixer },
3334 .init_verbs = { alc880_volume_init_verbs,
3335 alc880_pin_z71v_init_verbs },
3336 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3337 .dac_nids = alc880_z71v_dac_nids,
3338 .dig_out_nid = ALC880_DIGOUT_NID,
3340 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3341 .channel_mode = alc880_2_jack_modes,
3342 .input_mux = &alc880_capture_source,
3345 .mixers = { alc880_f1734_mixer },
3346 .init_verbs = { alc880_volume_init_verbs,
3347 alc880_pin_f1734_init_verbs },
3348 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3349 .dac_nids = alc880_f1734_dac_nids,
3351 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3352 .channel_mode = alc880_2_jack_modes,
3353 .input_mux = &alc880_f1734_capture_source,
3354 .unsol_event = alc880_uniwill_p53_unsol_event,
3355 .init_hook = alc880_uniwill_p53_hp_automute,
3358 .mixers = { alc880_asus_mixer },
3359 .init_verbs = { alc880_volume_init_verbs,
3360 alc880_pin_asus_init_verbs,
3361 alc880_gpio1_init_verbs },
3362 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3363 .dac_nids = alc880_asus_dac_nids,
3364 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3365 .channel_mode = alc880_asus_modes,
3367 .input_mux = &alc880_capture_source,
3369 [ALC880_ASUS_DIG] = {
3370 .mixers = { alc880_asus_mixer },
3371 .init_verbs = { alc880_volume_init_verbs,
3372 alc880_pin_asus_init_verbs,
3373 alc880_gpio1_init_verbs },
3374 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3375 .dac_nids = alc880_asus_dac_nids,
3376 .dig_out_nid = ALC880_DIGOUT_NID,
3377 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3378 .channel_mode = alc880_asus_modes,
3380 .input_mux = &alc880_capture_source,
3382 [ALC880_ASUS_DIG2] = {
3383 .mixers = { alc880_asus_mixer },
3384 .init_verbs = { alc880_volume_init_verbs,
3385 alc880_pin_asus_init_verbs,
3386 alc880_gpio2_init_verbs }, /* use GPIO2 */
3387 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3388 .dac_nids = alc880_asus_dac_nids,
3389 .dig_out_nid = ALC880_DIGOUT_NID,
3390 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3391 .channel_mode = alc880_asus_modes,
3393 .input_mux = &alc880_capture_source,
3395 [ALC880_ASUS_W1V] = {
3396 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3397 .init_verbs = { alc880_volume_init_verbs,
3398 alc880_pin_asus_init_verbs,
3399 alc880_gpio1_init_verbs },
3400 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3401 .dac_nids = alc880_asus_dac_nids,
3402 .dig_out_nid = ALC880_DIGOUT_NID,
3403 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3404 .channel_mode = alc880_asus_modes,
3406 .input_mux = &alc880_capture_source,
3408 [ALC880_UNIWILL_DIG] = {
3409 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3410 .init_verbs = { alc880_volume_init_verbs,
3411 alc880_pin_asus_init_verbs },
3412 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3413 .dac_nids = alc880_asus_dac_nids,
3414 .dig_out_nid = ALC880_DIGOUT_NID,
3415 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3416 .channel_mode = alc880_asus_modes,
3418 .input_mux = &alc880_capture_source,
3420 [ALC880_UNIWILL] = {
3421 .mixers = { alc880_uniwill_mixer },
3422 .init_verbs = { alc880_volume_init_verbs,
3423 alc880_uniwill_init_verbs },
3424 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3425 .dac_nids = alc880_asus_dac_nids,
3426 .dig_out_nid = ALC880_DIGOUT_NID,
3427 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3428 .channel_mode = alc880_threestack_modes,
3430 .input_mux = &alc880_capture_source,
3431 .unsol_event = alc880_uniwill_unsol_event,
3432 .init_hook = alc880_uniwill_automute,
3434 [ALC880_UNIWILL_P53] = {
3435 .mixers = { alc880_uniwill_p53_mixer },
3436 .init_verbs = { alc880_volume_init_verbs,
3437 alc880_uniwill_p53_init_verbs },
3438 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3439 .dac_nids = alc880_asus_dac_nids,
3440 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3441 .channel_mode = alc880_threestack_modes,
3442 .input_mux = &alc880_capture_source,
3443 .unsol_event = alc880_uniwill_p53_unsol_event,
3444 .init_hook = alc880_uniwill_p53_hp_automute,
3446 [ALC880_FUJITSU] = {
3447 .mixers = { alc880_fujitsu_mixer,
3448 alc880_pcbeep_mixer, },
3449 .init_verbs = { alc880_volume_init_verbs,
3450 alc880_uniwill_p53_init_verbs,
3451 alc880_beep_init_verbs },
3452 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3453 .dac_nids = alc880_dac_nids,
3454 .dig_out_nid = ALC880_DIGOUT_NID,
3455 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3456 .channel_mode = alc880_2_jack_modes,
3457 .input_mux = &alc880_capture_source,
3458 .unsol_event = alc880_uniwill_p53_unsol_event,
3459 .init_hook = alc880_uniwill_p53_hp_automute,
3462 .mixers = { alc880_three_stack_mixer },
3463 .init_verbs = { alc880_volume_init_verbs,
3464 alc880_pin_clevo_init_verbs },
3465 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3466 .dac_nids = alc880_dac_nids,
3468 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3469 .channel_mode = alc880_threestack_modes,
3471 .input_mux = &alc880_capture_source,
3474 .mixers = { alc880_lg_mixer },
3475 .init_verbs = { alc880_volume_init_verbs,
3476 alc880_lg_init_verbs },
3477 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3478 .dac_nids = alc880_lg_dac_nids,
3479 .dig_out_nid = ALC880_DIGOUT_NID,
3480 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3481 .channel_mode = alc880_lg_ch_modes,
3483 .input_mux = &alc880_lg_capture_source,
3484 .unsol_event = alc880_lg_unsol_event,
3485 .init_hook = alc880_lg_automute,
3486 #ifdef CONFIG_SND_HDA_POWER_SAVE
3487 .loopbacks = alc880_lg_loopbacks,
3491 .mixers = { alc880_lg_lw_mixer },
3492 .init_verbs = { alc880_volume_init_verbs,
3493 alc880_lg_lw_init_verbs },
3494 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3495 .dac_nids = alc880_dac_nids,
3496 .dig_out_nid = ALC880_DIGOUT_NID,
3497 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3498 .channel_mode = alc880_lg_lw_modes,
3499 .input_mux = &alc880_lg_lw_capture_source,
3500 .unsol_event = alc880_lg_lw_unsol_event,
3501 .init_hook = alc880_lg_lw_automute,
3503 [ALC880_MEDION_RIM] = {
3504 .mixers = { alc880_medion_rim_mixer },
3505 .init_verbs = { alc880_volume_init_verbs,
3506 alc880_medion_rim_init_verbs,
3507 alc_gpio2_init_verbs },
3508 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3509 .dac_nids = alc880_dac_nids,
3510 .dig_out_nid = ALC880_DIGOUT_NID,
3511 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3512 .channel_mode = alc880_2_jack_modes,
3513 .input_mux = &alc880_medion_rim_capture_source,
3514 .unsol_event = alc880_medion_rim_unsol_event,
3515 .init_hook = alc880_medion_rim_automute,
3517 #ifdef CONFIG_SND_DEBUG
3519 .mixers = { alc880_test_mixer },
3520 .init_verbs = { alc880_test_init_verbs },
3521 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3522 .dac_nids = alc880_test_dac_nids,
3523 .dig_out_nid = ALC880_DIGOUT_NID,
3524 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3525 .channel_mode = alc880_test_modes,
3526 .input_mux = &alc880_test_capture_source,
3532 * Automatic parse of I/O pins from the BIOS configuration
3535 #define NUM_CONTROL_ALLOC 32
3536 #define NUM_VERB_ALLOC 32
3540 ALC_CTL_WIDGET_MUTE,
3543 static struct snd_kcontrol_new alc880_control_templates[] = {
3544 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3545 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3546 HDA_BIND_MUTE(NULL, 0, 0, 0),
3549 /* add dynamic controls */
3550 static int add_control(struct alc_spec *spec, int type, const char *name,
3553 struct snd_kcontrol_new *knew;
3555 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3556 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3558 /* array + terminator */
3559 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3562 if (spec->kctl_alloc) {
3563 memcpy(knew, spec->kctl_alloc,
3564 sizeof(*knew) * spec->num_kctl_alloc);
3565 kfree(spec->kctl_alloc);
3567 spec->kctl_alloc = knew;
3568 spec->num_kctl_alloc = num;
3571 knew = &spec->kctl_alloc[spec->num_kctl_used];
3572 *knew = alc880_control_templates[type];
3573 knew->name = kstrdup(name, GFP_KERNEL);
3576 knew->private_value = val;
3577 spec->num_kctl_used++;
3581 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3582 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3583 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3584 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3585 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3586 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3587 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3588 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3589 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3590 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3591 #define ALC880_PIN_CD_NID 0x1c
3593 /* fill in the dac_nids table from the parsed pin configuration */
3594 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3595 const struct auto_pin_cfg *cfg)
3601 memset(assigned, 0, sizeof(assigned));
3602 spec->multiout.dac_nids = spec->private_dac_nids;
3604 /* check the pins hardwired to audio widget */
3605 for (i = 0; i < cfg->line_outs; i++) {
3606 nid = cfg->line_out_pins[i];
3607 if (alc880_is_fixed_pin(nid)) {
3608 int idx = alc880_fixed_pin_idx(nid);
3609 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3613 /* left pins can be connect to any audio widget */
3614 for (i = 0; i < cfg->line_outs; i++) {
3615 nid = cfg->line_out_pins[i];
3616 if (alc880_is_fixed_pin(nid))
3618 /* search for an empty channel */
3619 for (j = 0; j < cfg->line_outs; j++) {
3621 spec->multiout.dac_nids[i] =
3622 alc880_idx_to_dac(j);
3628 spec->multiout.num_dacs = cfg->line_outs;
3632 /* add playback controls from the parsed DAC table */
3633 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3634 const struct auto_pin_cfg *cfg)
3637 static const char *chname[4] = {
3638 "Front", "Surround", NULL /*CLFE*/, "Side"
3643 for (i = 0; i < cfg->line_outs; i++) {
3644 if (!spec->multiout.dac_nids[i])
3646 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3649 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3650 "Center Playback Volume",
3651 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3655 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3656 "LFE Playback Volume",
3657 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3661 err = add_control(spec, ALC_CTL_BIND_MUTE,
3662 "Center Playback Switch",
3663 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3667 err = add_control(spec, ALC_CTL_BIND_MUTE,
3668 "LFE Playback Switch",
3669 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3674 sprintf(name, "%s Playback Volume", chname[i]);
3675 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3676 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3680 sprintf(name, "%s Playback Switch", chname[i]);
3681 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3682 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3691 /* add playback controls for speaker and HP outputs */
3692 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3702 if (alc880_is_fixed_pin(pin)) {
3703 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3704 /* specify the DAC as the extra output */
3705 if (!spec->multiout.hp_nid)
3706 spec->multiout.hp_nid = nid;
3708 spec->multiout.extra_out_nid[0] = nid;
3709 /* control HP volume/switch on the output mixer amp */
3710 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3711 sprintf(name, "%s Playback Volume", pfx);
3712 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3713 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3716 sprintf(name, "%s Playback Switch", pfx);
3717 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3718 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3721 } else if (alc880_is_multi_pin(pin)) {
3722 /* set manual connection */
3723 /* we have only a switch on HP-out PIN */
3724 sprintf(name, "%s Playback Switch", pfx);
3725 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3726 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3733 /* create input playback/capture controls for the given pin */
3734 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3735 const char *ctlname,
3736 int idx, hda_nid_t mix_nid)
3741 sprintf(name, "%s Playback Volume", ctlname);
3742 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3743 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3746 sprintf(name, "%s Playback Switch", ctlname);
3747 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3748 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3754 /* create playback/capture controls for input pins */
3755 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3756 const struct auto_pin_cfg *cfg)
3758 struct hda_input_mux *imux = &spec->private_imux;
3761 for (i = 0; i < AUTO_PIN_LAST; i++) {
3762 if (alc880_is_input_pin(cfg->input_pins[i])) {
3763 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3764 err = new_analog_input(spec, cfg->input_pins[i],
3765 auto_pin_cfg_labels[i],
3769 imux->items[imux->num_items].label =
3770 auto_pin_cfg_labels[i];
3771 imux->items[imux->num_items].index =
3772 alc880_input_pin_idx(cfg->input_pins[i]);
3779 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3780 unsigned int pin_type)
3782 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3785 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3789 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3790 hda_nid_t nid, int pin_type,
3793 alc_set_pin_output(codec, nid, pin_type);
3794 /* need the manual connection? */
3795 if (alc880_is_multi_pin(nid)) {
3796 struct alc_spec *spec = codec->spec;
3797 int idx = alc880_multi_pin_idx(nid);
3798 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3799 AC_VERB_SET_CONNECT_SEL,
3800 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3804 static int get_pin_type(int line_out_type)
3806 if (line_out_type == AUTO_PIN_HP_OUT)
3812 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3814 struct alc_spec *spec = codec->spec;
3817 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3818 for (i = 0; i < spec->autocfg.line_outs; i++) {
3819 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3820 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3821 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3825 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3827 struct alc_spec *spec = codec->spec;
3830 pin = spec->autocfg.speaker_pins[0];
3831 if (pin) /* connect to front */
3832 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3833 pin = spec->autocfg.hp_pins[0];
3834 if (pin) /* connect to front */
3835 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3838 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3840 struct alc_spec *spec = codec->spec;
3843 for (i = 0; i < AUTO_PIN_LAST; i++) {
3844 hda_nid_t nid = spec->autocfg.input_pins[i];
3845 if (alc880_is_input_pin(nid)) {
3846 snd_hda_codec_write(codec, nid, 0,
3847 AC_VERB_SET_PIN_WIDGET_CONTROL,
3848 i <= AUTO_PIN_FRONT_MIC ?
3849 PIN_VREF80 : PIN_IN);
3850 if (nid != ALC880_PIN_CD_NID)
3851 snd_hda_codec_write(codec, nid, 0,
3852 AC_VERB_SET_AMP_GAIN_MUTE,
3858 /* parse the BIOS configuration and set up the alc_spec */
3859 /* return 1 if successful, 0 if the proper config is not found,
3860 * or a negative error code
3862 static int alc880_parse_auto_config(struct hda_codec *codec)
3864 struct alc_spec *spec = codec->spec;
3866 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3868 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3872 if (!spec->autocfg.line_outs)
3873 return 0; /* can't find valid BIOS pin config */
3875 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3878 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3881 err = alc880_auto_create_extra_out(spec,
3882 spec->autocfg.speaker_pins[0],
3886 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3890 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3894 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3896 if (spec->autocfg.dig_out_pin)
3897 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3898 if (spec->autocfg.dig_in_pin)
3899 spec->dig_in_nid = ALC880_DIGIN_NID;
3901 if (spec->kctl_alloc)
3902 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3904 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3906 spec->num_mux_defs = 1;
3907 spec->input_mux = &spec->private_imux;
3909 store_pin_configs(codec);
3913 /* additional initialization for auto-configuration model */
3914 static void alc880_auto_init(struct hda_codec *codec)
3916 struct alc_spec *spec = codec->spec;
3917 alc880_auto_init_multi_out(codec);
3918 alc880_auto_init_extra_out(codec);
3919 alc880_auto_init_analog_input(codec);
3920 if (spec->unsol_event)
3921 alc_inithook(codec);
3925 * OK, here we have finally the patch for ALC880
3928 static int patch_alc880(struct hda_codec *codec)
3930 struct alc_spec *spec;
3934 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3940 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3943 if (board_config < 0) {
3944 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3945 "trying auto-probe from BIOS...\n");
3946 board_config = ALC880_AUTO;
3949 if (board_config == ALC880_AUTO) {
3950 /* automatic parse from the BIOS config */
3951 err = alc880_parse_auto_config(codec);
3957 "hda_codec: Cannot set up configuration "
3958 "from BIOS. Using 3-stack mode...\n");
3959 board_config = ALC880_3ST;
3963 if (board_config != ALC880_AUTO)
3964 setup_preset(spec, &alc880_presets[board_config]);
3966 spec->stream_name_analog = "ALC880 Analog";
3967 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3968 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3969 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3971 spec->stream_name_digital = "ALC880 Digital";
3972 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3973 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3975 if (!spec->adc_nids && spec->input_mux) {
3976 /* check whether NID 0x07 is valid */
3977 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3979 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3980 if (wcap != AC_WID_AUD_IN) {
3981 spec->adc_nids = alc880_adc_nids_alt;
3982 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3983 spec->mixers[spec->num_mixers] =
3984 alc880_capture_alt_mixer;
3987 spec->adc_nids = alc880_adc_nids;
3988 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3989 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3994 spec->vmaster_nid = 0x0c;
3996 codec->patch_ops = alc_patch_ops;
3997 if (board_config == ALC880_AUTO)
3998 spec->init_hook = alc880_auto_init;
3999 #ifdef CONFIG_SND_HDA_POWER_SAVE
4000 if (!spec->loopback.amplist)
4001 spec->loopback.amplist = alc880_loopbacks;
4012 static hda_nid_t alc260_dac_nids[1] = {
4017 static hda_nid_t alc260_adc_nids[1] = {
4022 static hda_nid_t alc260_adc_nids_alt[1] = {
4027 static hda_nid_t alc260_hp_adc_nids[2] = {
4032 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4033 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4035 static hda_nid_t alc260_dual_adc_nids[2] = {
4040 #define ALC260_DIGOUT_NID 0x03
4041 #define ALC260_DIGIN_NID 0x06
4043 static struct hda_input_mux alc260_capture_source = {
4047 { "Front Mic", 0x1 },
4053 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4054 * headphone jack and the internal CD lines since these are the only pins at
4055 * which audio can appear. For flexibility, also allow the option of
4056 * recording the mixer output on the second ADC (ADC0 doesn't have a
4057 * connection to the mixer output).
4059 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4063 { "Mic/Line", 0x0 },
4065 { "Headphone", 0x2 },
4071 { "Mic/Line", 0x0 },
4073 { "Headphone", 0x2 },
4080 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4081 * the Fujitsu S702x, but jacks are marked differently.
4083 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4090 { "Headphone", 0x5 },
4099 { "Headphone", 0x6 },
4105 * This is just place-holder, so there's something for alc_build_pcms to look
4106 * at when it calculates the maximum number of channels. ALC260 has no mixer
4107 * element which allows changing the channel mode, so the verb list is
4110 static struct hda_channel_mode alc260_modes[1] = {
4115 /* Mixer combinations
4117 * basic: base_output + input + pc_beep + capture
4118 * HP: base_output + input + capture_alt
4119 * HP_3013: hp_3013 + input + capture
4120 * fujitsu: fujitsu + capture
4121 * acer: acer + capture
4124 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4125 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4126 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4127 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4128 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4129 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4130 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4134 static struct snd_kcontrol_new alc260_input_mixer[] = {
4135 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4136 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4137 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4138 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4139 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4140 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4141 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4142 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4146 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4147 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4148 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4152 /* update HP, line and mono out pins according to the master switch */
4153 static void alc260_hp_master_update(struct hda_codec *codec,
4154 hda_nid_t hp, hda_nid_t line,
4157 struct alc_spec *spec = codec->spec;
4158 unsigned int val = spec->master_sw ? PIN_HP : 0;
4159 /* change HP and line-out pins */
4160 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4162 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4164 /* mono (speaker) depending on the HP jack sense */
4165 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4166 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4170 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4171 struct snd_ctl_elem_value *ucontrol)
4173 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4174 struct alc_spec *spec = codec->spec;
4175 *ucontrol->value.integer.value = spec->master_sw;
4179 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4180 struct snd_ctl_elem_value *ucontrol)
4182 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4183 struct alc_spec *spec = codec->spec;
4184 int val = !!*ucontrol->value.integer.value;
4185 hda_nid_t hp, line, mono;
4187 if (val == spec->master_sw)
4189 spec->master_sw = val;
4190 hp = (kcontrol->private_value >> 16) & 0xff;
4191 line = (kcontrol->private_value >> 8) & 0xff;
4192 mono = kcontrol->private_value & 0xff;
4193 alc260_hp_master_update(codec, hp, line, mono);
4197 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4199 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4200 .name = "Master Playback Switch",
4201 .info = snd_ctl_boolean_mono_info,
4202 .get = alc260_hp_master_sw_get,
4203 .put = alc260_hp_master_sw_put,
4204 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4206 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4207 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4208 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4209 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4210 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4212 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4216 static struct hda_verb alc260_hp_unsol_verbs[] = {
4217 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4221 static void alc260_hp_automute(struct hda_codec *codec)
4223 struct alc_spec *spec = codec->spec;
4224 unsigned int present;
4226 present = snd_hda_codec_read(codec, 0x10, 0,
4227 AC_VERB_GET_PIN_SENSE, 0);
4228 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4229 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4232 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4234 if ((res >> 26) == ALC880_HP_EVENT)
4235 alc260_hp_automute(codec);
4238 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4240 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4241 .name = "Master Playback Switch",
4242 .info = snd_ctl_boolean_mono_info,
4243 .get = alc260_hp_master_sw_get,
4244 .put = alc260_hp_master_sw_put,
4245 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4247 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4248 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4249 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4250 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4251 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4253 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4254 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4258 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4259 .ops = &snd_hda_bind_vol,
4261 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4262 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4263 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4268 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4269 .ops = &snd_hda_bind_sw,
4271 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4272 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4277 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4278 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4279 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4280 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4281 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4285 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4286 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4290 static void alc260_hp_3013_automute(struct hda_codec *codec)
4292 struct alc_spec *spec = codec->spec;
4293 unsigned int present;
4295 present = snd_hda_codec_read(codec, 0x15, 0,
4296 AC_VERB_GET_PIN_SENSE, 0);
4297 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4298 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4301 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4304 if ((res >> 26) == ALC880_HP_EVENT)
4305 alc260_hp_3013_automute(codec);
4308 static void alc260_hp_3012_automute(struct hda_codec *codec)
4310 unsigned int present, bits;
4312 present = snd_hda_codec_read(codec, 0x10, 0,
4313 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4315 bits = present ? 0 : PIN_OUT;
4316 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4318 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4320 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4324 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4327 if ((res >> 26) == ALC880_HP_EVENT)
4328 alc260_hp_3012_automute(codec);
4331 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4332 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4334 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4335 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4336 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4337 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4338 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4339 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4340 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4341 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4342 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4343 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4344 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4345 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4346 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4350 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4351 * versions of the ALC260 don't act on requests to enable mic bias from NID
4352 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4353 * datasheet doesn't mention this restriction. At this stage it's not clear
4354 * whether this behaviour is intentional or is a hardware bug in chip
4355 * revisions available in early 2006. Therefore for now allow the
4356 * "Headphone Jack Mode" control to span all choices, but if it turns out
4357 * that the lack of mic bias for this NID is intentional we could change the
4358 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4360 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4361 * don't appear to make the mic bias available from the "line" jack, even
4362 * though the NID used for this jack (0x14) can supply it. The theory is
4363 * that perhaps Acer have included blocking capacitors between the ALC260
4364 * and the output jack. If this turns out to be the case for all such
4365 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4366 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4368 * The C20x Tablet series have a mono internal speaker which is controlled
4369 * via the chip's Mono sum widget and pin complex, so include the necessary
4370 * controls for such models. On models without a "mono speaker" the control
4371 * won't do anything.
4373 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4374 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4375 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4376 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4377 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4379 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4381 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4382 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4384 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4385 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4386 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4387 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4388 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4389 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4390 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4394 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4395 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4397 static struct snd_kcontrol_new alc260_will_mixer[] = {
4398 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4399 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4401 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4402 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4403 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4404 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4405 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4406 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4407 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4408 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4409 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4413 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4414 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4416 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4417 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4418 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4420 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4421 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4422 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4423 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4424 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4425 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4426 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4430 /* capture mixer elements */
4431 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4432 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4433 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4434 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4435 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4437 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4438 /* The multiple "Capture Source" controls confuse alsamixer
4439 * So call somewhat different..
4441 /* .name = "Capture Source", */
4442 .name = "Input Source",
4444 .info = alc_mux_enum_info,
4445 .get = alc_mux_enum_get,
4446 .put = alc_mux_enum_put,
4451 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4452 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4453 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4455 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4456 /* The multiple "Capture Source" controls confuse alsamixer
4457 * So call somewhat different..
4459 /* .name = "Capture Source", */
4460 .name = "Input Source",
4462 .info = alc_mux_enum_info,
4463 .get = alc_mux_enum_get,
4464 .put = alc_mux_enum_put,
4470 * initialization verbs
4472 static struct hda_verb alc260_init_verbs[] = {
4473 /* Line In pin widget for input */
4474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4475 /* CD pin widget for input */
4476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4477 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4478 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4479 /* Mic2 (front panel) pin widget for input and vref at 80% */
4480 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4481 /* LINE-2 is used for line-out in rear */
4482 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4483 /* select line-out */
4484 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4486 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4488 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4490 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4491 /* mute capture amp left and right */
4492 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4493 /* set connection select to line in (default select for this ADC) */
4494 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4495 /* mute capture amp left and right */
4496 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4497 /* set connection select to line in (default select for this ADC) */
4498 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4499 /* set vol=0 Line-Out mixer amp left and right */
4500 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4501 /* unmute pin widget amp left and right (no gain on this amp) */
4502 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4503 /* set vol=0 HP mixer amp left and right */
4504 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4505 /* unmute pin widget amp left and right (no gain on this amp) */
4506 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4507 /* set vol=0 Mono mixer amp left and right */
4508 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4509 /* unmute pin widget amp left and right (no gain on this amp) */
4510 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4511 /* unmute LINE-2 out pin */
4512 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4513 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4516 /* mute analog inputs */
4517 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4518 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4519 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4520 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4522 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4523 /* mute Front out path */
4524 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4525 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4526 /* mute Headphone out path */
4527 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4528 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4529 /* mute Mono out path */
4530 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4531 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4535 #if 0 /* should be identical with alc260_init_verbs? */
4536 static struct hda_verb alc260_hp_init_verbs[] = {
4537 /* Headphone and output */
4538 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4540 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4541 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4542 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4543 /* Mic2 (front panel) pin widget for input and vref at 80% */
4544 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4545 /* Line In pin widget for input */
4546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4547 /* Line-2 pin widget for output */
4548 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4549 /* CD pin widget for input */
4550 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4551 /* unmute amp left and right */
4552 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4553 /* set connection select to line in (default select for this ADC) */
4554 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4555 /* unmute Line-Out mixer amp left and right (volume = 0) */
4556 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4557 /* mute pin widget amp left and right (no gain on this amp) */
4558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4559 /* unmute HP mixer amp left and right (volume = 0) */
4560 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4561 /* mute pin widget amp left and right (no gain on this amp) */
4562 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4563 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4566 /* mute analog inputs */
4567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4569 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4572 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4573 /* Unmute Front out path */
4574 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4575 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4576 /* Unmute Headphone out path */
4577 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4578 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4579 /* Unmute Mono out path */
4580 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4581 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4586 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4587 /* Line out and output */
4588 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4590 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4591 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4592 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4593 /* Mic2 (front panel) pin widget for input and vref at 80% */
4594 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4595 /* Line In pin widget for input */
4596 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4597 /* Headphone pin widget for output */
4598 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4599 /* CD pin widget for input */
4600 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4601 /* unmute amp left and right */
4602 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4603 /* set connection select to line in (default select for this ADC) */
4604 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4605 /* unmute Line-Out mixer amp left and right (volume = 0) */
4606 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4607 /* mute pin widget amp left and right (no gain on this amp) */
4608 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4609 /* unmute HP mixer amp left and right (volume = 0) */
4610 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4611 /* mute pin widget amp left and right (no gain on this amp) */
4612 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4613 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4616 /* mute analog inputs */
4617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4622 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4623 /* Unmute Front out path */
4624 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4625 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4626 /* Unmute Headphone out path */
4627 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4628 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4629 /* Unmute Mono out path */
4630 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4631 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4635 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4636 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4637 * audio = 0x16, internal speaker = 0x10.
4639 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4640 /* Disable all GPIOs */
4641 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4642 /* Internal speaker is connected to headphone pin */
4643 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4644 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4646 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4647 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4648 /* Ensure all other unused pins are disabled and muted. */
4649 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4650 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4651 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4652 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4653 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4654 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4656 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4658 /* Disable digital (SPDIF) pins */
4659 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4660 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4662 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4663 * when acting as an output.
4665 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4667 /* Start with output sum widgets muted and their output gains at min */
4668 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4669 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4670 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4671 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4672 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4673 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4674 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4675 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4676 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4678 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4679 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4680 /* Unmute Line1 pin widget output buffer since it starts as an output.
4681 * If the pin mode is changed by the user the pin mode control will
4682 * take care of enabling the pin's input/output buffers as needed.
4683 * Therefore there's no need to enable the input buffer at this
4686 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4687 /* Unmute input buffer of pin widget used for Line-in (no equiv
4690 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4692 /* Mute capture amp left and right */
4693 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4694 /* Set ADC connection select to match default mixer setting - line
4697 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4699 /* Do the same for the second ADC: mute capture input amp and
4700 * set ADC connection to line in (on mic1 pin)
4702 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4703 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4705 /* Mute all inputs to mixer widget (even unconnected ones) */
4706 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4707 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4708 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4709 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4711 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4712 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4713 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4718 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4719 * similar laptops (adapted from Fujitsu init verbs).
4721 static struct hda_verb alc260_acer_init_verbs[] = {
4722 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4723 * the headphone jack. Turn this on and rely on the standard mute
4724 * methods whenever the user wants to turn these outputs off.
4726 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4727 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4728 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4729 /* Internal speaker/Headphone jack is connected to Line-out pin */
4730 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4731 /* Internal microphone/Mic jack is connected to Mic1 pin */
4732 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4733 /* Line In jack is connected to Line1 pin */
4734 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4735 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4736 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4737 /* Ensure all other unused pins are disabled and muted. */
4738 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4739 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4740 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4741 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4744 /* Disable digital (SPDIF) pins */
4745 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4746 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4748 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4749 * bus when acting as outputs.
4751 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4752 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4754 /* Start with output sum widgets muted and their output gains at min */
4755 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4757 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4759 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4760 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4761 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4762 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4763 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4765 /* Unmute Line-out pin widget amp left and right
4766 * (no equiv mixer ctrl)
4768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4769 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4770 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4771 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4772 * inputs. If the pin mode is changed by the user the pin mode control
4773 * will take care of enabling the pin's input/output buffers as needed.
4774 * Therefore there's no need to enable the input buffer at this
4777 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4778 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4780 /* Mute capture amp left and right */
4781 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4782 /* Set ADC connection select to match default mixer setting - mic
4785 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4787 /* Do similar with the second ADC: mute capture input amp and
4788 * set ADC connection to mic to match ALSA's default state.
4790 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4791 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4793 /* Mute all inputs to mixer widget (even unconnected ones) */
4794 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4796 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4801 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4806 static struct hda_verb alc260_will_verbs[] = {
4807 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4808 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4809 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4810 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4811 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4812 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4816 static struct hda_verb alc260_replacer_672v_verbs[] = {
4817 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4818 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4819 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4821 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4822 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4823 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4825 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4829 /* toggle speaker-output according to the hp-jack state */
4830 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4832 unsigned int present;
4834 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4835 present = snd_hda_codec_read(codec, 0x0f, 0,
4836 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4838 snd_hda_codec_write_cache(codec, 0x01, 0,
4839 AC_VERB_SET_GPIO_DATA, 1);
4840 snd_hda_codec_write_cache(codec, 0x0f, 0,
4841 AC_VERB_SET_PIN_WIDGET_CONTROL,
4844 snd_hda_codec_write_cache(codec, 0x01, 0,
4845 AC_VERB_SET_GPIO_DATA, 0);
4846 snd_hda_codec_write_cache(codec, 0x0f, 0,
4847 AC_VERB_SET_PIN_WIDGET_CONTROL,
4852 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4855 if ((res >> 26) == ALC880_HP_EVENT)
4856 alc260_replacer_672v_automute(codec);
4859 static struct hda_verb alc260_hp_dc7600_verbs[] = {
4860 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4861 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4862 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4863 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4864 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4865 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4866 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4867 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4868 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4869 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4873 /* Test configuration for debugging, modelled after the ALC880 test
4876 #ifdef CONFIG_SND_DEBUG
4877 static hda_nid_t alc260_test_dac_nids[1] = {
4880 static hda_nid_t alc260_test_adc_nids[2] = {
4883 /* For testing the ALC260, each input MUX needs its own definition since
4884 * the signal assignments are different. This assumes that the first ADC
4887 static struct hda_input_mux alc260_test_capture_sources[2] = {
4891 { "MIC1 pin", 0x0 },
4892 { "MIC2 pin", 0x1 },
4893 { "LINE1 pin", 0x2 },
4894 { "LINE2 pin", 0x3 },
4896 { "LINE-OUT pin", 0x5 },
4897 { "HP-OUT pin", 0x6 },
4903 { "MIC1 pin", 0x0 },
4904 { "MIC2 pin", 0x1 },
4905 { "LINE1 pin", 0x2 },
4906 { "LINE2 pin", 0x3 },
4909 { "LINE-OUT pin", 0x6 },
4910 { "HP-OUT pin", 0x7 },
4914 static struct snd_kcontrol_new alc260_test_mixer[] = {
4915 /* Output driver widgets */
4916 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4917 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4918 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4919 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4920 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4921 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4923 /* Modes for retasking pin widgets
4924 * Note: the ALC260 doesn't seem to act on requests to enable mic
4925 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4926 * mention this restriction. At this stage it's not clear whether
4927 * this behaviour is intentional or is a hardware bug in chip
4928 * revisions available at least up until early 2006. Therefore for
4929 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4930 * choices, but if it turns out that the lack of mic bias for these
4931 * NIDs is intentional we could change their modes from
4932 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4934 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4935 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4936 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4937 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4938 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4939 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4941 /* Loopback mixer controls */
4942 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4943 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4944 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4945 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4946 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4947 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4948 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4949 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4950 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4951 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4952 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4953 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4954 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4955 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4956 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4957 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4959 /* Controls for GPIO pins, assuming they are configured as outputs */
4960 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4961 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4962 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4963 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4965 /* Switches to allow the digital IO pins to be enabled. The datasheet
4966 * is ambigious as to which NID is which; testing on laptops which
4967 * make this output available should provide clarification.
4969 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4970 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4972 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4973 * this output to turn on an external amplifier.
4975 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4976 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4980 static struct hda_verb alc260_test_init_verbs[] = {
4981 /* Enable all GPIOs as outputs with an initial value of 0 */
4982 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4983 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4984 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4986 /* Enable retasking pins as output, initially without power amp */
4987 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4988 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4991 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4992 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4994 /* Disable digital (SPDIF) pins initially, but users can enable
4995 * them via a mixer switch. In the case of SPDIF-out, this initverb
4996 * payload also sets the generation to 0, output to be in "consumer"
4997 * PCM format, copyright asserted, no pre-emphasis and no validity
5000 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5001 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5003 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5004 * OUT1 sum bus when acting as an output.
5006 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5007 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5008 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5009 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5011 /* Start with output sum widgets muted and their output gains at min */
5012 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5013 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5015 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5016 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5017 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5018 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5019 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5020 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5022 /* Unmute retasking pin widget output buffers since the default
5023 * state appears to be output. As the pin mode is changed by the
5024 * user the pin mode control will take care of enabling the pin's
5025 * input/output buffers as needed.
5027 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5028 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5029 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5031 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5032 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5033 /* Also unmute the mono-out pin widget */
5034 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5036 /* Mute capture amp left and right */
5037 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5038 /* Set ADC connection select to match default mixer setting (mic1
5041 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5043 /* Do the same for the second ADC: mute capture input amp and
5044 * set ADC connection to mic1 pin
5046 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5047 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5049 /* Mute all inputs to mixer widget (even unconnected ones) */
5050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5051 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5053 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5063 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5064 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5066 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5067 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5070 * for BIOS auto-configuration
5073 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5074 const char *pfx, int *vol_bits)
5077 unsigned long vol_val, sw_val;
5081 if (nid >= 0x0f && nid < 0x11) {
5082 nid_vol = nid - 0x7;
5083 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5084 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5085 } else if (nid == 0x11) {
5086 nid_vol = nid - 0x7;
5087 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5088 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5089 } else if (nid >= 0x12 && nid <= 0x15) {
5091 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5092 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5096 if (!(*vol_bits & (1 << nid_vol))) {
5097 /* first control for the volume widget */
5098 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5099 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5102 *vol_bits |= (1 << nid_vol);
5104 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5105 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5111 /* add playback controls from the parsed DAC table */
5112 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5113 const struct auto_pin_cfg *cfg)
5119 spec->multiout.num_dacs = 1;
5120 spec->multiout.dac_nids = spec->private_dac_nids;
5121 spec->multiout.dac_nids[0] = 0x02;
5123 nid = cfg->line_out_pins[0];
5125 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5130 nid = cfg->speaker_pins[0];
5132 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5137 nid = cfg->hp_pins[0];
5139 err = alc260_add_playback_controls(spec, nid, "Headphone",
5147 /* create playback/capture controls for input pins */
5148 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5149 const struct auto_pin_cfg *cfg)
5151 struct hda_input_mux *imux = &spec->private_imux;
5154 for (i = 0; i < AUTO_PIN_LAST; i++) {
5155 if (cfg->input_pins[i] >= 0x12) {
5156 idx = cfg->input_pins[i] - 0x12;
5157 err = new_analog_input(spec, cfg->input_pins[i],
5158 auto_pin_cfg_labels[i], idx,
5162 imux->items[imux->num_items].label =
5163 auto_pin_cfg_labels[i];
5164 imux->items[imux->num_items].index = idx;
5167 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5168 idx = cfg->input_pins[i] - 0x09;
5169 err = new_analog_input(spec, cfg->input_pins[i],
5170 auto_pin_cfg_labels[i], idx,
5174 imux->items[imux->num_items].label =
5175 auto_pin_cfg_labels[i];
5176 imux->items[imux->num_items].index = idx;
5183 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5184 hda_nid_t nid, int pin_type,
5187 alc_set_pin_output(codec, nid, pin_type);
5188 /* need the manual connection? */
5190 int idx = nid - 0x12;
5191 snd_hda_codec_write(codec, idx + 0x0b, 0,
5192 AC_VERB_SET_CONNECT_SEL, sel_idx);
5196 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5198 struct alc_spec *spec = codec->spec;
5201 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5202 nid = spec->autocfg.line_out_pins[0];
5204 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5205 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5208 nid = spec->autocfg.speaker_pins[0];
5210 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5212 nid = spec->autocfg.hp_pins[0];
5214 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5217 #define ALC260_PIN_CD_NID 0x16
5218 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5220 struct alc_spec *spec = codec->spec;
5223 for (i = 0; i < AUTO_PIN_LAST; i++) {
5224 hda_nid_t nid = spec->autocfg.input_pins[i];
5226 snd_hda_codec_write(codec, nid, 0,
5227 AC_VERB_SET_PIN_WIDGET_CONTROL,
5228 i <= AUTO_PIN_FRONT_MIC ?
5229 PIN_VREF80 : PIN_IN);
5230 if (nid != ALC260_PIN_CD_NID)
5231 snd_hda_codec_write(codec, nid, 0,
5232 AC_VERB_SET_AMP_GAIN_MUTE,
5239 * generic initialization of ADC, input mixers and output mixers
5241 static struct hda_verb alc260_volume_init_verbs[] = {
5243 * Unmute ADC0-1 and set the default input to mic-in
5245 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5246 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5247 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5248 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5250 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5252 * Note: PASD motherboards uses the Line In 2 as the input for
5253 * front panel mic (mic 2)
5255 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5256 /* mute analog inputs */
5257 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5260 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5261 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5264 * Set up output mixers (0x08 - 0x0a)
5266 /* set vol=0 to output mixers */
5267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5269 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5270 /* set up input amps for analog loopback */
5271 /* Amp Indices: DAC = 0, mixer = 1 */
5272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5276 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5277 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5282 static int alc260_parse_auto_config(struct hda_codec *codec)
5284 struct alc_spec *spec = codec->spec;
5287 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5289 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5293 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5296 if (!spec->kctl_alloc)
5297 return 0; /* can't find valid BIOS pin config */
5298 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5302 spec->multiout.max_channels = 2;
5304 if (spec->autocfg.dig_out_pin)
5305 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5306 if (spec->kctl_alloc)
5307 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5309 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5311 spec->num_mux_defs = 1;
5312 spec->input_mux = &spec->private_imux;
5314 /* check whether NID 0x04 is valid */
5315 wcap = get_wcaps(codec, 0x04);
5316 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5317 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5318 spec->adc_nids = alc260_adc_nids_alt;
5319 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5320 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5322 spec->adc_nids = alc260_adc_nids;
5323 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5324 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5328 store_pin_configs(codec);
5332 /* additional initialization for auto-configuration model */
5333 static void alc260_auto_init(struct hda_codec *codec)
5335 struct alc_spec *spec = codec->spec;
5336 alc260_auto_init_multi_out(codec);
5337 alc260_auto_init_analog_input(codec);
5338 if (spec->unsol_event)
5339 alc_inithook(codec);
5342 #ifdef CONFIG_SND_HDA_POWER_SAVE
5343 static struct hda_amp_list alc260_loopbacks[] = {
5344 { 0x07, HDA_INPUT, 0 },
5345 { 0x07, HDA_INPUT, 1 },
5346 { 0x07, HDA_INPUT, 2 },
5347 { 0x07, HDA_INPUT, 3 },
5348 { 0x07, HDA_INPUT, 4 },
5354 * ALC260 configurations
5356 static const char *alc260_models[ALC260_MODEL_LAST] = {
5357 [ALC260_BASIC] = "basic",
5359 [ALC260_HP_3013] = "hp-3013",
5360 [ALC260_HP_DC7600] = "hp-dc7600",
5361 [ALC260_FUJITSU_S702X] = "fujitsu",
5362 [ALC260_ACER] = "acer",
5363 [ALC260_WILL] = "will",
5364 [ALC260_REPLACER_672V] = "replacer",
5365 #ifdef CONFIG_SND_DEBUG
5366 [ALC260_TEST] = "test",
5368 [ALC260_AUTO] = "auto",
5371 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5372 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5373 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5374 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5375 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5376 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5377 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5378 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5379 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5380 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5381 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5382 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5383 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5384 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5385 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5386 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5387 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5388 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5389 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5393 static struct alc_config_preset alc260_presets[] = {
5395 .mixers = { alc260_base_output_mixer,
5397 alc260_pc_beep_mixer,
5398 alc260_capture_mixer },
5399 .init_verbs = { alc260_init_verbs },
5400 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5401 .dac_nids = alc260_dac_nids,
5402 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5403 .adc_nids = alc260_adc_nids,
5404 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5405 .channel_mode = alc260_modes,
5406 .input_mux = &alc260_capture_source,
5409 .mixers = { alc260_hp_output_mixer,
5411 alc260_capture_alt_mixer },
5412 .init_verbs = { alc260_init_verbs,
5413 alc260_hp_unsol_verbs },
5414 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5415 .dac_nids = alc260_dac_nids,
5416 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5417 .adc_nids = alc260_hp_adc_nids,
5418 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5419 .channel_mode = alc260_modes,
5420 .input_mux = &alc260_capture_source,
5421 .unsol_event = alc260_hp_unsol_event,
5422 .init_hook = alc260_hp_automute,
5424 [ALC260_HP_DC7600] = {
5425 .mixers = { alc260_hp_dc7600_mixer,
5427 alc260_capture_alt_mixer },
5428 .init_verbs = { alc260_init_verbs,
5429 alc260_hp_dc7600_verbs },
5430 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5431 .dac_nids = alc260_dac_nids,
5432 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5433 .adc_nids = alc260_hp_adc_nids,
5434 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5435 .channel_mode = alc260_modes,
5436 .input_mux = &alc260_capture_source,
5437 .unsol_event = alc260_hp_3012_unsol_event,
5438 .init_hook = alc260_hp_3012_automute,
5440 [ALC260_HP_3013] = {
5441 .mixers = { alc260_hp_3013_mixer,
5443 alc260_capture_alt_mixer },
5444 .init_verbs = { alc260_hp_3013_init_verbs,
5445 alc260_hp_3013_unsol_verbs },
5446 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5447 .dac_nids = alc260_dac_nids,
5448 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5449 .adc_nids = alc260_hp_adc_nids,
5450 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5451 .channel_mode = alc260_modes,
5452 .input_mux = &alc260_capture_source,
5453 .unsol_event = alc260_hp_3013_unsol_event,
5454 .init_hook = alc260_hp_3013_automute,
5456 [ALC260_FUJITSU_S702X] = {
5457 .mixers = { alc260_fujitsu_mixer,
5458 alc260_capture_mixer },
5459 .init_verbs = { alc260_fujitsu_init_verbs },
5460 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5461 .dac_nids = alc260_dac_nids,
5462 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5463 .adc_nids = alc260_dual_adc_nids,
5464 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5465 .channel_mode = alc260_modes,
5466 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5467 .input_mux = alc260_fujitsu_capture_sources,
5470 .mixers = { alc260_acer_mixer,
5471 alc260_capture_mixer },
5472 .init_verbs = { alc260_acer_init_verbs },
5473 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5474 .dac_nids = alc260_dac_nids,
5475 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5476 .adc_nids = alc260_dual_adc_nids,
5477 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5478 .channel_mode = alc260_modes,
5479 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5480 .input_mux = alc260_acer_capture_sources,
5483 .mixers = { alc260_will_mixer,
5484 alc260_capture_mixer },
5485 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5486 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5487 .dac_nids = alc260_dac_nids,
5488 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5489 .adc_nids = alc260_adc_nids,
5490 .dig_out_nid = ALC260_DIGOUT_NID,
5491 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5492 .channel_mode = alc260_modes,
5493 .input_mux = &alc260_capture_source,
5495 [ALC260_REPLACER_672V] = {
5496 .mixers = { alc260_replacer_672v_mixer,
5497 alc260_capture_mixer },
5498 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5499 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5500 .dac_nids = alc260_dac_nids,
5501 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5502 .adc_nids = alc260_adc_nids,
5503 .dig_out_nid = ALC260_DIGOUT_NID,
5504 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5505 .channel_mode = alc260_modes,
5506 .input_mux = &alc260_capture_source,
5507 .unsol_event = alc260_replacer_672v_unsol_event,
5508 .init_hook = alc260_replacer_672v_automute,
5510 #ifdef CONFIG_SND_DEBUG
5512 .mixers = { alc260_test_mixer,
5513 alc260_capture_mixer },
5514 .init_verbs = { alc260_test_init_verbs },
5515 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5516 .dac_nids = alc260_test_dac_nids,
5517 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5518 .adc_nids = alc260_test_adc_nids,
5519 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5520 .channel_mode = alc260_modes,
5521 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5522 .input_mux = alc260_test_capture_sources,
5527 static int patch_alc260(struct hda_codec *codec)
5529 struct alc_spec *spec;
5530 int err, board_config;
5532 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5538 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5541 if (board_config < 0) {
5542 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5543 "trying auto-probe from BIOS...\n");
5544 board_config = ALC260_AUTO;
5547 if (board_config == ALC260_AUTO) {
5548 /* automatic parse from the BIOS config */
5549 err = alc260_parse_auto_config(codec);
5555 "hda_codec: Cannot set up configuration "
5556 "from BIOS. Using base mode...\n");
5557 board_config = ALC260_BASIC;
5561 if (board_config != ALC260_AUTO)
5562 setup_preset(spec, &alc260_presets[board_config]);
5564 spec->stream_name_analog = "ALC260 Analog";
5565 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5566 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5568 spec->stream_name_digital = "ALC260 Digital";
5569 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5570 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5572 spec->vmaster_nid = 0x08;
5574 codec->patch_ops = alc_patch_ops;
5575 if (board_config == ALC260_AUTO)
5576 spec->init_hook = alc260_auto_init;
5577 #ifdef CONFIG_SND_HDA_POWER_SAVE
5578 if (!spec->loopback.amplist)
5579 spec->loopback.amplist = alc260_loopbacks;
5589 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5590 * configuration. Each pin widget can choose any input DACs and a mixer.
5591 * Each ADC is connected from a mixer of all inputs. This makes possible
5592 * 6-channel independent captures.
5594 * In addition, an independent DAC for the multi-playback (not used in this
5597 #define ALC882_DIGOUT_NID 0x06
5598 #define ALC882_DIGIN_NID 0x0a
5600 static struct hda_channel_mode alc882_ch_modes[1] = {
5604 static hda_nid_t alc882_dac_nids[4] = {
5605 /* front, rear, clfe, rear_surr */
5606 0x02, 0x03, 0x04, 0x05
5609 /* identical with ALC880 */
5610 #define alc882_adc_nids alc880_adc_nids
5611 #define alc882_adc_nids_alt alc880_adc_nids_alt
5613 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5614 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5617 /* FIXME: should be a matrix-type input source selection */
5619 static struct hda_input_mux alc882_capture_source = {
5623 { "Front Mic", 0x1 },
5628 #define alc882_mux_enum_info alc_mux_enum_info
5629 #define alc882_mux_enum_get alc_mux_enum_get
5631 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5632 struct snd_ctl_elem_value *ucontrol)
5634 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5635 struct alc_spec *spec = codec->spec;
5636 const struct hda_input_mux *imux = spec->input_mux;
5637 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5638 hda_nid_t nid = spec->capsrc_nids ?
5639 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5640 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5641 unsigned int i, idx;
5643 idx = ucontrol->value.enumerated.item[0];
5644 if (idx >= imux->num_items)
5645 idx = imux->num_items - 1;
5646 if (*cur_val == idx)
5648 for (i = 0; i < imux->num_items; i++) {
5649 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5650 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5651 imux->items[i].index,
5661 static struct hda_verb alc882_3ST_ch2_init[] = {
5662 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5663 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5664 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5665 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5672 static struct hda_verb alc882_3ST_ch6_init[] = {
5673 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5674 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5675 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5676 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5677 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5678 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5682 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5683 { 2, alc882_3ST_ch2_init },
5684 { 6, alc882_3ST_ch6_init },
5690 static struct hda_verb alc882_sixstack_ch6_init[] = {
5691 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5692 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5693 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5694 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5701 static struct hda_verb alc882_sixstack_ch8_init[] = {
5702 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5703 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5704 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5705 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5709 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5710 { 6, alc882_sixstack_ch6_init },
5711 { 8, alc882_sixstack_ch8_init },
5715 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5721 static struct hda_verb alc885_mbp_ch2_init[] = {
5722 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5723 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5724 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5731 static struct hda_verb alc885_mbp_ch6_init[] = {
5732 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5733 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5734 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5735 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5736 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5740 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5741 { 2, alc885_mbp_ch2_init },
5742 { 6, alc885_mbp_ch6_init },
5746 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5747 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5749 static struct snd_kcontrol_new alc882_base_mixer[] = {
5750 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5751 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5752 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5753 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5754 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5755 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5756 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5757 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5758 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5759 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5760 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5761 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5762 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5763 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5764 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5765 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5766 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5768 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5769 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5770 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5771 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5772 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5776 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5777 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5778 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5779 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5780 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5781 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5782 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5784 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5785 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5786 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5789 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5791 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5799 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5800 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5804 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5805 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5806 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5807 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5810 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5811 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5814 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5815 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5816 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5817 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5821 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5822 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5824 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5825 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5826 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5828 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5832 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5833 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5834 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5837 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5841 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5842 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5843 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5845 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5846 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5847 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5848 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5850 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5852 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5853 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5857 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5859 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5860 .name = "Channel Mode",
5861 .info = alc_ch_mode_info,
5862 .get = alc_ch_mode_get,
5863 .put = alc_ch_mode_put,
5868 static struct hda_verb alc882_init_verbs[] = {
5869 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5872 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5874 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5882 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5884 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5886 /* Front Pin: output 0 (0x0c) */
5887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5888 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5889 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5890 /* Rear Pin: output 1 (0x0d) */
5891 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5892 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5893 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5894 /* CLFE Pin: output 2 (0x0e) */
5895 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5896 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5897 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5898 /* Side Pin: output 3 (0x0f) */
5899 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5900 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5901 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5902 /* Mic (rear) pin: input vref at 80% */
5903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5904 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5905 /* Front Mic pin: input vref at 80% */
5906 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5907 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5908 /* Line In pin: input */
5909 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5910 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5911 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5912 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5913 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5914 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5915 /* CD pin widget for input */
5916 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5918 /* FIXME: use matrix-type input source selection */
5919 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5920 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5921 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5922 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5923 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5924 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5926 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5927 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5928 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5929 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5935 /* ADC1: mute amp left and right */
5936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5937 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5938 /* ADC2: mute amp left and right */
5939 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5940 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5941 /* ADC3: mute amp left and right */
5942 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5943 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5948 static struct hda_verb alc882_eapd_verbs[] = {
5949 /* change to EAPD mode */
5950 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5951 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5956 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5958 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5960 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5961 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5962 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5963 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5967 static struct hda_verb alc882_macpro_init_verbs[] = {
5968 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5969 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5970 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5971 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5972 /* Front Pin: output 0 (0x0c) */
5973 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5976 /* Front Mic pin: input vref at 80% */
5977 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5978 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5979 /* Speaker: output */
5980 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5981 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5982 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5983 /* Headphone output (output 0 - 0x0c) */
5984 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5985 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5986 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5988 /* FIXME: use matrix-type input source selection */
5989 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5990 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5991 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5992 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5993 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5994 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5996 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5997 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5998 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5999 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6004 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6005 /* ADC1: mute amp left and right */
6006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6007 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6008 /* ADC2: mute amp left and right */
6009 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6010 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6011 /* ADC3: mute amp left and right */
6012 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6013 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6018 /* Macbook Pro rev3 */
6019 static struct hda_verb alc885_mbp3_init_verbs[] = {
6020 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6025 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6026 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6028 /* Front Pin: output 0 (0x0c) */
6029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6031 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6032 /* HP Pin: output 0 (0x0d) */
6033 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6035 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6036 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6037 /* Mic (rear) pin: input vref at 80% */
6038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6039 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6040 /* Front Mic pin: input vref at 80% */
6041 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6042 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6043 /* Line In pin: use output 1 when in LineOut mode */
6044 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6045 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6046 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6048 /* FIXME: use matrix-type input source selection */
6049 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6050 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6051 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6052 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6053 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6054 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6056 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6058 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6059 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6065 /* ADC1: mute amp left and right */
6066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6067 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6068 /* ADC2: mute amp left and right */
6069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6070 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6071 /* ADC3: mute amp left and right */
6072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6073 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6078 /* iMac 24 mixer. */
6079 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6080 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6081 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6085 /* iMac 24 init verbs. */
6086 static struct hda_verb alc885_imac24_init_verbs[] = {
6087 /* Internal speakers: output 0 (0x0c) */
6088 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6089 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6090 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6091 /* Internal speakers: output 0 (0x0c) */
6092 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6093 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6094 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6095 /* Headphone: output 0 (0x0c) */
6096 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6097 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6098 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6099 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6100 /* Front Mic: input vref at 80% */
6101 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6102 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6106 /* Toggle speaker-output according to the hp-jack state */
6107 static void alc885_imac24_automute(struct hda_codec *codec)
6109 unsigned int present;
6111 present = snd_hda_codec_read(codec, 0x14, 0,
6112 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6113 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6114 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6115 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6116 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6119 /* Processes unsolicited events. */
6120 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6123 /* Headphone insertion or removal. */
6124 if ((res >> 26) == ALC880_HP_EVENT)
6125 alc885_imac24_automute(codec);
6128 static void alc885_mbp3_automute(struct hda_codec *codec)
6130 unsigned int present;
6132 present = snd_hda_codec_read(codec, 0x15, 0,
6133 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6134 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6135 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6136 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6137 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6140 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6143 /* Headphone insertion or removal. */
6144 if ((res >> 26) == ALC880_HP_EVENT)
6145 alc885_mbp3_automute(codec);
6149 static struct hda_verb alc882_targa_verbs[] = {
6150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6154 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6156 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6157 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6158 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6160 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6161 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6162 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6163 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6167 /* toggle speaker-output according to the hp-jack state */
6168 static void alc882_targa_automute(struct hda_codec *codec)
6170 unsigned int present;
6172 present = snd_hda_codec_read(codec, 0x14, 0,
6173 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6174 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6175 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6176 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6180 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6182 /* Looks like the unsol event is incompatible with the standard
6183 * definition. 4bit tag is placed at 26 bit!
6185 if (((res >> 26) == ALC880_HP_EVENT)) {
6186 alc882_targa_automute(codec);
6190 static struct hda_verb alc882_asus_a7j_verbs[] = {
6191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6192 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6195 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6198 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6199 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6200 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6202 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6203 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6204 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6208 static struct hda_verb alc882_asus_a7m_verbs[] = {
6209 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6210 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6214 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6216 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6217 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6218 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6220 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6221 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6222 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6226 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6228 unsigned int gpiostate, gpiomask, gpiodir;
6230 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6231 AC_VERB_GET_GPIO_DATA, 0);
6234 gpiostate |= (1 << pin);
6236 gpiostate &= ~(1 << pin);
6238 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6239 AC_VERB_GET_GPIO_MASK, 0);
6240 gpiomask |= (1 << pin);
6242 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6243 AC_VERB_GET_GPIO_DIRECTION, 0);
6244 gpiodir |= (1 << pin);
6247 snd_hda_codec_write(codec, codec->afg, 0,
6248 AC_VERB_SET_GPIO_MASK, gpiomask);
6249 snd_hda_codec_write(codec, codec->afg, 0,
6250 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6254 snd_hda_codec_write(codec, codec->afg, 0,
6255 AC_VERB_SET_GPIO_DATA, gpiostate);
6258 /* set up GPIO at initialization */
6259 static void alc885_macpro_init_hook(struct hda_codec *codec)
6261 alc882_gpio_mute(codec, 0, 0);
6262 alc882_gpio_mute(codec, 1, 0);
6265 /* set up GPIO and update auto-muting at initialization */
6266 static void alc885_imac24_init_hook(struct hda_codec *codec)
6268 alc885_macpro_init_hook(codec);
6269 alc885_imac24_automute(codec);
6273 * generic initialization of ADC, input mixers and output mixers
6275 static struct hda_verb alc882_auto_init_verbs[] = {
6277 * Unmute ADC0-2 and set the default input to mic-in
6279 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6281 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6282 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6283 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6286 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6288 * Note: PASD motherboards uses the Line In 2 as the input for
6289 * front panel mic (mic 2)
6291 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6299 * Set up output mixers (0x0c - 0x0f)
6301 /* set vol=0 to output mixers */
6302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6303 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6304 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6305 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6306 /* set up input amps for analog loopback */
6307 /* Amp Indices: DAC = 0, mixer = 1 */
6308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6316 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6317 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6319 /* FIXME: use matrix-type input source selection */
6320 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6321 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6322 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6340 /* capture mixer elements */
6341 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6342 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6343 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6344 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6345 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6348 /* The multiple "Capture Source" controls confuse alsamixer
6349 * So call somewhat different..
6351 /* .name = "Capture Source", */
6352 .name = "Input Source",
6354 .info = alc882_mux_enum_info,
6355 .get = alc882_mux_enum_get,
6356 .put = alc882_mux_enum_put,
6361 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6362 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6363 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6364 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6365 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6366 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6367 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6369 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6370 /* The multiple "Capture Source" controls confuse alsamixer
6371 * So call somewhat different..
6373 /* .name = "Capture Source", */
6374 .name = "Input Source",
6376 .info = alc882_mux_enum_info,
6377 .get = alc882_mux_enum_get,
6378 .put = alc882_mux_enum_put,
6383 #ifdef CONFIG_SND_HDA_POWER_SAVE
6384 #define alc882_loopbacks alc880_loopbacks
6387 /* pcm configuration: identiacal with ALC880 */
6388 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6389 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6390 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6391 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6394 * configuration and preset
6396 static const char *alc882_models[ALC882_MODEL_LAST] = {
6397 [ALC882_3ST_DIG] = "3stack-dig",
6398 [ALC882_6ST_DIG] = "6stack-dig",
6399 [ALC882_ARIMA] = "arima",
6400 [ALC882_W2JC] = "w2jc",
6401 [ALC882_TARGA] = "targa",
6402 [ALC882_ASUS_A7J] = "asus-a7j",
6403 [ALC882_ASUS_A7M] = "asus-a7m",
6404 [ALC885_MACPRO] = "macpro",
6405 [ALC885_MBP3] = "mbp3",
6406 [ALC885_IMAC24] = "imac24",
6407 [ALC882_AUTO] = "auto",
6410 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6411 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6412 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6413 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6414 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6415 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6416 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6417 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6418 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6419 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6420 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6421 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6422 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6426 static struct alc_config_preset alc882_presets[] = {
6427 [ALC882_3ST_DIG] = {
6428 .mixers = { alc882_base_mixer },
6429 .init_verbs = { alc882_init_verbs },
6430 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6431 .dac_nids = alc882_dac_nids,
6432 .dig_out_nid = ALC882_DIGOUT_NID,
6433 .dig_in_nid = ALC882_DIGIN_NID,
6434 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6435 .channel_mode = alc882_ch_modes,
6437 .input_mux = &alc882_capture_source,
6439 [ALC882_6ST_DIG] = {
6440 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6441 .init_verbs = { alc882_init_verbs },
6442 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6443 .dac_nids = alc882_dac_nids,
6444 .dig_out_nid = ALC882_DIGOUT_NID,
6445 .dig_in_nid = ALC882_DIGIN_NID,
6446 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6447 .channel_mode = alc882_sixstack_modes,
6448 .input_mux = &alc882_capture_source,
6451 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6452 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6453 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6454 .dac_nids = alc882_dac_nids,
6455 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6456 .channel_mode = alc882_sixstack_modes,
6457 .input_mux = &alc882_capture_source,
6460 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6461 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6462 alc880_gpio1_init_verbs },
6463 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6464 .dac_nids = alc882_dac_nids,
6465 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6466 .channel_mode = alc880_threestack_modes,
6468 .input_mux = &alc882_capture_source,
6469 .dig_out_nid = ALC882_DIGOUT_NID,
6472 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6473 .init_verbs = { alc885_mbp3_init_verbs,
6474 alc880_gpio1_init_verbs },
6475 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6476 .dac_nids = alc882_dac_nids,
6477 .channel_mode = alc885_mbp_6ch_modes,
6478 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6479 .input_mux = &alc882_capture_source,
6480 .dig_out_nid = ALC882_DIGOUT_NID,
6481 .dig_in_nid = ALC882_DIGIN_NID,
6482 .unsol_event = alc885_mbp3_unsol_event,
6483 .init_hook = alc885_mbp3_automute,
6486 .mixers = { alc882_macpro_mixer },
6487 .init_verbs = { alc882_macpro_init_verbs },
6488 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6489 .dac_nids = alc882_dac_nids,
6490 .dig_out_nid = ALC882_DIGOUT_NID,
6491 .dig_in_nid = ALC882_DIGIN_NID,
6492 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6493 .channel_mode = alc882_ch_modes,
6494 .input_mux = &alc882_capture_source,
6495 .init_hook = alc885_macpro_init_hook,
6498 .mixers = { alc885_imac24_mixer },
6499 .init_verbs = { alc885_imac24_init_verbs },
6500 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6501 .dac_nids = alc882_dac_nids,
6502 .dig_out_nid = ALC882_DIGOUT_NID,
6503 .dig_in_nid = ALC882_DIGIN_NID,
6504 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6505 .channel_mode = alc882_ch_modes,
6506 .input_mux = &alc882_capture_source,
6507 .unsol_event = alc885_imac24_unsol_event,
6508 .init_hook = alc885_imac24_init_hook,
6511 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6512 alc882_capture_mixer },
6513 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6514 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6515 .dac_nids = alc882_dac_nids,
6516 .dig_out_nid = ALC882_DIGOUT_NID,
6517 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6518 .adc_nids = alc882_adc_nids,
6519 .capsrc_nids = alc882_capsrc_nids,
6520 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6521 .channel_mode = alc882_3ST_6ch_modes,
6523 .input_mux = &alc882_capture_source,
6524 .unsol_event = alc882_targa_unsol_event,
6525 .init_hook = alc882_targa_automute,
6527 [ALC882_ASUS_A7J] = {
6528 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6529 alc882_capture_mixer },
6530 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6531 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6532 .dac_nids = alc882_dac_nids,
6533 .dig_out_nid = ALC882_DIGOUT_NID,
6534 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6535 .adc_nids = alc882_adc_nids,
6536 .capsrc_nids = alc882_capsrc_nids,
6537 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6538 .channel_mode = alc882_3ST_6ch_modes,
6540 .input_mux = &alc882_capture_source,
6542 [ALC882_ASUS_A7M] = {
6543 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6544 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6545 alc880_gpio1_init_verbs,
6546 alc882_asus_a7m_verbs },
6547 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6548 .dac_nids = alc882_dac_nids,
6549 .dig_out_nid = ALC882_DIGOUT_NID,
6550 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6551 .channel_mode = alc880_threestack_modes,
6553 .input_mux = &alc882_capture_source,
6562 PINFIX_ABIT_AW9D_MAX
6565 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6566 { 0x15, 0x01080104 }, /* side */
6567 { 0x16, 0x01011012 }, /* rear */
6568 { 0x17, 0x01016011 }, /* clfe */
6572 static const struct alc_pincfg *alc882_pin_fixes[] = {
6573 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6576 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6577 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6582 * BIOS auto configuration
6584 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6585 hda_nid_t nid, int pin_type,
6589 struct alc_spec *spec = codec->spec;
6592 alc_set_pin_output(codec, nid, pin_type);
6593 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6596 idx = spec->multiout.dac_nids[dac_idx] - 2;
6597 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6601 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6603 struct alc_spec *spec = codec->spec;
6606 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6607 for (i = 0; i <= HDA_SIDE; i++) {
6608 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6609 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6611 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6616 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6618 struct alc_spec *spec = codec->spec;
6621 pin = spec->autocfg.hp_pins[0];
6622 if (pin) /* connect to front */
6624 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6625 pin = spec->autocfg.speaker_pins[0];
6627 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6630 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6631 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6633 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6635 struct alc_spec *spec = codec->spec;
6638 for (i = 0; i < AUTO_PIN_LAST; i++) {
6639 hda_nid_t nid = spec->autocfg.input_pins[i];
6644 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6645 unsigned int pincap;
6646 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6647 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6651 snd_hda_codec_write(codec, nid, 0,
6652 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6653 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6654 snd_hda_codec_write(codec, nid, 0,
6655 AC_VERB_SET_AMP_GAIN_MUTE,
6660 static void alc882_auto_init_input_src(struct hda_codec *codec)
6662 struct alc_spec *spec = codec->spec;
6663 const struct hda_input_mux *imux = spec->input_mux;
6666 for (c = 0; c < spec->num_adc_nids; c++) {
6667 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6668 hda_nid_t nid = spec->capsrc_nids[c];
6669 int conns, mute, idx, item;
6671 conns = snd_hda_get_connections(codec, nid, conn_list,
6672 ARRAY_SIZE(conn_list));
6675 for (idx = 0; idx < conns; idx++) {
6676 /* if the current connection is the selected one,
6677 * unmute it as default - otherwise mute it
6679 mute = AMP_IN_MUTE(idx);
6680 for (item = 0; item < imux->num_items; item++) {
6681 if (imux->items[item].index == idx) {
6682 if (spec->cur_mux[c] == item)
6683 mute = AMP_IN_UNMUTE(idx);
6687 snd_hda_codec_write(codec, nid, 0,
6688 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6693 /* add mic boosts if needed */
6694 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6696 struct alc_spec *spec = codec->spec;
6700 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6701 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6702 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6704 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6708 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6709 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6710 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6712 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6719 /* almost identical with ALC880 parser... */
6720 static int alc882_parse_auto_config(struct hda_codec *codec)
6722 struct alc_spec *spec = codec->spec;
6723 int err = alc880_parse_auto_config(codec);
6728 return 0; /* no config found */
6730 err = alc_auto_add_mic_boost(codec);
6734 /* hack - override the init verbs */
6735 spec->init_verbs[0] = alc882_auto_init_verbs;
6737 return 1; /* config found */
6740 /* additional initialization for auto-configuration model */
6741 static void alc882_auto_init(struct hda_codec *codec)
6743 struct alc_spec *spec = codec->spec;
6744 alc882_auto_init_multi_out(codec);
6745 alc882_auto_init_hp_out(codec);
6746 alc882_auto_init_analog_input(codec);
6747 alc882_auto_init_input_src(codec);
6748 if (spec->unsol_event)
6749 alc_inithook(codec);
6752 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6754 static int patch_alc882(struct hda_codec *codec)
6756 struct alc_spec *spec;
6757 int err, board_config;
6759 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6765 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6769 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6770 /* Pick up systems that don't supply PCI SSID */
6771 switch (codec->subsystem_id) {
6772 case 0x106b0c00: /* Mac Pro */
6773 board_config = ALC885_MACPRO;
6775 case 0x106b1000: /* iMac 24 */
6776 case 0x106b2800: /* AppleTV */
6777 board_config = ALC885_IMAC24;
6779 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6780 case 0x106b00a4: /* MacbookPro4,1 */
6781 case 0x106b2c00: /* Macbook Pro rev3 */
6782 case 0x106b3600: /* Macbook 3.1 */
6783 board_config = ALC885_MBP3;
6786 /* ALC889A is handled better as ALC888-compatible */
6787 if (codec->revision_id == 0x100101 ||
6788 codec->revision_id == 0x100103) {
6790 return patch_alc883(codec);
6792 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6793 "trying auto-probe from BIOS...\n");
6794 board_config = ALC882_AUTO;
6798 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6800 if (board_config == ALC882_AUTO) {
6801 /* automatic parse from the BIOS config */
6802 err = alc882_parse_auto_config(codec);
6808 "hda_codec: Cannot set up configuration "
6809 "from BIOS. Using base mode...\n");
6810 board_config = ALC882_3ST_DIG;
6814 if (board_config != ALC882_AUTO)
6815 setup_preset(spec, &alc882_presets[board_config]);
6817 if (codec->vendor_id == 0x10ec0885) {
6818 spec->stream_name_analog = "ALC885 Analog";
6819 spec->stream_name_digital = "ALC885 Digital";
6821 spec->stream_name_analog = "ALC882 Analog";
6822 spec->stream_name_digital = "ALC882 Digital";
6825 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6826 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6827 /* FIXME: setup DAC5 */
6828 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6829 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6831 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6832 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6834 if (!spec->adc_nids && spec->input_mux) {
6835 /* check whether NID 0x07 is valid */
6836 unsigned int wcap = get_wcaps(codec, 0x07);
6838 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6839 if (wcap != AC_WID_AUD_IN) {
6840 spec->adc_nids = alc882_adc_nids_alt;
6841 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6842 spec->capsrc_nids = alc882_capsrc_nids_alt;
6843 spec->mixers[spec->num_mixers] =
6844 alc882_capture_alt_mixer;
6847 spec->adc_nids = alc882_adc_nids;
6848 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6849 spec->capsrc_nids = alc882_capsrc_nids;
6850 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6855 spec->vmaster_nid = 0x0c;
6857 codec->patch_ops = alc_patch_ops;
6858 if (board_config == ALC882_AUTO)
6859 spec->init_hook = alc882_auto_init;
6860 #ifdef CONFIG_SND_HDA_POWER_SAVE
6861 if (!spec->loopback.amplist)
6862 spec->loopback.amplist = alc882_loopbacks;
6871 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6872 * configuration. Each pin widget can choose any input DACs and a mixer.
6873 * Each ADC is connected from a mixer of all inputs. This makes possible
6874 * 6-channel independent captures.
6876 * In addition, an independent DAC for the multi-playback (not used in this
6879 #define ALC883_DIGOUT_NID 0x06
6880 #define ALC883_DIGIN_NID 0x0a
6882 static hda_nid_t alc883_dac_nids[4] = {
6883 /* front, rear, clfe, rear_surr */
6884 0x02, 0x03, 0x04, 0x05
6887 static hda_nid_t alc883_adc_nids[2] = {
6892 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6895 /* FIXME: should be a matrix-type input source selection */
6897 static struct hda_input_mux alc883_capture_source = {
6901 { "Front Mic", 0x1 },
6907 static struct hda_input_mux alc883_3stack_6ch_intel = {
6911 { "Front Mic", 0x0 },
6917 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6925 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6935 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6943 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6947 { "Front Mic", 0x1 },
6952 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6960 #define alc883_mux_enum_info alc_mux_enum_info
6961 #define alc883_mux_enum_get alc_mux_enum_get
6962 /* ALC883 has the ALC882-type input selection */
6963 #define alc883_mux_enum_put alc882_mux_enum_put
6968 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6975 static struct hda_verb alc883_3ST_ch2_init[] = {
6976 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6977 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6978 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6979 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6986 static struct hda_verb alc883_3ST_ch4_init[] = {
6987 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6988 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6989 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6990 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6991 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6998 static struct hda_verb alc883_3ST_ch6_init[] = {
6999 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7000 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7001 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7002 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7003 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7004 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7008 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7009 { 2, alc883_3ST_ch2_init },
7010 { 4, alc883_3ST_ch4_init },
7011 { 6, alc883_3ST_ch6_init },
7017 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7018 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7019 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7020 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7021 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7028 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7029 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7030 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7031 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7032 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7033 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7040 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7041 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7042 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7043 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7044 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7045 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7046 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7050 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7051 { 2, alc883_3ST_ch2_intel_init },
7052 { 4, alc883_3ST_ch4_intel_init },
7053 { 6, alc883_3ST_ch6_intel_init },
7059 static struct hda_verb alc883_sixstack_ch6_init[] = {
7060 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7061 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7062 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7063 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7070 static struct hda_verb alc883_sixstack_ch8_init[] = {
7071 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7072 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7073 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7074 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7078 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7079 { 6, alc883_sixstack_ch6_init },
7080 { 8, alc883_sixstack_ch8_init },
7083 static struct hda_verb alc883_medion_eapd_verbs[] = {
7084 /* eanable EAPD on medion laptop */
7085 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7086 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7090 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7091 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7094 static struct snd_kcontrol_new alc883_base_mixer[] = {
7095 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7096 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7098 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7099 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7100 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7101 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7102 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7104 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7105 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7111 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7113 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7114 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7116 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7117 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7118 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7119 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7120 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7121 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7123 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7124 /* .name = "Capture Source", */
7125 .name = "Input Source",
7127 .info = alc883_mux_enum_info,
7128 .get = alc883_mux_enum_get,
7129 .put = alc883_mux_enum_put,
7134 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7135 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7136 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7137 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7138 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7139 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7140 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7141 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7146 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7149 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7150 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7151 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7154 /* .name = "Capture Source", */
7155 .name = "Input Source",
7157 .info = alc883_mux_enum_info,
7158 .get = alc883_mux_enum_get,
7159 .put = alc883_mux_enum_put,
7164 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7165 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7166 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7167 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7168 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7170 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7172 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7173 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7174 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7175 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7176 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7177 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7178 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7181 /* .name = "Capture Source", */
7182 .name = "Input Source",
7184 .info = alc883_mux_enum_info,
7185 .get = alc883_mux_enum_get,
7186 .put = alc883_mux_enum_put,
7191 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7192 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7193 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7194 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7195 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7197 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7199 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7200 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7201 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7202 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7203 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7204 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7205 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7207 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7208 /* .name = "Capture Source", */
7209 .name = "Input Source",
7211 .info = alc883_mux_enum_info,
7212 .get = alc883_mux_enum_get,
7213 .put = alc883_mux_enum_put,
7218 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7219 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7220 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7221 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7222 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7223 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7224 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7225 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7226 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7227 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7228 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7229 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7230 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7231 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7232 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7233 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7234 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7235 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7236 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7237 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7240 /* .name = "Capture Source", */
7241 .name = "Input Source",
7243 .info = alc883_mux_enum_info,
7244 .get = alc883_mux_enum_get,
7245 .put = alc883_mux_enum_put,
7250 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7252 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7254 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7255 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7256 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7257 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7258 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7260 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7261 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7262 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7263 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7267 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7268 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7269 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7270 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7271 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7272 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7273 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7275 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7276 /* .name = "Capture Source", */
7277 .name = "Input Source",
7279 .info = alc883_mux_enum_info,
7280 .get = alc883_mux_enum_get,
7281 .put = alc883_mux_enum_put,
7286 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7287 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7288 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7289 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7290 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7291 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7293 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7294 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7295 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7296 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7297 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7298 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7299 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7300 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7302 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7303 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7304 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7305 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7306 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7307 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7308 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7309 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7310 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7311 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7312 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7314 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7315 /* .name = "Capture Source", */
7316 .name = "Input Source",
7318 .info = alc883_mux_enum_info,
7319 .get = alc883_mux_enum_get,
7320 .put = alc883_mux_enum_put,
7325 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7327 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7328 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7329 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7330 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7331 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7332 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7333 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7335 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7336 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7337 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7338 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7339 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7340 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7341 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7342 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7343 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7344 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7345 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7346 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7347 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7348 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7351 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7352 /* .name = "Capture Source", */
7353 .name = "Input Source",
7355 .info = alc883_mux_enum_info,
7356 .get = alc883_mux_enum_get,
7357 .put = alc883_mux_enum_put,
7362 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7363 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7364 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7365 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7366 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7367 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7368 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7369 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7370 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7371 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7372 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7373 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7374 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7375 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7377 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7378 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7379 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7380 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7381 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7382 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7384 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7385 /* .name = "Capture Source", */
7386 .name = "Input Source",
7388 .info = alc883_mux_enum_info,
7389 .get = alc883_mux_enum_get,
7390 .put = alc883_mux_enum_put,
7395 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7396 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7398 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7399 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7400 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7402 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7404 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7405 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7406 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7407 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7408 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7409 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7410 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7412 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7413 /* .name = "Capture Source", */
7414 .name = "Input Source",
7416 .info = alc883_mux_enum_info,
7417 .get = alc883_mux_enum_get,
7418 .put = alc883_mux_enum_put,
7423 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7424 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7425 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7426 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7427 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7428 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7429 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7431 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7432 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7433 HDA_CODEC_MUTE("Capture Switch", 0x08, 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 snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7447 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7448 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7449 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7450 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7451 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7452 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7453 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7454 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7455 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7456 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7457 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7458 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7459 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7461 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7462 /* .name = "Capture Source", */
7463 .name = "Input Source",
7465 .info = alc883_mux_enum_info,
7466 .get = alc883_mux_enum_get,
7467 .put = alc883_mux_enum_put,
7472 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7473 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7474 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7475 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7476 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7477 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7479 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7480 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7481 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7482 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7483 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7484 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7485 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7487 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7488 /* .name = "Capture Source", */
7489 .name = "Input Source",
7491 .info = alc883_mux_enum_info,
7492 .get = alc883_mux_enum_get,
7493 .put = alc883_mux_enum_put,
7498 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7499 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7500 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7501 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7502 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7503 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7505 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7506 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7507 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7508 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7509 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7510 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7512 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7513 /* .name = "Capture Source", */
7514 .name = "Input Source",
7516 .info = alc883_mux_enum_info,
7517 .get = alc883_mux_enum_get,
7518 .put = alc883_mux_enum_put,
7523 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7524 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7525 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7526 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7527 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7528 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7529 0x0d, 1, 0x0, HDA_OUTPUT),
7530 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7531 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7532 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7533 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7534 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7535 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7536 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7537 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7538 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7539 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7540 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7542 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7543 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7545 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7546 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7547 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7548 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7549 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7550 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7552 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7553 /* .name = "Capture Source", */
7554 .name = "Input Source",
7556 .info = alc883_mux_enum_info,
7557 .get = alc883_mux_enum_get,
7558 .put = alc883_mux_enum_put,
7563 static struct hda_bind_ctls alc883_bind_cap_vol = {
7564 .ops = &snd_hda_bind_vol,
7566 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7567 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7572 static struct hda_bind_ctls alc883_bind_cap_switch = {
7573 .ops = &snd_hda_bind_sw,
7575 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7576 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7581 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7582 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7583 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7585 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7586 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7588 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7590 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7591 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7593 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7594 /* .name = "Capture Source", */
7595 .name = "Input Source",
7597 .info = alc883_mux_enum_info,
7598 .get = alc883_mux_enum_get,
7599 .put = alc883_mux_enum_put,
7604 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7606 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7607 .name = "Channel Mode",
7608 .info = alc_ch_mode_info,
7609 .get = alc_ch_mode_get,
7610 .put = alc_ch_mode_put,
7615 static struct hda_verb alc883_init_verbs[] = {
7616 /* ADC1: mute amp left and right */
7617 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7618 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7619 /* ADC2: mute amp left and right */
7620 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7621 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7622 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7633 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7635 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7636 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7637 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7639 /* mute analog input loopbacks */
7640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7646 /* Front Pin: output 0 (0x0c) */
7647 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7648 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7649 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7650 /* Rear Pin: output 1 (0x0d) */
7651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7653 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7654 /* CLFE Pin: output 2 (0x0e) */
7655 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7656 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7657 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7658 /* Side Pin: output 3 (0x0f) */
7659 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7660 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7661 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7662 /* Mic (rear) pin: input vref at 80% */
7663 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7664 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7665 /* Front Mic pin: input vref at 80% */
7666 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7667 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7668 /* Line In pin: input */
7669 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7670 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7671 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7672 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7673 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7674 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7675 /* CD pin widget for input */
7676 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7678 /* FIXME: use matrix-type input source selection */
7679 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7681 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7682 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7683 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7684 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7686 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7687 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7688 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7689 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7693 /* toggle speaker-output according to the hp-jack state */
7694 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7696 unsigned int present;
7698 present = snd_hda_codec_read(codec, 0x15, 0,
7699 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7700 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7701 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7702 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7703 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7706 /* auto-toggle front mic */
7708 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7710 unsigned int present;
7713 present = snd_hda_codec_read(codec, 0x18, 0,
7714 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7715 bits = present ? HDA_AMP_MUTE : 0;
7716 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7720 static void alc883_mitac_automute(struct hda_codec *codec)
7722 alc883_mitac_hp_automute(codec);
7723 /* alc883_mitac_mic_automute(codec); */
7726 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7729 switch (res >> 26) {
7730 case ALC880_HP_EVENT:
7731 alc883_mitac_hp_automute(codec);
7733 case ALC880_MIC_EVENT:
7734 /* alc883_mitac_mic_automute(codec); */
7739 static struct hda_verb alc883_mitac_verbs[] = {
7741 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7744 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7745 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7747 /* enable unsolicited event */
7748 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7749 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7754 static struct hda_verb alc883_clevo_m720_verbs[] = {
7756 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7757 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7759 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7762 /* enable unsolicited event */
7763 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7764 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7769 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7771 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7774 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7775 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7777 /* enable unsolicited event */
7778 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7783 static struct hda_verb alc883_tagra_verbs[] = {
7784 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7785 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7787 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7790 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7791 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7792 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7794 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7795 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7796 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7797 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7802 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7803 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7804 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7805 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7809 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7810 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7811 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7812 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7817 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7820 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7821 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7822 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7826 static struct hda_verb alc883_haier_w66_verbs[] = {
7827 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7830 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7832 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7833 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7834 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7835 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7839 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7844 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7845 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7846 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7847 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7851 static struct hda_verb alc888_3st_hp_verbs[] = {
7852 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7853 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7854 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7858 static struct hda_verb alc888_6st_dell_verbs[] = {
7859 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7863 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7864 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7865 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7866 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7867 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7871 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7872 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7873 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7874 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7875 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7879 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7880 { 2, alc888_3st_hp_2ch_init },
7881 { 6, alc888_3st_hp_6ch_init },
7884 /* toggle front-jack and RCA according to the hp-jack state */
7885 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7887 unsigned int present;
7889 present = snd_hda_codec_read(codec, 0x1b, 0,
7890 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7891 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7892 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7893 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7894 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7897 /* toggle RCA according to the front-jack state */
7898 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7900 unsigned int present;
7902 present = snd_hda_codec_read(codec, 0x14, 0,
7903 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7904 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7905 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7908 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7911 if ((res >> 26) == ALC880_HP_EVENT)
7912 alc888_lenovo_ms7195_front_automute(codec);
7913 if ((res >> 26) == ALC880_FRONT_EVENT)
7914 alc888_lenovo_ms7195_rca_automute(codec);
7917 static struct hda_verb alc883_medion_md2_verbs[] = {
7918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7923 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7927 /* toggle speaker-output according to the hp-jack state */
7928 static void alc883_medion_md2_automute(struct hda_codec *codec)
7930 unsigned int present;
7932 present = snd_hda_codec_read(codec, 0x14, 0,
7933 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7934 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7935 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7938 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7941 if ((res >> 26) == ALC880_HP_EVENT)
7942 alc883_medion_md2_automute(codec);
7945 /* toggle speaker-output according to the hp-jack state */
7946 static void alc883_tagra_automute(struct hda_codec *codec)
7948 unsigned int present;
7951 present = snd_hda_codec_read(codec, 0x14, 0,
7952 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7953 bits = present ? HDA_AMP_MUTE : 0;
7954 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7955 HDA_AMP_MUTE, bits);
7956 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7960 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7962 if ((res >> 26) == ALC880_HP_EVENT)
7963 alc883_tagra_automute(codec);
7966 /* toggle speaker-output according to the hp-jack state */
7967 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7969 unsigned int present;
7972 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7973 & AC_PINSENSE_PRESENCE;
7974 bits = present ? HDA_AMP_MUTE : 0;
7975 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7976 HDA_AMP_MUTE, bits);
7979 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7981 unsigned int present;
7983 present = snd_hda_codec_read(codec, 0x18, 0,
7984 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7985 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7986 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7989 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7991 alc883_clevo_m720_hp_automute(codec);
7992 alc883_clevo_m720_mic_automute(codec);
7995 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7998 switch (res >> 26) {
7999 case ALC880_HP_EVENT:
8000 alc883_clevo_m720_hp_automute(codec);
8002 case ALC880_MIC_EVENT:
8003 alc883_clevo_m720_mic_automute(codec);
8008 /* toggle speaker-output according to the hp-jack state */
8009 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8011 unsigned int present;
8014 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8015 & AC_PINSENSE_PRESENCE;
8016 bits = present ? HDA_AMP_MUTE : 0;
8017 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8018 HDA_AMP_MUTE, bits);
8021 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8024 if ((res >> 26) == ALC880_HP_EVENT)
8025 alc883_2ch_fujitsu_pi2515_automute(codec);
8028 static void alc883_haier_w66_automute(struct hda_codec *codec)
8030 unsigned int present;
8033 present = snd_hda_codec_read(codec, 0x1b, 0,
8034 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8035 bits = present ? 0x80 : 0;
8036 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8040 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8043 if ((res >> 26) == ALC880_HP_EVENT)
8044 alc883_haier_w66_automute(codec);
8047 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8049 unsigned int present;
8052 present = snd_hda_codec_read(codec, 0x14, 0,
8053 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8054 bits = present ? HDA_AMP_MUTE : 0;
8055 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8056 HDA_AMP_MUTE, bits);
8059 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8061 unsigned int present;
8064 present = snd_hda_codec_read(codec, 0x1b, 0,
8065 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8066 bits = present ? HDA_AMP_MUTE : 0;
8067 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8068 HDA_AMP_MUTE, bits);
8069 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8070 HDA_AMP_MUTE, bits);
8073 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8076 if ((res >> 26) == ALC880_HP_EVENT)
8077 alc883_lenovo_101e_all_automute(codec);
8078 if ((res >> 26) == ALC880_FRONT_EVENT)
8079 alc883_lenovo_101e_ispeaker_automute(codec);
8082 /* toggle speaker-output according to the hp-jack state */
8083 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8085 unsigned int present;
8087 present = snd_hda_codec_read(codec, 0x14, 0,
8088 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8089 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8090 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8091 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8092 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8095 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8098 if ((res >> 26) == ALC880_HP_EVENT)
8099 alc883_acer_aspire_automute(codec);
8102 static struct hda_verb alc883_acer_eapd_verbs[] = {
8103 /* HP Pin: output 0 (0x0c) */
8104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8106 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8107 /* Front Pin: output 0 (0x0c) */
8108 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8109 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8110 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8111 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8112 /* eanable EAPD on medion laptop */
8113 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8114 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8115 /* enable unsolicited event */
8116 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8120 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8122 unsigned int present;
8124 present = snd_hda_codec_read(codec, 0x1b, 0,
8125 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8126 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8127 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8128 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8129 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8130 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8131 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8132 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8133 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8136 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8139 switch (res >> 26) {
8140 case ALC880_HP_EVENT:
8141 printk("hp_event\n");
8142 alc888_6st_dell_front_automute(codec);
8147 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8150 unsigned int present;
8152 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8153 present = snd_hda_codec_read(codec, 0x1b, 0,
8154 AC_VERB_GET_PIN_SENSE, 0);
8155 present = (present & 0x80000000) != 0;
8157 /* mute internal speaker */
8158 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8159 HDA_AMP_MUTE, HDA_AMP_MUTE);
8160 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8161 HDA_AMP_MUTE, HDA_AMP_MUTE);
8162 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8163 HDA_AMP_MUTE, HDA_AMP_MUTE);
8164 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8165 HDA_AMP_MUTE, HDA_AMP_MUTE);
8166 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8167 HDA_AMP_MUTE, HDA_AMP_MUTE);
8169 /* unmute internal speaker if necessary */
8170 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8171 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8172 HDA_AMP_MUTE, mute);
8173 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8174 HDA_AMP_MUTE, mute);
8175 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8176 HDA_AMP_MUTE, mute);
8177 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8178 HDA_AMP_MUTE, mute);
8179 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8180 HDA_AMP_MUTE, mute);
8184 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8187 if ((res >> 26) == ALC880_HP_EVENT)
8188 alc888_lenovo_sky_front_automute(codec);
8192 * generic initialization of ADC, input mixers and output mixers
8194 static struct hda_verb alc883_auto_init_verbs[] = {
8196 * Unmute ADC0-2 and set the default input to mic-in
8198 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8199 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8200 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8201 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8203 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8205 * Note: PASD motherboards uses the Line In 2 as the input for
8206 * front panel mic (mic 2)
8208 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8209 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8210 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8211 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8216 * Set up output mixers (0x0c - 0x0f)
8218 /* set vol=0 to output mixers */
8219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8220 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8221 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8222 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8223 /* set up input amps for analog loopback */
8224 /* Amp Indices: DAC = 0, mixer = 1 */
8225 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8226 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8227 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8228 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8229 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8230 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8231 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8232 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8233 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8234 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8236 /* FIXME: use matrix-type input source selection */
8237 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8239 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8240 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8241 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8242 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8245 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8246 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8247 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8248 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8254 /* capture mixer elements */
8255 static struct snd_kcontrol_new alc883_capture_mixer[] = {
8256 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8257 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8258 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
8259 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
8261 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8262 /* The multiple "Capture Source" controls confuse alsamixer
8263 * So call somewhat different..
8265 /* .name = "Capture Source", */
8266 .name = "Input Source",
8268 .info = alc882_mux_enum_info,
8269 .get = alc882_mux_enum_get,
8270 .put = alc882_mux_enum_put,
8275 static struct hda_verb alc888_asus_m90v_verbs[] = {
8276 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8277 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8279 /* enable unsolicited event */
8280 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8281 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8285 static void alc883_nb_mic_automute(struct hda_codec *codec)
8287 unsigned int present;
8289 present = snd_hda_codec_read(codec, 0x18, 0,
8290 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8291 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8292 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8293 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8294 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8297 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8299 unsigned int present;
8302 present = snd_hda_codec_read(codec, 0x1b, 0,
8303 AC_VERB_GET_PIN_SENSE, 0)
8304 & AC_PINSENSE_PRESENCE;
8305 bits = present ? 0 : PIN_OUT;
8306 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8308 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8310 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8314 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8317 switch (res >> 26) {
8318 case ALC880_HP_EVENT:
8319 alc883_M90V_speaker_automute(codec);
8321 case ALC880_MIC_EVENT:
8322 alc883_nb_mic_automute(codec);
8327 static void alc883_mode2_inithook(struct hda_codec *codec)
8329 alc883_M90V_speaker_automute(codec);
8330 alc883_nb_mic_automute(codec);
8333 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8335 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8337 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8338 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8339 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8340 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8341 /* enable unsolicited event */
8342 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8346 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8348 unsigned int present;
8351 present = snd_hda_codec_read(codec, 0x14, 0,
8352 AC_VERB_GET_PIN_SENSE, 0)
8353 & AC_PINSENSE_PRESENCE;
8354 bits = present ? 0 : PIN_OUT;
8355 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8359 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8362 switch (res >> 26) {
8363 case ALC880_HP_EVENT:
8364 alc883_eee1601_speaker_automute(codec);
8369 static void alc883_eee1601_inithook(struct hda_codec *codec)
8371 alc883_eee1601_speaker_automute(codec);
8374 #ifdef CONFIG_SND_HDA_POWER_SAVE
8375 #define alc883_loopbacks alc880_loopbacks
8378 /* pcm configuration: identiacal with ALC880 */
8379 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8380 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8381 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8382 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8383 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8386 * configuration and preset
8388 static const char *alc883_models[ALC883_MODEL_LAST] = {
8389 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8390 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8391 [ALC883_3ST_6ch] = "3stack-6ch",
8392 [ALC883_6ST_DIG] = "6stack-dig",
8393 [ALC883_TARGA_DIG] = "targa-dig",
8394 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8395 [ALC883_ACER] = "acer",
8396 [ALC883_ACER_ASPIRE] = "acer-aspire",
8397 [ALC883_MEDION] = "medion",
8398 [ALC883_MEDION_MD2] = "medion-md2",
8399 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8400 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8401 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8402 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8403 [ALC888_LENOVO_SKY] = "lenovo-sky",
8404 [ALC883_HAIER_W66] = "haier-w66",
8405 [ALC888_3ST_HP] = "3stack-hp",
8406 [ALC888_6ST_DELL] = "6stack-dell",
8407 [ALC883_MITAC] = "mitac",
8408 [ALC883_CLEVO_M720] = "clevo-m720",
8409 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8410 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8411 [ALC883_AUTO] = "auto",
8414 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8415 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8416 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8417 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8418 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8419 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8420 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8421 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8422 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8423 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8424 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8425 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8426 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8427 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8428 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8429 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8430 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8431 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8432 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8433 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8434 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8435 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8436 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8437 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8438 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8439 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8440 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8441 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8442 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8443 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8444 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8445 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8446 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8447 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8448 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8449 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8450 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8451 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8452 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8453 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8454 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8455 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8456 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8457 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8458 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8459 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8460 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8461 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8462 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8463 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8464 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8465 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8466 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8467 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8468 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8469 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8470 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8471 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8472 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8473 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8474 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8475 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8479 static struct alc_config_preset alc883_presets[] = {
8480 [ALC883_3ST_2ch_DIG] = {
8481 .mixers = { alc883_3ST_2ch_mixer },
8482 .init_verbs = { alc883_init_verbs },
8483 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8484 .dac_nids = alc883_dac_nids,
8485 .dig_out_nid = ALC883_DIGOUT_NID,
8486 .dig_in_nid = ALC883_DIGIN_NID,
8487 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8488 .channel_mode = alc883_3ST_2ch_modes,
8489 .input_mux = &alc883_capture_source,
8491 [ALC883_3ST_6ch_DIG] = {
8492 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8493 .init_verbs = { alc883_init_verbs },
8494 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8495 .dac_nids = alc883_dac_nids,
8496 .dig_out_nid = ALC883_DIGOUT_NID,
8497 .dig_in_nid = ALC883_DIGIN_NID,
8498 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8499 .channel_mode = alc883_3ST_6ch_modes,
8501 .input_mux = &alc883_capture_source,
8503 [ALC883_3ST_6ch] = {
8504 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8505 .init_verbs = { alc883_init_verbs },
8506 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8507 .dac_nids = alc883_dac_nids,
8508 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8509 .channel_mode = alc883_3ST_6ch_modes,
8511 .input_mux = &alc883_capture_source,
8513 [ALC883_3ST_6ch_INTEL] = {
8514 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8515 .init_verbs = { alc883_init_verbs },
8516 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8517 .dac_nids = alc883_dac_nids,
8518 .dig_out_nid = ALC883_DIGOUT_NID,
8519 .dig_in_nid = ALC883_DIGIN_NID,
8520 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8521 .channel_mode = alc883_3ST_6ch_intel_modes,
8523 .input_mux = &alc883_3stack_6ch_intel,
8525 [ALC883_6ST_DIG] = {
8526 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8527 .init_verbs = { alc883_init_verbs },
8528 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8529 .dac_nids = alc883_dac_nids,
8530 .dig_out_nid = ALC883_DIGOUT_NID,
8531 .dig_in_nid = ALC883_DIGIN_NID,
8532 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8533 .channel_mode = alc883_sixstack_modes,
8534 .input_mux = &alc883_capture_source,
8536 [ALC883_TARGA_DIG] = {
8537 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8538 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8539 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8540 .dac_nids = alc883_dac_nids,
8541 .dig_out_nid = ALC883_DIGOUT_NID,
8542 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8543 .channel_mode = alc883_3ST_6ch_modes,
8545 .input_mux = &alc883_capture_source,
8546 .unsol_event = alc883_tagra_unsol_event,
8547 .init_hook = alc883_tagra_automute,
8549 [ALC883_TARGA_2ch_DIG] = {
8550 .mixers = { alc883_tagra_2ch_mixer},
8551 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8552 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8553 .dac_nids = alc883_dac_nids,
8554 .dig_out_nid = ALC883_DIGOUT_NID,
8555 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8556 .channel_mode = alc883_3ST_2ch_modes,
8557 .input_mux = &alc883_capture_source,
8558 .unsol_event = alc883_tagra_unsol_event,
8559 .init_hook = alc883_tagra_automute,
8562 .mixers = { alc883_base_mixer },
8563 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8564 * and the headphone jack. Turn this on and rely on the
8565 * standard mute methods whenever the user wants to turn
8566 * these outputs off.
8568 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8569 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8570 .dac_nids = alc883_dac_nids,
8571 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8572 .channel_mode = alc883_3ST_2ch_modes,
8573 .input_mux = &alc883_capture_source,
8575 [ALC883_ACER_ASPIRE] = {
8576 .mixers = { alc883_acer_aspire_mixer },
8577 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8579 .dac_nids = alc883_dac_nids,
8580 .dig_out_nid = ALC883_DIGOUT_NID,
8581 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8582 .channel_mode = alc883_3ST_2ch_modes,
8583 .input_mux = &alc883_capture_source,
8584 .unsol_event = alc883_acer_aspire_unsol_event,
8585 .init_hook = alc883_acer_aspire_automute,
8588 .mixers = { alc883_fivestack_mixer,
8589 alc883_chmode_mixer },
8590 .init_verbs = { alc883_init_verbs,
8591 alc883_medion_eapd_verbs },
8592 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8593 .dac_nids = alc883_dac_nids,
8594 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8595 .channel_mode = alc883_sixstack_modes,
8596 .input_mux = &alc883_capture_source,
8598 [ALC883_MEDION_MD2] = {
8599 .mixers = { alc883_medion_md2_mixer},
8600 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8601 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8602 .dac_nids = alc883_dac_nids,
8603 .dig_out_nid = ALC883_DIGOUT_NID,
8604 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8605 .channel_mode = alc883_3ST_2ch_modes,
8606 .input_mux = &alc883_capture_source,
8607 .unsol_event = alc883_medion_md2_unsol_event,
8608 .init_hook = alc883_medion_md2_automute,
8610 [ALC883_LAPTOP_EAPD] = {
8611 .mixers = { alc883_base_mixer },
8612 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8614 .dac_nids = alc883_dac_nids,
8615 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8616 .channel_mode = alc883_3ST_2ch_modes,
8617 .input_mux = &alc883_capture_source,
8619 [ALC883_CLEVO_M720] = {
8620 .mixers = { alc883_clevo_m720_mixer },
8621 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8622 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8623 .dac_nids = alc883_dac_nids,
8624 .dig_out_nid = ALC883_DIGOUT_NID,
8625 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8626 .channel_mode = alc883_3ST_2ch_modes,
8627 .input_mux = &alc883_capture_source,
8628 .unsol_event = alc883_clevo_m720_unsol_event,
8629 .init_hook = alc883_clevo_m720_automute,
8631 [ALC883_LENOVO_101E_2ch] = {
8632 .mixers = { alc883_lenovo_101e_2ch_mixer},
8633 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8634 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8635 .dac_nids = alc883_dac_nids,
8636 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8637 .channel_mode = alc883_3ST_2ch_modes,
8638 .input_mux = &alc883_lenovo_101e_capture_source,
8639 .unsol_event = alc883_lenovo_101e_unsol_event,
8640 .init_hook = alc883_lenovo_101e_all_automute,
8642 [ALC883_LENOVO_NB0763] = {
8643 .mixers = { alc883_lenovo_nb0763_mixer },
8644 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8645 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8646 .dac_nids = alc883_dac_nids,
8647 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8648 .channel_mode = alc883_3ST_2ch_modes,
8650 .input_mux = &alc883_lenovo_nb0763_capture_source,
8651 .unsol_event = alc883_medion_md2_unsol_event,
8652 .init_hook = alc883_medion_md2_automute,
8654 [ALC888_LENOVO_MS7195_DIG] = {
8655 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8656 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8657 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8658 .dac_nids = alc883_dac_nids,
8659 .dig_out_nid = ALC883_DIGOUT_NID,
8660 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8661 .channel_mode = alc883_3ST_6ch_modes,
8663 .input_mux = &alc883_capture_source,
8664 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8665 .init_hook = alc888_lenovo_ms7195_front_automute,
8667 [ALC883_HAIER_W66] = {
8668 .mixers = { alc883_tagra_2ch_mixer},
8669 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8670 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8671 .dac_nids = alc883_dac_nids,
8672 .dig_out_nid = ALC883_DIGOUT_NID,
8673 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8674 .channel_mode = alc883_3ST_2ch_modes,
8675 .input_mux = &alc883_capture_source,
8676 .unsol_event = alc883_haier_w66_unsol_event,
8677 .init_hook = alc883_haier_w66_automute,
8680 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8681 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8682 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8683 .dac_nids = alc883_dac_nids,
8684 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8685 .channel_mode = alc888_3st_hp_modes,
8687 .input_mux = &alc883_capture_source,
8689 [ALC888_6ST_DELL] = {
8690 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8691 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8692 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8693 .dac_nids = alc883_dac_nids,
8694 .dig_out_nid = ALC883_DIGOUT_NID,
8695 .dig_in_nid = ALC883_DIGIN_NID,
8696 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8697 .channel_mode = alc883_sixstack_modes,
8698 .input_mux = &alc883_capture_source,
8699 .unsol_event = alc888_6st_dell_unsol_event,
8700 .init_hook = alc888_6st_dell_front_automute,
8703 .mixers = { alc883_mitac_mixer },
8704 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8705 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8706 .dac_nids = alc883_dac_nids,
8707 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8708 .channel_mode = alc883_3ST_2ch_modes,
8709 .input_mux = &alc883_capture_source,
8710 .unsol_event = alc883_mitac_unsol_event,
8711 .init_hook = alc883_mitac_automute,
8713 [ALC883_FUJITSU_PI2515] = {
8714 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8715 .init_verbs = { alc883_init_verbs,
8716 alc883_2ch_fujitsu_pi2515_verbs},
8717 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8718 .dac_nids = alc883_dac_nids,
8719 .dig_out_nid = ALC883_DIGOUT_NID,
8720 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8721 .channel_mode = alc883_3ST_2ch_modes,
8722 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8723 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8724 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8726 [ALC888_LENOVO_SKY] = {
8727 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8728 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8729 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8730 .dac_nids = alc883_dac_nids,
8731 .dig_out_nid = ALC883_DIGOUT_NID,
8732 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
8733 .adc_nids = alc883_adc_nids,
8734 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8735 .channel_mode = alc883_sixstack_modes,
8737 .input_mux = &alc883_lenovo_sky_capture_source,
8738 .unsol_event = alc883_lenovo_sky_unsol_event,
8739 .init_hook = alc888_lenovo_sky_front_automute,
8741 [ALC888_ASUS_M90V] = {
8742 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8743 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8744 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8745 .dac_nids = alc883_dac_nids,
8746 .dig_out_nid = ALC883_DIGOUT_NID,
8747 .dig_in_nid = ALC883_DIGIN_NID,
8748 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8749 .channel_mode = alc883_3ST_6ch_modes,
8751 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8752 .unsol_event = alc883_mode2_unsol_event,
8753 .init_hook = alc883_mode2_inithook,
8755 [ALC888_ASUS_EEE1601] = {
8756 .mixers = { alc883_asus_eee1601_mixer },
8757 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8759 .dac_nids = alc883_dac_nids,
8760 .dig_out_nid = ALC883_DIGOUT_NID,
8761 .dig_in_nid = ALC883_DIGIN_NID,
8762 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8763 .channel_mode = alc883_3ST_2ch_modes,
8765 .input_mux = &alc883_asus_eee1601_capture_source,
8766 .unsol_event = alc883_eee1601_unsol_event,
8767 .init_hook = alc883_eee1601_inithook,
8773 * BIOS auto configuration
8775 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8776 hda_nid_t nid, int pin_type,
8780 struct alc_spec *spec = codec->spec;
8783 alc_set_pin_output(codec, nid, pin_type);
8784 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8787 idx = spec->multiout.dac_nids[dac_idx] - 2;
8788 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8792 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8794 struct alc_spec *spec = codec->spec;
8797 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8798 for (i = 0; i <= HDA_SIDE; i++) {
8799 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8800 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8802 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8807 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8809 struct alc_spec *spec = codec->spec;
8812 pin = spec->autocfg.hp_pins[0];
8813 if (pin) /* connect to front */
8815 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8816 pin = spec->autocfg.speaker_pins[0];
8818 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8821 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8822 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8824 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8826 struct alc_spec *spec = codec->spec;
8829 for (i = 0; i < AUTO_PIN_LAST; i++) {
8830 hda_nid_t nid = spec->autocfg.input_pins[i];
8831 if (alc883_is_input_pin(nid)) {
8832 snd_hda_codec_write(codec, nid, 0,
8833 AC_VERB_SET_PIN_WIDGET_CONTROL,
8834 (i <= AUTO_PIN_FRONT_MIC ?
8835 PIN_VREF80 : PIN_IN));
8836 if (nid != ALC883_PIN_CD_NID)
8837 snd_hda_codec_write(codec, nid, 0,
8838 AC_VERB_SET_AMP_GAIN_MUTE,
8844 #define alc883_auto_init_input_src alc882_auto_init_input_src
8846 /* almost identical with ALC880 parser... */
8847 static int alc883_parse_auto_config(struct hda_codec *codec)
8849 struct alc_spec *spec = codec->spec;
8850 int err = alc880_parse_auto_config(codec);
8855 return 0; /* no config found */
8857 err = alc_auto_add_mic_boost(codec);
8861 /* hack - override the init verbs */
8862 spec->init_verbs[0] = alc883_auto_init_verbs;
8863 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8866 return 1; /* config found */
8869 /* additional initialization for auto-configuration model */
8870 static void alc883_auto_init(struct hda_codec *codec)
8872 struct alc_spec *spec = codec->spec;
8873 alc883_auto_init_multi_out(codec);
8874 alc883_auto_init_hp_out(codec);
8875 alc883_auto_init_analog_input(codec);
8876 alc883_auto_init_input_src(codec);
8877 if (spec->unsol_event)
8878 alc_inithook(codec);
8881 static int patch_alc883(struct hda_codec *codec)
8883 struct alc_spec *spec;
8884 int err, board_config;
8886 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8892 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8894 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8897 if (board_config < 0) {
8898 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8899 "trying auto-probe from BIOS...\n");
8900 board_config = ALC883_AUTO;
8903 if (board_config == ALC883_AUTO) {
8904 /* automatic parse from the BIOS config */
8905 err = alc883_parse_auto_config(codec);
8911 "hda_codec: Cannot set up configuration "
8912 "from BIOS. Using base mode...\n");
8913 board_config = ALC883_3ST_2ch_DIG;
8917 if (board_config != ALC883_AUTO)
8918 setup_preset(spec, &alc883_presets[board_config]);
8920 switch (codec->vendor_id) {
8922 if (codec->revision_id == 0x100101) {
8923 spec->stream_name_analog = "ALC1200 Analog";
8924 spec->stream_name_digital = "ALC1200 Digital";
8926 spec->stream_name_analog = "ALC888 Analog";
8927 spec->stream_name_digital = "ALC888 Digital";
8931 spec->stream_name_analog = "ALC889 Analog";
8932 spec->stream_name_digital = "ALC889 Digital";
8935 spec->stream_name_analog = "ALC883 Analog";
8936 spec->stream_name_digital = "ALC883 Digital";
8940 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8941 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8942 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8944 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8945 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8947 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8948 spec->adc_nids = alc883_adc_nids;
8949 spec->capsrc_nids = alc883_capsrc_nids;
8951 spec->vmaster_nid = 0x0c;
8953 codec->patch_ops = alc_patch_ops;
8954 if (board_config == ALC883_AUTO)
8955 spec->init_hook = alc883_auto_init;
8957 #ifdef CONFIG_SND_HDA_POWER_SAVE
8958 if (!spec->loopback.amplist)
8959 spec->loopback.amplist = alc883_loopbacks;
8969 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8970 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8972 #define alc262_dac_nids alc260_dac_nids
8973 #define alc262_adc_nids alc882_adc_nids
8974 #define alc262_adc_nids_alt alc882_adc_nids_alt
8975 #define alc262_capsrc_nids alc882_capsrc_nids
8976 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8978 #define alc262_modes alc260_modes
8979 #define alc262_capture_source alc882_capture_source
8981 static hda_nid_t alc262_dmic_adc_nids[1] = {
8986 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8988 static struct snd_kcontrol_new alc262_base_mixer[] = {
8989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8990 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8997 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8998 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8999 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9000 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9001 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9002 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9003 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9005 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9006 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9010 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9011 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9012 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9013 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9014 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9015 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9016 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9019 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9020 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9021 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9022 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9023 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9024 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9025 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9026 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9030 /* update HP, line and mono-out pins according to the master switch */
9031 static void alc262_hp_master_update(struct hda_codec *codec)
9033 struct alc_spec *spec = codec->spec;
9034 int val = spec->master_sw;
9037 snd_hda_codec_write_cache(codec, 0x1b, 0,
9038 AC_VERB_SET_PIN_WIDGET_CONTROL,
9040 snd_hda_codec_write_cache(codec, 0x15, 0,
9041 AC_VERB_SET_PIN_WIDGET_CONTROL,
9043 /* mono (speaker) depending on the HP jack sense */
9044 val = val && !spec->jack_present;
9045 snd_hda_codec_write_cache(codec, 0x16, 0,
9046 AC_VERB_SET_PIN_WIDGET_CONTROL,
9050 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9052 struct alc_spec *spec = codec->spec;
9053 unsigned int presence;
9054 presence = snd_hda_codec_read(codec, 0x1b, 0,
9055 AC_VERB_GET_PIN_SENSE, 0);
9056 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9057 alc262_hp_master_update(codec);
9060 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9062 if ((res >> 26) != ALC880_HP_EVENT)
9064 alc262_hp_bpc_automute(codec);
9067 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9069 struct alc_spec *spec = codec->spec;
9070 unsigned int presence;
9071 presence = snd_hda_codec_read(codec, 0x15, 0,
9072 AC_VERB_GET_PIN_SENSE, 0);
9073 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9074 alc262_hp_master_update(codec);
9077 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9080 if ((res >> 26) != ALC880_HP_EVENT)
9082 alc262_hp_wildwest_automute(codec);
9085 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9086 struct snd_ctl_elem_value *ucontrol)
9088 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9089 struct alc_spec *spec = codec->spec;
9090 *ucontrol->value.integer.value = spec->master_sw;
9094 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9095 struct snd_ctl_elem_value *ucontrol)
9097 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9098 struct alc_spec *spec = codec->spec;
9099 int val = !!*ucontrol->value.integer.value;
9101 if (val == spec->master_sw)
9103 spec->master_sw = val;
9104 alc262_hp_master_update(codec);
9108 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9111 .name = "Master Playback Switch",
9112 .info = snd_ctl_boolean_mono_info,
9113 .get = alc262_hp_master_sw_get,
9114 .put = alc262_hp_master_sw_put,
9116 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9117 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9119 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9121 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9125 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9126 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9127 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9128 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9133 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9134 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9135 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9136 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9140 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9142 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9143 .name = "Master Playback Switch",
9144 .info = snd_ctl_boolean_mono_info,
9145 .get = alc262_hp_master_sw_get,
9146 .put = alc262_hp_master_sw_put,
9148 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9149 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9150 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9152 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9154 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9156 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9157 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9158 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9159 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9160 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9162 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9163 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9164 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9168 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9169 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9170 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9171 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9175 /* mute/unmute internal speaker according to the hp jack and mute state */
9176 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9178 struct alc_spec *spec = codec->spec;
9180 if (force || !spec->sense_updated) {
9181 unsigned int present;
9182 present = snd_hda_codec_read(codec, 0x15, 0,
9183 AC_VERB_GET_PIN_SENSE, 0);
9184 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9185 spec->sense_updated = 1;
9187 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9188 spec->jack_present ? HDA_AMP_MUTE : 0);
9191 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9194 if ((res >> 26) != ALC880_HP_EVENT)
9196 alc262_hp_t5735_automute(codec, 1);
9199 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9201 alc262_hp_t5735_automute(codec, 1);
9204 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9205 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9206 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9207 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9208 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9209 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9210 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9211 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9215 static struct hda_verb alc262_hp_t5735_verbs[] = {
9216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9219 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9223 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9224 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9225 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9226 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9227 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9228 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9229 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9233 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9234 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9235 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9236 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9237 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9238 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9239 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9240 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9247 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9254 /* bind hp and internal speaker mute (with plug check) */
9255 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9256 struct snd_ctl_elem_value *ucontrol)
9258 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9259 long *valp = ucontrol->value.integer.value;
9262 /* change hp mute */
9263 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9265 valp[0] ? 0 : HDA_AMP_MUTE);
9266 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9268 valp[1] ? 0 : HDA_AMP_MUTE);
9270 /* change speaker according to HP jack state */
9271 struct alc_spec *spec = codec->spec;
9273 if (spec->jack_present)
9274 mute = HDA_AMP_MUTE;
9276 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9278 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9279 HDA_AMP_MUTE, mute);
9284 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9285 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9287 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9288 .name = "Master Playback Switch",
9289 .info = snd_hda_mixer_amp_switch_info,
9290 .get = snd_hda_mixer_amp_switch_get,
9291 .put = alc262_sony_master_sw_put,
9292 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9296 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9297 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9301 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9302 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9303 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9304 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9306 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9307 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9308 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9312 #define alc262_capture_mixer alc882_capture_mixer
9313 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9316 * generic initialization of ADC, input mixers and output mixers
9318 static struct hda_verb alc262_init_verbs[] = {
9320 * Unmute ADC0-2 and set the default input to mic-in
9322 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9324 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9326 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9327 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9329 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9331 * Note: PASD motherboards uses the Line In 2 as the input for
9332 * front panel mic (mic 2)
9334 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9342 * Set up output mixers (0x0c - 0x0e)
9344 /* set vol=0 to output mixers */
9345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9348 /* set up input amps for analog loopback */
9349 /* Amp Indices: DAC = 0, mixer = 1 */
9350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9352 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9359 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9360 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9361 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9362 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9364 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9365 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9366 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9367 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9368 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9370 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9371 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9373 /* FIXME: use matrix-type input source selection */
9374 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9375 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9376 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9377 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9378 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9379 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9383 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9394 static struct hda_verb alc262_eapd_verbs[] = {
9395 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9396 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9400 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9401 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9402 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9406 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9407 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9408 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9409 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9411 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9412 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9416 static struct hda_verb alc262_sony_unsol_verbs[] = {
9417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9418 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9419 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9421 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9422 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9426 static struct hda_input_mux alc262_dmic_capture_source = {
9429 { "Int DMic", 0x9 },
9434 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9435 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9436 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9439 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9440 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9441 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9444 /* The multiple "Capture Source" controls confuse alsamixer
9445 * So call somewhat different..
9447 /* .name = "Capture Source", */
9448 .name = "Input Source",
9450 .info = alc_mux_enum_info,
9451 .get = alc_mux_enum_get,
9452 .put = alc_mux_enum_put,
9457 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9458 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9459 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9461 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9462 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9463 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9464 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9465 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9469 static void alc262_dmic_automute(struct hda_codec *codec)
9471 unsigned int present;
9473 present = snd_hda_codec_read(codec, 0x18, 0,
9474 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9475 snd_hda_codec_write(codec, 0x22, 0,
9476 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9479 /* toggle speaker-output according to the hp-jack state */
9480 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9482 unsigned int present;
9485 present = snd_hda_codec_read(codec, 0x15, 0,
9486 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9487 bits = present ? 0 : PIN_OUT;
9488 snd_hda_codec_write(codec, 0x14, 0,
9489 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9494 /* unsolicited event for HP jack sensing */
9495 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9498 if ((res >> 26) == ALC880_HP_EVENT)
9499 alc262_toshiba_s06_speaker_automute(codec);
9500 if ((res >> 26) == ALC880_MIC_EVENT)
9501 alc262_dmic_automute(codec);
9505 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9507 alc262_toshiba_s06_speaker_automute(codec);
9508 alc262_dmic_automute(codec);
9511 /* mute/unmute internal speaker according to the hp jack and mute state */
9512 static void alc262_hippo_automute(struct hda_codec *codec)
9514 struct alc_spec *spec = codec->spec;
9516 unsigned int present;
9518 /* need to execute and sync at first */
9519 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9520 present = snd_hda_codec_read(codec, 0x15, 0,
9521 AC_VERB_GET_PIN_SENSE, 0);
9522 spec->jack_present = (present & 0x80000000) != 0;
9523 if (spec->jack_present) {
9524 /* mute internal speaker */
9525 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9526 HDA_AMP_MUTE, HDA_AMP_MUTE);
9528 /* unmute internal speaker if necessary */
9529 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9530 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9531 HDA_AMP_MUTE, mute);
9535 /* unsolicited event for HP jack sensing */
9536 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9539 if ((res >> 26) != ALC880_HP_EVENT)
9541 alc262_hippo_automute(codec);
9544 static void alc262_hippo1_automute(struct hda_codec *codec)
9547 unsigned int present;
9549 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9550 present = snd_hda_codec_read(codec, 0x1b, 0,
9551 AC_VERB_GET_PIN_SENSE, 0);
9552 present = (present & 0x80000000) != 0;
9554 /* mute internal speaker */
9555 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9556 HDA_AMP_MUTE, HDA_AMP_MUTE);
9558 /* unmute internal speaker if necessary */
9559 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9560 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9561 HDA_AMP_MUTE, mute);
9565 /* unsolicited event for HP jack sensing */
9566 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9569 if ((res >> 26) != ALC880_HP_EVENT)
9571 alc262_hippo1_automute(codec);
9577 * 0x16 = internal speaker
9578 * 0x18 = external mic
9581 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9582 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9583 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9586 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9587 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9589 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9594 static struct hda_verb alc262_nec_verbs[] = {
9595 /* Unmute Speaker */
9596 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9602 /* External mic to headphone */
9603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9604 /* External mic to speaker */
9605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9611 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9612 * 0x1b = port replicator headphone out
9615 #define ALC_HP_EVENT 0x37
9617 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9618 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9620 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9621 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9625 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9626 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9631 static struct hda_input_mux alc262_fujitsu_capture_source = {
9640 static struct hda_input_mux alc262_HP_capture_source = {
9644 { "Front Mic", 0x1 },
9651 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9655 { "Front Mic", 0x2 },
9661 /* mute/unmute internal speaker according to the hp jacks and mute state */
9662 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9664 struct alc_spec *spec = codec->spec;
9667 if (force || !spec->sense_updated) {
9668 unsigned int present;
9669 /* need to execute and sync at first */
9670 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9671 /* check laptop HP jack */
9672 present = snd_hda_codec_read(codec, 0x14, 0,
9673 AC_VERB_GET_PIN_SENSE, 0);
9674 /* need to execute and sync at first */
9675 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9676 /* check docking HP jack */
9677 present |= snd_hda_codec_read(codec, 0x1b, 0,
9678 AC_VERB_GET_PIN_SENSE, 0);
9679 if (present & AC_PINSENSE_PRESENCE)
9680 spec->jack_present = 1;
9682 spec->jack_present = 0;
9683 spec->sense_updated = 1;
9685 /* unmute internal speaker only if both HPs are unplugged and
9686 * master switch is on
9688 if (spec->jack_present)
9689 mute = HDA_AMP_MUTE;
9691 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9692 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9693 HDA_AMP_MUTE, mute);
9696 /* unsolicited event for HP jack sensing */
9697 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9700 if ((res >> 26) != ALC_HP_EVENT)
9702 alc262_fujitsu_automute(codec, 1);
9705 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9707 alc262_fujitsu_automute(codec, 1);
9710 /* bind volumes of both NID 0x0c and 0x0d */
9711 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9712 .ops = &snd_hda_bind_vol,
9714 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9715 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9720 /* mute/unmute internal speaker according to the hp jack and mute state */
9721 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9723 struct alc_spec *spec = codec->spec;
9726 if (force || !spec->sense_updated) {
9727 unsigned int present_int_hp;
9728 /* need to execute and sync at first */
9729 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9730 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9731 AC_VERB_GET_PIN_SENSE, 0);
9732 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9733 spec->sense_updated = 1;
9735 if (spec->jack_present) {
9736 /* mute internal speaker */
9737 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9738 HDA_AMP_MUTE, HDA_AMP_MUTE);
9739 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9740 HDA_AMP_MUTE, HDA_AMP_MUTE);
9742 /* unmute internal speaker if necessary */
9743 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9744 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9745 HDA_AMP_MUTE, mute);
9746 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9747 HDA_AMP_MUTE, mute);
9751 /* unsolicited event for HP jack sensing */
9752 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9755 if ((res >> 26) != ALC_HP_EVENT)
9757 alc262_lenovo_3000_automute(codec, 1);
9760 /* bind hp and internal speaker mute (with plug check) */
9761 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9762 struct snd_ctl_elem_value *ucontrol)
9764 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9765 long *valp = ucontrol->value.integer.value;
9768 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9770 valp ? 0 : HDA_AMP_MUTE);
9771 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9773 valp ? 0 : HDA_AMP_MUTE);
9776 alc262_fujitsu_automute(codec, 0);
9780 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9781 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9784 .name = "Master Playback Switch",
9785 .info = snd_hda_mixer_amp_switch_info,
9786 .get = snd_hda_mixer_amp_switch_get,
9787 .put = alc262_fujitsu_master_sw_put,
9788 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9790 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9791 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9792 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9793 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9794 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9797 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9798 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9799 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9803 /* bind hp and internal speaker mute (with plug check) */
9804 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9805 struct snd_ctl_elem_value *ucontrol)
9807 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9808 long *valp = ucontrol->value.integer.value;
9811 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9813 valp ? 0 : HDA_AMP_MUTE);
9816 alc262_lenovo_3000_automute(codec, 0);
9820 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9821 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9824 .name = "Master Playback Switch",
9825 .info = snd_hda_mixer_amp_switch_info,
9826 .get = snd_hda_mixer_amp_switch_get,
9827 .put = alc262_lenovo_3000_master_sw_put,
9828 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9830 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9831 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9832 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9835 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9836 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9837 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9841 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9842 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9844 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9845 .name = "Master Playback Switch",
9846 .info = snd_hda_mixer_amp_switch_info,
9847 .get = snd_hda_mixer_amp_switch_get,
9848 .put = alc262_sony_master_sw_put,
9849 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9852 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9853 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9854 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9855 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9856 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9860 /* additional init verbs for Benq laptops */
9861 static struct hda_verb alc262_EAPD_verbs[] = {
9862 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9863 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9867 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9868 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9869 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9871 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9872 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9876 /* Samsung Q1 Ultra Vista model setup */
9877 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9878 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9879 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9882 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9883 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9887 static struct hda_verb alc262_ultra_verbs[] = {
9889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9890 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9891 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9893 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9894 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9895 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9896 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9898 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9899 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9901 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9902 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9904 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9906 /* ADC, choose mic */
9907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9908 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9909 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9910 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9911 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9912 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9913 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9914 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9915 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9916 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9920 /* mute/unmute internal speaker according to the hp jack and mute state */
9921 static void alc262_ultra_automute(struct hda_codec *codec)
9923 struct alc_spec *spec = codec->spec;
9927 /* auto-mute only when HP is used as HP */
9928 if (!spec->cur_mux[0]) {
9929 unsigned int present;
9930 /* need to execute and sync at first */
9931 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9932 present = snd_hda_codec_read(codec, 0x15, 0,
9933 AC_VERB_GET_PIN_SENSE, 0);
9934 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9935 if (spec->jack_present)
9936 mute = HDA_AMP_MUTE;
9938 /* mute/unmute internal speaker */
9939 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9940 HDA_AMP_MUTE, mute);
9941 /* mute/unmute HP */
9942 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9943 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9946 /* unsolicited event for HP jack sensing */
9947 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9950 if ((res >> 26) != ALC880_HP_EVENT)
9952 alc262_ultra_automute(codec);
9955 static struct hda_input_mux alc262_ultra_capture_source = {
9959 { "Headphone", 0x7 },
9963 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9964 struct snd_ctl_elem_value *ucontrol)
9966 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9967 struct alc_spec *spec = codec->spec;
9970 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9973 /* reprogram the HP pin as mic or HP according to the input source */
9974 snd_hda_codec_write_cache(codec, 0x15, 0,
9975 AC_VERB_SET_PIN_WIDGET_CONTROL,
9976 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9977 alc262_ultra_automute(codec); /* mute/unmute HP */
9981 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9982 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9983 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9985 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9986 .name = "Capture Source",
9987 .info = alc882_mux_enum_info,
9988 .get = alc882_mux_enum_get,
9989 .put = alc262_ultra_mux_enum_put,
9994 /* add playback controls from the parsed DAC table */
9995 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9996 const struct auto_pin_cfg *cfg)
10001 spec->multiout.num_dacs = 1; /* only use one dac */
10002 spec->multiout.dac_nids = spec->private_dac_nids;
10003 spec->multiout.dac_nids[0] = 2;
10005 nid = cfg->line_out_pins[0];
10007 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10008 "Front Playback Volume",
10009 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10012 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10013 "Front Playback Switch",
10014 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10019 nid = cfg->speaker_pins[0];
10022 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10023 "Speaker Playback Volume",
10024 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10028 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10029 "Speaker Playback Switch",
10030 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10035 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10036 "Speaker Playback Switch",
10037 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10043 nid = cfg->hp_pins[0];
10045 /* spec->multiout.hp_nid = 2; */
10047 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10048 "Headphone Playback Volume",
10049 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10053 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10054 "Headphone Playback Switch",
10055 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10060 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10061 "Headphone Playback Switch",
10062 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10071 /* identical with ALC880 */
10072 #define alc262_auto_create_analog_input_ctls \
10073 alc880_auto_create_analog_input_ctls
10076 * generic initialization of ADC, input mixers and output mixers
10078 static struct hda_verb alc262_volume_init_verbs[] = {
10080 * Unmute ADC0-2 and set the default input to mic-in
10082 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10084 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10085 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10086 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10087 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10089 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10091 * Note: PASD motherboards uses the Line In 2 as the input for
10092 * front panel mic (mic 2)
10094 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10102 * Set up output mixers (0x0c - 0x0f)
10104 /* set vol=0 to output mixers */
10105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10106 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10107 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10109 /* set up input amps for analog loopback */
10110 /* Amp Indices: DAC = 0, mixer = 1 */
10111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10112 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10113 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10114 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10115 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10116 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10118 /* FIXME: use matrix-type input source selection */
10119 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10120 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10121 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10123 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10124 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10127 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10128 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10129 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10139 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10141 * Unmute ADC0-2 and set the default input to mic-in
10143 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10144 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10145 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10146 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10147 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10150 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10152 * Note: PASD motherboards uses the Line In 2 as the input for
10153 * front panel mic (mic 2)
10155 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10159 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10160 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10161 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10162 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10165 * Set up output mixers (0x0c - 0x0e)
10167 /* set vol=0 to output mixers */
10168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10172 /* set up input amps for analog loopback */
10173 /* Amp Indices: DAC = 0, mixer = 1 */
10174 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10176 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10177 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10178 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10179 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10181 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10185 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10188 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10189 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10192 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10193 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10194 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10195 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10197 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10198 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10199 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10200 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10201 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10202 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10205 /* FIXME: use matrix-type input source selection */
10206 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10207 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10210 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10211 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10214 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10215 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10216 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10220 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10221 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10228 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10230 * Unmute ADC0-2 and set the default input to mic-in
10232 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10234 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10236 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10239 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10241 * Note: PASD motherboards uses the Line In 2 as the input for front
10242 * panel mic (mic 2)
10244 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10254 * Set up output mixers (0x0c - 0x0e)
10256 /* set vol=0 to output mixers */
10257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10261 /* set up input amps for analog loopback */
10262 /* Amp Indices: DAC = 0, mixer = 1 */
10263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10265 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10272 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10273 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10274 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10275 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10276 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10277 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10282 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10283 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10285 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10286 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10287 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10288 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10289 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10290 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10292 /* FIXME: use matrix-type input source selection */
10293 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10294 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10300 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10308 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10316 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10324 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10327 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10328 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10330 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10331 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10332 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10333 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10337 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10342 #ifdef CONFIG_SND_HDA_POWER_SAVE
10343 #define alc262_loopbacks alc880_loopbacks
10346 /* pcm configuration: identiacal with ALC880 */
10347 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10348 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10349 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10350 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10353 * BIOS auto configuration
10355 static int alc262_parse_auto_config(struct hda_codec *codec)
10357 struct alc_spec *spec = codec->spec;
10359 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10361 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10365 if (!spec->autocfg.line_outs)
10366 return 0; /* can't find valid BIOS pin config */
10367 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10370 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10374 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10376 if (spec->autocfg.dig_out_pin)
10377 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10378 if (spec->autocfg.dig_in_pin)
10379 spec->dig_in_nid = ALC262_DIGIN_NID;
10381 if (spec->kctl_alloc)
10382 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10384 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
10385 spec->num_mux_defs = 1;
10386 spec->input_mux = &spec->private_imux;
10388 err = alc_auto_add_mic_boost(codec);
10392 store_pin_configs(codec);
10396 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10397 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10398 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10399 #define alc262_auto_init_input_src alc882_auto_init_input_src
10402 /* init callback for auto-configuration model -- overriding the default init */
10403 static void alc262_auto_init(struct hda_codec *codec)
10405 struct alc_spec *spec = codec->spec;
10406 alc262_auto_init_multi_out(codec);
10407 alc262_auto_init_hp_out(codec);
10408 alc262_auto_init_analog_input(codec);
10409 alc262_auto_init_input_src(codec);
10410 if (spec->unsol_event)
10411 alc_inithook(codec);
10415 * configuration and preset
10417 static const char *alc262_models[ALC262_MODEL_LAST] = {
10418 [ALC262_BASIC] = "basic",
10419 [ALC262_HIPPO] = "hippo",
10420 [ALC262_HIPPO_1] = "hippo_1",
10421 [ALC262_FUJITSU] = "fujitsu",
10422 [ALC262_HP_BPC] = "hp-bpc",
10423 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10424 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10425 [ALC262_HP_RP5700] = "hp-rp5700",
10426 [ALC262_BENQ_ED8] = "benq",
10427 [ALC262_BENQ_T31] = "benq-t31",
10428 [ALC262_SONY_ASSAMD] = "sony-assamd",
10429 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10430 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10431 [ALC262_ULTRA] = "ultra",
10432 [ALC262_LENOVO_3000] = "lenovo-3000",
10433 [ALC262_NEC] = "nec",
10434 [ALC262_AUTO] = "auto",
10437 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10438 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10439 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10440 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10441 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10442 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10443 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10444 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10445 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10446 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10447 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10448 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10449 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10450 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10451 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10452 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10453 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10454 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10455 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10456 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10457 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10458 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10459 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10460 ALC262_HP_TC_T5735),
10461 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10462 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10463 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10464 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10465 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10466 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10467 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10468 ALC262_TOSHIBA_RX1),
10469 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10470 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10471 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10472 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10473 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10474 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10475 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10476 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10477 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10481 static struct alc_config_preset alc262_presets[] = {
10483 .mixers = { alc262_base_mixer },
10484 .init_verbs = { alc262_init_verbs },
10485 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10486 .dac_nids = alc262_dac_nids,
10488 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10489 .channel_mode = alc262_modes,
10490 .input_mux = &alc262_capture_source,
10493 .mixers = { alc262_base_mixer },
10494 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10495 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10496 .dac_nids = alc262_dac_nids,
10498 .dig_out_nid = ALC262_DIGOUT_NID,
10499 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10500 .channel_mode = alc262_modes,
10501 .input_mux = &alc262_capture_source,
10502 .unsol_event = alc262_hippo_unsol_event,
10503 .init_hook = alc262_hippo_automute,
10505 [ALC262_HIPPO_1] = {
10506 .mixers = { alc262_hippo1_mixer },
10507 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10508 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10509 .dac_nids = alc262_dac_nids,
10511 .dig_out_nid = ALC262_DIGOUT_NID,
10512 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10513 .channel_mode = alc262_modes,
10514 .input_mux = &alc262_capture_source,
10515 .unsol_event = alc262_hippo1_unsol_event,
10516 .init_hook = alc262_hippo1_automute,
10518 [ALC262_FUJITSU] = {
10519 .mixers = { alc262_fujitsu_mixer },
10520 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10521 alc262_fujitsu_unsol_verbs },
10522 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10523 .dac_nids = alc262_dac_nids,
10525 .dig_out_nid = ALC262_DIGOUT_NID,
10526 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10527 .channel_mode = alc262_modes,
10528 .input_mux = &alc262_fujitsu_capture_source,
10529 .unsol_event = alc262_fujitsu_unsol_event,
10530 .init_hook = alc262_fujitsu_init_hook,
10532 [ALC262_HP_BPC] = {
10533 .mixers = { alc262_HP_BPC_mixer },
10534 .init_verbs = { alc262_HP_BPC_init_verbs },
10535 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10536 .dac_nids = alc262_dac_nids,
10538 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10539 .channel_mode = alc262_modes,
10540 .input_mux = &alc262_HP_capture_source,
10541 .unsol_event = alc262_hp_bpc_unsol_event,
10542 .init_hook = alc262_hp_bpc_automute,
10544 [ALC262_HP_BPC_D7000_WF] = {
10545 .mixers = { alc262_HP_BPC_WildWest_mixer },
10546 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10547 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10548 .dac_nids = alc262_dac_nids,
10550 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10551 .channel_mode = alc262_modes,
10552 .input_mux = &alc262_HP_D7000_capture_source,
10553 .unsol_event = alc262_hp_wildwest_unsol_event,
10554 .init_hook = alc262_hp_wildwest_automute,
10556 [ALC262_HP_BPC_D7000_WL] = {
10557 .mixers = { alc262_HP_BPC_WildWest_mixer,
10558 alc262_HP_BPC_WildWest_option_mixer },
10559 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10560 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10561 .dac_nids = alc262_dac_nids,
10563 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10564 .channel_mode = alc262_modes,
10565 .input_mux = &alc262_HP_D7000_capture_source,
10566 .unsol_event = alc262_hp_wildwest_unsol_event,
10567 .init_hook = alc262_hp_wildwest_automute,
10569 [ALC262_HP_TC_T5735] = {
10570 .mixers = { alc262_hp_t5735_mixer },
10571 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10572 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10573 .dac_nids = alc262_dac_nids,
10575 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10576 .channel_mode = alc262_modes,
10577 .input_mux = &alc262_capture_source,
10578 .unsol_event = alc262_hp_t5735_unsol_event,
10579 .init_hook = alc262_hp_t5735_init_hook,
10581 [ALC262_HP_RP5700] = {
10582 .mixers = { alc262_hp_rp5700_mixer },
10583 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10584 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10585 .dac_nids = alc262_dac_nids,
10586 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10587 .channel_mode = alc262_modes,
10588 .input_mux = &alc262_hp_rp5700_capture_source,
10590 [ALC262_BENQ_ED8] = {
10591 .mixers = { alc262_base_mixer },
10592 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10593 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10594 .dac_nids = alc262_dac_nids,
10596 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10597 .channel_mode = alc262_modes,
10598 .input_mux = &alc262_capture_source,
10600 [ALC262_SONY_ASSAMD] = {
10601 .mixers = { alc262_sony_mixer },
10602 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10603 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10604 .dac_nids = alc262_dac_nids,
10606 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10607 .channel_mode = alc262_modes,
10608 .input_mux = &alc262_capture_source,
10609 .unsol_event = alc262_hippo_unsol_event,
10610 .init_hook = alc262_hippo_automute,
10612 [ALC262_BENQ_T31] = {
10613 .mixers = { alc262_benq_t31_mixer },
10614 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10615 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10616 .dac_nids = alc262_dac_nids,
10618 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10619 .channel_mode = alc262_modes,
10620 .input_mux = &alc262_capture_source,
10621 .unsol_event = alc262_hippo_unsol_event,
10622 .init_hook = alc262_hippo_automute,
10625 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
10626 .init_verbs = { alc262_ultra_verbs },
10627 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10628 .dac_nids = alc262_dac_nids,
10629 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10630 .channel_mode = alc262_modes,
10631 .input_mux = &alc262_ultra_capture_source,
10632 .adc_nids = alc262_adc_nids, /* ADC0 */
10633 .capsrc_nids = alc262_capsrc_nids,
10634 .num_adc_nids = 1, /* single ADC */
10635 .unsol_event = alc262_ultra_unsol_event,
10636 .init_hook = alc262_ultra_automute,
10638 [ALC262_LENOVO_3000] = {
10639 .mixers = { alc262_lenovo_3000_mixer },
10640 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10641 alc262_lenovo_3000_unsol_verbs },
10642 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10643 .dac_nids = alc262_dac_nids,
10645 .dig_out_nid = ALC262_DIGOUT_NID,
10646 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10647 .channel_mode = alc262_modes,
10648 .input_mux = &alc262_fujitsu_capture_source,
10649 .unsol_event = alc262_lenovo_3000_unsol_event,
10652 .mixers = { alc262_nec_mixer },
10653 .init_verbs = { alc262_nec_verbs },
10654 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10655 .dac_nids = alc262_dac_nids,
10657 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10658 .channel_mode = alc262_modes,
10659 .input_mux = &alc262_capture_source,
10661 [ALC262_TOSHIBA_S06] = {
10662 .mixers = { alc262_toshiba_s06_mixer },
10663 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10664 alc262_eapd_verbs },
10665 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10666 .capsrc_nids = alc262_dmic_capsrc_nids,
10667 .dac_nids = alc262_dac_nids,
10668 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10669 .dig_out_nid = ALC262_DIGOUT_NID,
10670 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10671 .channel_mode = alc262_modes,
10672 .input_mux = &alc262_dmic_capture_source,
10673 .unsol_event = alc262_toshiba_s06_unsol_event,
10674 .init_hook = alc262_toshiba_s06_init_hook,
10676 [ALC262_TOSHIBA_RX1] = {
10677 .mixers = { alc262_toshiba_rx1_mixer },
10678 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10679 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10680 .dac_nids = alc262_dac_nids,
10682 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10683 .channel_mode = alc262_modes,
10684 .input_mux = &alc262_capture_source,
10685 .unsol_event = alc262_hippo_unsol_event,
10686 .init_hook = alc262_hippo_automute,
10690 static int patch_alc262(struct hda_codec *codec)
10692 struct alc_spec *spec;
10696 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10700 codec->spec = spec;
10702 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10707 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10708 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10709 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10710 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10714 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10716 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10720 if (board_config < 0) {
10721 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10722 "trying auto-probe from BIOS...\n");
10723 board_config = ALC262_AUTO;
10726 if (board_config == ALC262_AUTO) {
10727 /* automatic parse from the BIOS config */
10728 err = alc262_parse_auto_config(codec);
10734 "hda_codec: Cannot set up configuration "
10735 "from BIOS. Using base mode...\n");
10736 board_config = ALC262_BASIC;
10740 if (board_config != ALC262_AUTO)
10741 setup_preset(spec, &alc262_presets[board_config]);
10743 spec->stream_name_analog = "ALC262 Analog";
10744 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10745 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10747 spec->stream_name_digital = "ALC262 Digital";
10748 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10749 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10751 if (!spec->adc_nids && spec->input_mux) {
10752 /* check whether NID 0x07 is valid */
10753 unsigned int wcap = get_wcaps(codec, 0x07);
10756 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10757 if (wcap != AC_WID_AUD_IN) {
10758 spec->adc_nids = alc262_adc_nids_alt;
10759 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10760 spec->capsrc_nids = alc262_capsrc_nids_alt;
10761 spec->mixers[spec->num_mixers] =
10762 alc262_capture_alt_mixer;
10763 spec->num_mixers++;
10765 spec->adc_nids = alc262_adc_nids;
10766 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10767 spec->capsrc_nids = alc262_capsrc_nids;
10768 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
10769 spec->num_mixers++;
10773 spec->vmaster_nid = 0x0c;
10775 codec->patch_ops = alc_patch_ops;
10776 if (board_config == ALC262_AUTO)
10777 spec->init_hook = alc262_auto_init;
10778 #ifdef CONFIG_SND_HDA_POWER_SAVE
10779 if (!spec->loopback.amplist)
10780 spec->loopback.amplist = alc262_loopbacks;
10787 * ALC268 channel source setting (2 channel)
10789 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10790 #define alc268_modes alc260_modes
10792 static hda_nid_t alc268_dac_nids[2] = {
10797 static hda_nid_t alc268_adc_nids[2] = {
10802 static hda_nid_t alc268_adc_nids_alt[1] = {
10807 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10809 static struct snd_kcontrol_new alc268_base_mixer[] = {
10810 /* output mixer control */
10811 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10812 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10813 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10814 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10815 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10816 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10817 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10821 /* bind Beep switches of both NID 0x0f and 0x10 */
10822 static struct hda_bind_ctls alc268_bind_beep_sw = {
10823 .ops = &snd_hda_bind_sw,
10825 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10826 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10831 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10832 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10833 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10837 static struct hda_verb alc268_eapd_verbs[] = {
10838 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10839 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10843 /* Toshiba specific */
10844 #define alc268_toshiba_automute alc262_hippo_automute
10846 static struct hda_verb alc268_toshiba_verbs[] = {
10847 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10851 static struct hda_input_mux alc268_acer_lc_capture_source = {
10859 /* Acer specific */
10860 /* bind volumes of both NID 0x02 and 0x03 */
10861 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10862 .ops = &snd_hda_bind_vol,
10864 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10865 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10870 /* mute/unmute internal speaker according to the hp jack and mute state */
10871 static void alc268_acer_automute(struct hda_codec *codec, int force)
10873 struct alc_spec *spec = codec->spec;
10876 if (force || !spec->sense_updated) {
10877 unsigned int present;
10878 present = snd_hda_codec_read(codec, 0x14, 0,
10879 AC_VERB_GET_PIN_SENSE, 0);
10880 spec->jack_present = (present & 0x80000000) != 0;
10881 spec->sense_updated = 1;
10883 if (spec->jack_present)
10884 mute = HDA_AMP_MUTE; /* mute internal speaker */
10885 else /* unmute internal speaker if necessary */
10886 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10887 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10888 HDA_AMP_MUTE, mute);
10892 /* bind hp and internal speaker mute (with plug check) */
10893 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10894 struct snd_ctl_elem_value *ucontrol)
10896 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10897 long *valp = ucontrol->value.integer.value;
10900 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10902 valp[0] ? 0 : HDA_AMP_MUTE);
10903 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10905 valp[1] ? 0 : HDA_AMP_MUTE);
10907 alc268_acer_automute(codec, 0);
10911 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10912 /* output mixer control */
10913 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10915 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10916 .name = "Master Playback Switch",
10917 .info = snd_hda_mixer_amp_switch_info,
10918 .get = snd_hda_mixer_amp_switch_get,
10919 .put = alc268_acer_master_sw_put,
10920 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10922 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10926 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10927 /* output mixer control */
10928 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10930 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10931 .name = "Master Playback Switch",
10932 .info = snd_hda_mixer_amp_switch_info,
10933 .get = snd_hda_mixer_amp_switch_get,
10934 .put = alc268_acer_master_sw_put,
10935 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10937 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10938 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10939 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10943 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10944 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10945 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10946 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10947 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10948 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10949 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10953 static struct hda_verb alc268_acer_verbs[] = {
10954 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10955 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10956 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10958 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10959 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10960 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10964 /* unsolicited event for HP jack sensing */
10965 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10968 if ((res >> 26) != ALC880_HP_EVENT)
10970 alc268_toshiba_automute(codec);
10973 static void alc268_acer_unsol_event(struct hda_codec *codec,
10976 if ((res >> 26) != ALC880_HP_EVENT)
10978 alc268_acer_automute(codec, 1);
10981 static void alc268_acer_init_hook(struct hda_codec *codec)
10983 alc268_acer_automute(codec, 1);
10986 /* toggle speaker-output according to the hp-jack state */
10987 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10989 unsigned int present;
10990 unsigned char bits;
10992 present = snd_hda_codec_read(codec, 0x15, 0,
10993 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10994 bits = present ? AMP_IN_MUTE(0) : 0;
10995 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10996 AMP_IN_MUTE(0), bits);
10997 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10998 AMP_IN_MUTE(0), bits);
11002 static void alc268_acer_mic_automute(struct hda_codec *codec)
11004 unsigned int present;
11006 present = snd_hda_codec_read(codec, 0x18, 0,
11007 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11008 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11009 present ? 0x0 : 0x6);
11012 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11015 if ((res >> 26) == ALC880_HP_EVENT)
11016 alc268_aspire_one_speaker_automute(codec);
11017 if ((res >> 26) == ALC880_MIC_EVENT)
11018 alc268_acer_mic_automute(codec);
11021 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11023 alc268_aspire_one_speaker_automute(codec);
11024 alc268_acer_mic_automute(codec);
11027 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11028 /* output mixer control */
11029 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11030 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11031 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11034 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11038 static struct hda_verb alc268_dell_verbs[] = {
11039 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11041 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11045 /* mute/unmute internal speaker according to the hp jack and mute state */
11046 static void alc268_dell_automute(struct hda_codec *codec)
11048 unsigned int present;
11051 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11052 if (present & 0x80000000)
11053 mute = HDA_AMP_MUTE;
11055 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11056 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11057 HDA_AMP_MUTE, mute);
11060 static void alc268_dell_unsol_event(struct hda_codec *codec,
11063 if ((res >> 26) != ALC880_HP_EVENT)
11065 alc268_dell_automute(codec);
11068 #define alc268_dell_init_hook alc268_dell_automute
11070 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11071 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11072 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11073 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11074 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11075 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11076 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11077 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11078 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11082 static struct hda_verb alc267_quanta_il1_verbs[] = {
11083 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11084 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11088 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11090 unsigned int present;
11092 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11093 & AC_PINSENSE_PRESENCE;
11094 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11095 present ? 0 : PIN_OUT);
11098 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11100 unsigned int present;
11102 present = snd_hda_codec_read(codec, 0x18, 0,
11103 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11104 snd_hda_codec_write(codec, 0x23, 0,
11105 AC_VERB_SET_CONNECT_SEL,
11106 present ? 0x00 : 0x01);
11109 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11111 alc267_quanta_il1_hp_automute(codec);
11112 alc267_quanta_il1_mic_automute(codec);
11115 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11118 switch (res >> 26) {
11119 case ALC880_HP_EVENT:
11120 alc267_quanta_il1_hp_automute(codec);
11122 case ALC880_MIC_EVENT:
11123 alc267_quanta_il1_mic_automute(codec);
11129 * generic initialization of ADC, input mixers and output mixers
11131 static struct hda_verb alc268_base_init_verbs[] = {
11132 /* Unmute DAC0-1 and set vol = 0 */
11133 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11134 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11135 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11136 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11137 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11138 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11141 * Set up output mixers (0x0c - 0x0e)
11143 /* set vol=0 to output mixers */
11144 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11147 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11149 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11150 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11152 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11153 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11154 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11155 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11156 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11157 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11158 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11159 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11161 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11162 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11163 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11164 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11165 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11166 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11167 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11169 /* set PCBEEP vol = 0, mute connections */
11170 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11171 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11172 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11174 /* Unmute Selector 23h,24h and set the default input to mic-in */
11176 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11177 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11178 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11179 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11185 * generic initialization of ADC, input mixers and output mixers
11187 static struct hda_verb alc268_volume_init_verbs[] = {
11188 /* set output DAC */
11189 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11190 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11191 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11192 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11194 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11195 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11196 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11197 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11198 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11200 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11201 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11202 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11203 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11204 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11207 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11208 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11209 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11211 /* set PCBEEP vol = 0, mute connections */
11212 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11213 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11214 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11219 #define alc268_mux_enum_info alc_mux_enum_info
11220 #define alc268_mux_enum_get alc_mux_enum_get
11221 #define alc268_mux_enum_put alc_mux_enum_put
11223 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11224 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11225 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11228 /* The multiple "Capture Source" controls confuse alsamixer
11229 * So call somewhat different..
11231 /* .name = "Capture Source", */
11232 .name = "Input Source",
11234 .info = alc268_mux_enum_info,
11235 .get = alc268_mux_enum_get,
11236 .put = alc268_mux_enum_put,
11241 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11242 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11243 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11244 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11245 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11248 /* The multiple "Capture Source" controls confuse alsamixer
11249 * So call somewhat different..
11251 /* .name = "Capture Source", */
11252 .name = "Input Source",
11254 .info = alc268_mux_enum_info,
11255 .get = alc268_mux_enum_get,
11256 .put = alc268_mux_enum_put,
11261 static struct hda_input_mux alc268_capture_source = {
11265 { "Front Mic", 0x1 },
11271 static struct hda_input_mux alc268_acer_capture_source = {
11275 { "Internal Mic", 0x6 },
11280 #ifdef CONFIG_SND_DEBUG
11281 static struct snd_kcontrol_new alc268_test_mixer[] = {
11282 /* Volume widgets */
11283 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11284 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11285 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11286 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11287 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11288 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11289 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11290 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11291 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11292 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11293 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11294 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11295 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11296 /* The below appears problematic on some hardwares */
11297 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11298 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11299 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11300 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11301 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11303 /* Modes for retasking pin widgets */
11304 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11305 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11306 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11307 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11309 /* Controls for GPIO pins, assuming they are configured as outputs */
11310 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11311 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11312 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11313 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11315 /* Switches to allow the digital SPDIF output pin to be enabled.
11316 * The ALC268 does not have an SPDIF input.
11318 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11320 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11321 * this output to turn on an external amplifier.
11323 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11324 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11330 /* create input playback/capture controls for the given pin */
11331 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11332 const char *ctlname, int idx)
11337 sprintf(name, "%s Playback Volume", ctlname);
11339 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11340 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11344 } else if (nid == 0x15) {
11345 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11346 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11352 sprintf(name, "%s Playback Switch", ctlname);
11353 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11354 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11360 /* add playback controls from the parsed DAC table */
11361 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11362 const struct auto_pin_cfg *cfg)
11367 spec->multiout.num_dacs = 2; /* only use one dac */
11368 spec->multiout.dac_nids = spec->private_dac_nids;
11369 spec->multiout.dac_nids[0] = 2;
11370 spec->multiout.dac_nids[1] = 3;
11372 nid = cfg->line_out_pins[0];
11374 alc268_new_analog_output(spec, nid, "Front", 0);
11376 nid = cfg->speaker_pins[0];
11378 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11379 "Speaker Playback Volume",
11380 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11384 nid = cfg->hp_pins[0];
11386 alc268_new_analog_output(spec, nid, "Headphone", 0);
11388 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11390 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11391 "Mono Playback Switch",
11392 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11399 /* create playback/capture controls for input pins */
11400 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11401 const struct auto_pin_cfg *cfg)
11403 struct hda_input_mux *imux = &spec->private_imux;
11406 for (i = 0; i < AUTO_PIN_LAST; i++) {
11407 switch(cfg->input_pins[i]) {
11409 idx1 = 0; /* Mic 1 */
11412 idx1 = 1; /* Mic 2 */
11415 idx1 = 2; /* Line In */
11422 idx1 = 6; /* digital mics */
11427 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11428 imux->items[imux->num_items].index = idx1;
11434 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11436 struct alc_spec *spec = codec->spec;
11437 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11438 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11439 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11440 unsigned int dac_vol1, dac_vol2;
11443 snd_hda_codec_write(codec, speaker_nid, 0,
11444 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11445 snd_hda_codec_write(codec, 0x0f, 0,
11446 AC_VERB_SET_AMP_GAIN_MUTE,
11448 snd_hda_codec_write(codec, 0x10, 0,
11449 AC_VERB_SET_AMP_GAIN_MUTE,
11452 snd_hda_codec_write(codec, 0x0f, 0,
11453 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11454 snd_hda_codec_write(codec, 0x10, 0,
11455 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11458 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11459 if (line_nid == 0x14)
11460 dac_vol2 = AMP_OUT_ZERO;
11461 else if (line_nid == 0x15)
11462 dac_vol1 = AMP_OUT_ZERO;
11463 if (hp_nid == 0x14)
11464 dac_vol2 = AMP_OUT_ZERO;
11465 else if (hp_nid == 0x15)
11466 dac_vol1 = AMP_OUT_ZERO;
11467 if (line_nid != 0x16 || hp_nid != 0x16 ||
11468 spec->autocfg.line_out_pins[1] != 0x16 ||
11469 spec->autocfg.line_out_pins[2] != 0x16)
11470 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11472 snd_hda_codec_write(codec, 0x02, 0,
11473 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11474 snd_hda_codec_write(codec, 0x03, 0,
11475 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11478 /* pcm configuration: identiacal with ALC880 */
11479 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11480 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11481 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11482 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11485 * BIOS auto configuration
11487 static int alc268_parse_auto_config(struct hda_codec *codec)
11489 struct alc_spec *spec = codec->spec;
11491 static hda_nid_t alc268_ignore[] = { 0 };
11493 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11497 if (!spec->autocfg.line_outs)
11498 return 0; /* can't find valid BIOS pin config */
11500 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11503 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11507 spec->multiout.max_channels = 2;
11509 /* digital only support output */
11510 if (spec->autocfg.dig_out_pin)
11511 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11513 if (spec->kctl_alloc)
11514 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11516 if (spec->autocfg.speaker_pins[0] != 0x1d)
11517 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
11519 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
11520 spec->num_mux_defs = 1;
11521 spec->input_mux = &spec->private_imux;
11523 err = alc_auto_add_mic_boost(codec);
11527 store_pin_configs(codec);
11531 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11532 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11533 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11535 /* init callback for auto-configuration model -- overriding the default init */
11536 static void alc268_auto_init(struct hda_codec *codec)
11538 struct alc_spec *spec = codec->spec;
11539 alc268_auto_init_multi_out(codec);
11540 alc268_auto_init_hp_out(codec);
11541 alc268_auto_init_mono_speaker_out(codec);
11542 alc268_auto_init_analog_input(codec);
11543 if (spec->unsol_event)
11544 alc_inithook(codec);
11548 * configuration and preset
11550 static const char *alc268_models[ALC268_MODEL_LAST] = {
11551 [ALC267_QUANTA_IL1] = "quanta-il1",
11552 [ALC268_3ST] = "3stack",
11553 [ALC268_TOSHIBA] = "toshiba",
11554 [ALC268_ACER] = "acer",
11555 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11556 [ALC268_DELL] = "dell",
11557 [ALC268_ZEPTO] = "zepto",
11558 #ifdef CONFIG_SND_DEBUG
11559 [ALC268_TEST] = "test",
11561 [ALC268_AUTO] = "auto",
11564 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11565 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11566 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11567 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11568 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11569 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11570 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11571 ALC268_ACER_ASPIRE_ONE),
11572 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11573 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11574 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11575 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11576 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11577 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11578 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11579 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11580 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11581 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11585 static struct alc_config_preset alc268_presets[] = {
11586 [ALC267_QUANTA_IL1] = {
11587 .mixers = { alc267_quanta_il1_mixer },
11588 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11589 alc267_quanta_il1_verbs },
11590 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11591 .dac_nids = alc268_dac_nids,
11592 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11593 .adc_nids = alc268_adc_nids_alt,
11595 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11596 .channel_mode = alc268_modes,
11597 .input_mux = &alc268_capture_source,
11598 .unsol_event = alc267_quanta_il1_unsol_event,
11599 .init_hook = alc267_quanta_il1_automute,
11602 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11603 alc268_beep_mixer },
11604 .init_verbs = { alc268_base_init_verbs },
11605 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11606 .dac_nids = alc268_dac_nids,
11607 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11608 .adc_nids = alc268_adc_nids_alt,
11609 .capsrc_nids = alc268_capsrc_nids,
11611 .dig_out_nid = ALC268_DIGOUT_NID,
11612 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11613 .channel_mode = alc268_modes,
11614 .input_mux = &alc268_capture_source,
11616 [ALC268_TOSHIBA] = {
11617 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11618 alc268_beep_mixer },
11619 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11620 alc268_toshiba_verbs },
11621 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11622 .dac_nids = alc268_dac_nids,
11623 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11624 .adc_nids = alc268_adc_nids_alt,
11625 .capsrc_nids = alc268_capsrc_nids,
11627 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11628 .channel_mode = alc268_modes,
11629 .input_mux = &alc268_capture_source,
11630 .unsol_event = alc268_toshiba_unsol_event,
11631 .init_hook = alc268_toshiba_automute,
11634 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11635 alc268_beep_mixer },
11636 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11637 alc268_acer_verbs },
11638 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11639 .dac_nids = alc268_dac_nids,
11640 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11641 .adc_nids = alc268_adc_nids_alt,
11642 .capsrc_nids = alc268_capsrc_nids,
11644 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11645 .channel_mode = alc268_modes,
11646 .input_mux = &alc268_acer_capture_source,
11647 .unsol_event = alc268_acer_unsol_event,
11648 .init_hook = alc268_acer_init_hook,
11650 [ALC268_ACER_ASPIRE_ONE] = {
11651 .mixers = { alc268_acer_aspire_one_mixer,
11652 alc268_capture_alt_mixer },
11653 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11654 alc268_acer_aspire_one_verbs },
11655 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11656 .dac_nids = alc268_dac_nids,
11657 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11658 .adc_nids = alc268_adc_nids_alt,
11659 .capsrc_nids = alc268_capsrc_nids,
11661 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11662 .channel_mode = alc268_modes,
11663 .input_mux = &alc268_acer_lc_capture_source,
11664 .unsol_event = alc268_acer_lc_unsol_event,
11665 .init_hook = alc268_acer_lc_init_hook,
11668 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11669 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11670 alc268_dell_verbs },
11671 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11672 .dac_nids = alc268_dac_nids,
11674 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11675 .channel_mode = alc268_modes,
11676 .unsol_event = alc268_dell_unsol_event,
11677 .init_hook = alc268_dell_init_hook,
11678 .input_mux = &alc268_capture_source,
11681 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11682 alc268_beep_mixer },
11683 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11684 alc268_toshiba_verbs },
11685 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11686 .dac_nids = alc268_dac_nids,
11687 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11688 .adc_nids = alc268_adc_nids_alt,
11689 .capsrc_nids = alc268_capsrc_nids,
11691 .dig_out_nid = ALC268_DIGOUT_NID,
11692 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11693 .channel_mode = alc268_modes,
11694 .input_mux = &alc268_capture_source,
11695 .unsol_event = alc268_toshiba_unsol_event,
11696 .init_hook = alc268_toshiba_automute
11698 #ifdef CONFIG_SND_DEBUG
11700 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11701 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11702 alc268_volume_init_verbs },
11703 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11704 .dac_nids = alc268_dac_nids,
11705 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11706 .adc_nids = alc268_adc_nids_alt,
11707 .capsrc_nids = alc268_capsrc_nids,
11709 .dig_out_nid = ALC268_DIGOUT_NID,
11710 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11711 .channel_mode = alc268_modes,
11712 .input_mux = &alc268_capture_source,
11717 static int patch_alc268(struct hda_codec *codec)
11719 struct alc_spec *spec;
11723 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11727 codec->spec = spec;
11729 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11733 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11734 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11735 "trying auto-probe from BIOS...\n");
11736 board_config = ALC268_AUTO;
11739 if (board_config == ALC268_AUTO) {
11740 /* automatic parse from the BIOS config */
11741 err = alc268_parse_auto_config(codec);
11747 "hda_codec: Cannot set up configuration "
11748 "from BIOS. Using base mode...\n");
11749 board_config = ALC268_3ST;
11753 if (board_config != ALC268_AUTO)
11754 setup_preset(spec, &alc268_presets[board_config]);
11756 if (codec->vendor_id == 0x10ec0267) {
11757 spec->stream_name_analog = "ALC267 Analog";
11758 spec->stream_name_digital = "ALC267 Digital";
11760 spec->stream_name_analog = "ALC268 Analog";
11761 spec->stream_name_digital = "ALC268 Digital";
11764 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11765 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11766 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11768 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11770 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11771 /* override the amp caps for beep generator */
11772 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11773 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11774 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11775 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11776 (0 << AC_AMPCAP_MUTE_SHIFT));
11778 if (!spec->adc_nids && spec->input_mux) {
11779 /* check whether NID 0x07 is valid */
11780 unsigned int wcap = get_wcaps(codec, 0x07);
11784 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11785 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11786 spec->adc_nids = alc268_adc_nids_alt;
11787 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11788 spec->mixers[spec->num_mixers] =
11789 alc268_capture_alt_mixer;
11790 spec->num_mixers++;
11792 spec->adc_nids = alc268_adc_nids;
11793 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11794 spec->mixers[spec->num_mixers] =
11795 alc268_capture_mixer;
11796 spec->num_mixers++;
11798 spec->capsrc_nids = alc268_capsrc_nids;
11799 /* set default input source */
11800 for (i = 0; i < spec->num_adc_nids; i++)
11801 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11802 0, AC_VERB_SET_CONNECT_SEL,
11803 spec->input_mux->items[0].index);
11806 spec->vmaster_nid = 0x02;
11808 codec->patch_ops = alc_patch_ops;
11809 if (board_config == ALC268_AUTO)
11810 spec->init_hook = alc268_auto_init;
11816 * ALC269 channel source setting (2 channel)
11818 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11820 #define alc269_dac_nids alc260_dac_nids
11822 static hda_nid_t alc269_adc_nids[1] = {
11827 static hda_nid_t alc269_capsrc_nids[1] = {
11831 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11835 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11843 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11851 #define alc269_modes alc260_modes
11852 #define alc269_capture_source alc880_lg_lw_capture_source
11854 static struct snd_kcontrol_new alc269_base_mixer[] = {
11855 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11856 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11861 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11862 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11863 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11864 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11865 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11866 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11867 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11868 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11872 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11873 /* output mixer control */
11874 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11876 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11877 .name = "Master Playback Switch",
11878 .info = snd_hda_mixer_amp_switch_info,
11879 .get = snd_hda_mixer_amp_switch_get,
11880 .put = alc268_acer_master_sw_put,
11881 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11884 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11885 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11886 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11887 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11888 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11889 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11890 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11894 /* bind volumes of both NID 0x0c and 0x0d */
11895 static struct hda_bind_ctls alc269_epc_bind_vol = {
11896 .ops = &snd_hda_bind_vol,
11898 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11899 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11904 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11905 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11906 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11907 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11911 /* capture mixer elements */
11912 static struct snd_kcontrol_new alc269_capture_mixer[] = {
11913 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11914 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11916 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11917 /* The multiple "Capture Source" controls confuse alsamixer
11918 * So call somewhat different..
11920 /* .name = "Capture Source", */
11921 .name = "Input Source",
11923 .info = alc_mux_enum_info,
11924 .get = alc_mux_enum_get,
11925 .put = alc_mux_enum_put,
11930 /* capture mixer elements */
11931 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11932 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11933 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11938 static struct snd_kcontrol_new alc269_beep_mixer[] = {
11939 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11940 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11944 static struct hda_verb alc269_quanta_fl1_verbs[] = {
11945 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11946 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11947 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11948 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11949 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11950 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11954 /* toggle speaker-output according to the hp-jack state */
11955 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11957 unsigned int present;
11958 unsigned char bits;
11960 present = snd_hda_codec_read(codec, 0x15, 0,
11961 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11962 bits = present ? AMP_IN_MUTE(0) : 0;
11963 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11964 AMP_IN_MUTE(0), bits);
11965 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11966 AMP_IN_MUTE(0), bits);
11968 snd_hda_codec_write(codec, 0x20, 0,
11969 AC_VERB_SET_COEF_INDEX, 0x0c);
11970 snd_hda_codec_write(codec, 0x20, 0,
11971 AC_VERB_SET_PROC_COEF, 0x680);
11973 snd_hda_codec_write(codec, 0x20, 0,
11974 AC_VERB_SET_COEF_INDEX, 0x0c);
11975 snd_hda_codec_write(codec, 0x20, 0,
11976 AC_VERB_SET_PROC_COEF, 0x480);
11979 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11981 unsigned int present;
11983 present = snd_hda_codec_read(codec, 0x18, 0,
11984 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11985 snd_hda_codec_write(codec, 0x23, 0,
11986 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11989 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11992 if ((res >> 26) == ALC880_HP_EVENT)
11993 alc269_quanta_fl1_speaker_automute(codec);
11994 if ((res >> 26) == ALC880_MIC_EVENT)
11995 alc269_quanta_fl1_mic_automute(codec);
11998 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12000 alc269_quanta_fl1_speaker_automute(codec);
12001 alc269_quanta_fl1_mic_automute(codec);
12004 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12006 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12007 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12009 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12010 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12011 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12015 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12016 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12017 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12018 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12019 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12020 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12021 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12025 /* toggle speaker-output according to the hp-jack state */
12026 static void alc269_speaker_automute(struct hda_codec *codec)
12028 unsigned int present;
12029 unsigned char bits;
12031 present = snd_hda_codec_read(codec, 0x15, 0,
12032 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12033 bits = present ? AMP_IN_MUTE(0) : 0;
12034 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12035 AMP_IN_MUTE(0), bits);
12036 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12037 AMP_IN_MUTE(0), bits);
12040 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12042 unsigned int present;
12044 present = snd_hda_codec_read(codec, 0x18, 0,
12045 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12046 snd_hda_codec_write(codec, 0x23, 0,
12047 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12050 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12052 unsigned int present;
12054 present = snd_hda_codec_read(codec, 0x18, 0,
12055 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12056 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12057 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12058 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12059 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12062 /* unsolicited event for HP jack sensing */
12063 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12066 if ((res >> 26) == ALC880_HP_EVENT)
12067 alc269_speaker_automute(codec);
12069 if ((res >> 26) == ALC880_MIC_EVENT)
12070 alc269_eeepc_dmic_automute(codec);
12073 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12075 alc269_speaker_automute(codec);
12076 alc269_eeepc_dmic_automute(codec);
12079 /* unsolicited event for HP jack sensing */
12080 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12083 if ((res >> 26) == ALC880_HP_EVENT)
12084 alc269_speaker_automute(codec);
12086 if ((res >> 26) == ALC880_MIC_EVENT)
12087 alc269_eeepc_amic_automute(codec);
12090 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12092 alc269_speaker_automute(codec);
12093 alc269_eeepc_amic_automute(codec);
12097 * generic initialization of ADC, input mixers and output mixers
12099 static struct hda_verb alc269_init_verbs[] = {
12101 * Unmute ADC0 and set the default input to mic-in
12103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12105 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12106 * analog-loopback mixer widget
12107 * Note: PASD motherboards uses the Line In 2 as the input for
12108 * front panel mic (mic 2)
12110 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12118 * Set up output mixers (0x0c - 0x0e)
12120 /* set vol=0 to output mixers */
12121 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12122 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12124 /* set up input amps for analog loopback */
12125 /* Amp Indices: DAC = 0, mixer = 1 */
12126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12128 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12129 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12130 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12131 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12133 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12134 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12135 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12136 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12137 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12138 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12139 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12141 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12143 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12144 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12145 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12146 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12147 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12149 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12150 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12152 /* FIXME: use matrix-type input source selection */
12153 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12154 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12155 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12156 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12161 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12162 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12166 /* add playback controls from the parsed DAC table */
12167 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12168 const struct auto_pin_cfg *cfg)
12173 spec->multiout.num_dacs = 1; /* only use one dac */
12174 spec->multiout.dac_nids = spec->private_dac_nids;
12175 spec->multiout.dac_nids[0] = 2;
12177 nid = cfg->line_out_pins[0];
12179 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12180 "Front Playback Volume",
12181 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12184 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12185 "Front Playback Switch",
12186 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12191 nid = cfg->speaker_pins[0];
12193 if (!cfg->line_out_pins[0]) {
12194 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12195 "Speaker Playback Volume",
12196 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12202 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12203 "Speaker Playback Switch",
12204 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12209 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12210 "Speaker Playback Switch",
12211 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12217 nid = cfg->hp_pins[0];
12219 /* spec->multiout.hp_nid = 2; */
12220 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12221 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12222 "Headphone Playback Volume",
12223 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12229 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12230 "Headphone Playback Switch",
12231 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12236 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12237 "Headphone Playback Switch",
12238 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12247 #define alc269_auto_create_analog_input_ctls \
12248 alc880_auto_create_analog_input_ctls
12250 #ifdef CONFIG_SND_HDA_POWER_SAVE
12251 #define alc269_loopbacks alc880_loopbacks
12254 /* pcm configuration: identiacal with ALC880 */
12255 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12256 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12257 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12258 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12261 * BIOS auto configuration
12263 static int alc269_parse_auto_config(struct hda_codec *codec)
12265 struct alc_spec *spec = codec->spec;
12267 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12269 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12274 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12277 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12281 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12283 if (spec->autocfg.dig_out_pin)
12284 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12286 if (spec->kctl_alloc)
12287 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12289 /* create a beep mixer control if the pin 0x1d isn't assigned */
12290 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12291 if (spec->autocfg.input_pins[i] == 0x1d)
12293 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12294 spec->mixers[spec->num_mixers++] = alc269_beep_mixer;
12296 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
12297 spec->num_mux_defs = 1;
12298 spec->input_mux = &spec->private_imux;
12299 /* set default input source */
12300 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12301 0, AC_VERB_SET_CONNECT_SEL,
12302 spec->input_mux->items[0].index);
12304 err = alc_auto_add_mic_boost(codec);
12308 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
12309 spec->num_mixers++;
12311 store_pin_configs(codec);
12315 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12316 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12317 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12320 /* init callback for auto-configuration model -- overriding the default init */
12321 static void alc269_auto_init(struct hda_codec *codec)
12323 struct alc_spec *spec = codec->spec;
12324 alc269_auto_init_multi_out(codec);
12325 alc269_auto_init_hp_out(codec);
12326 alc269_auto_init_analog_input(codec);
12327 if (spec->unsol_event)
12328 alc_inithook(codec);
12332 * configuration and preset
12334 static const char *alc269_models[ALC269_MODEL_LAST] = {
12335 [ALC269_BASIC] = "basic",
12336 [ALC269_QUANTA_FL1] = "quanta",
12337 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12338 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901"
12341 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12342 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12343 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12344 ALC269_ASUS_EEEPC_P703),
12345 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12346 ALC269_ASUS_EEEPC_P901),
12347 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12348 ALC269_ASUS_EEEPC_P901),
12352 static struct alc_config_preset alc269_presets[] = {
12354 .mixers = { alc269_base_mixer, alc269_capture_mixer },
12355 .init_verbs = { alc269_init_verbs },
12356 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12357 .dac_nids = alc269_dac_nids,
12359 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12360 .channel_mode = alc269_modes,
12361 .input_mux = &alc269_capture_source,
12363 [ALC269_QUANTA_FL1] = {
12364 .mixers = { alc269_quanta_fl1_mixer },
12365 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12366 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12367 .dac_nids = alc269_dac_nids,
12369 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12370 .channel_mode = alc269_modes,
12371 .input_mux = &alc269_capture_source,
12372 .unsol_event = alc269_quanta_fl1_unsol_event,
12373 .init_hook = alc269_quanta_fl1_init_hook,
12375 [ALC269_ASUS_EEEPC_P703] = {
12376 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer },
12377 .init_verbs = { alc269_init_verbs,
12378 alc269_eeepc_amic_init_verbs },
12379 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12380 .dac_nids = alc269_dac_nids,
12382 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12383 .channel_mode = alc269_modes,
12384 .input_mux = &alc269_eeepc_amic_capture_source,
12385 .unsol_event = alc269_eeepc_amic_unsol_event,
12386 .init_hook = alc269_eeepc_amic_inithook,
12388 [ALC269_ASUS_EEEPC_P901] = {
12389 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer},
12390 .init_verbs = { alc269_init_verbs,
12391 alc269_eeepc_dmic_init_verbs },
12392 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12393 .dac_nids = alc269_dac_nids,
12395 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12396 .channel_mode = alc269_modes,
12397 .input_mux = &alc269_eeepc_dmic_capture_source,
12398 .unsol_event = alc269_eeepc_dmic_unsol_event,
12399 .init_hook = alc269_eeepc_dmic_inithook,
12403 static int patch_alc269(struct hda_codec *codec)
12405 struct alc_spec *spec;
12409 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12413 codec->spec = spec;
12415 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12417 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12421 if (board_config < 0) {
12422 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12423 "trying auto-probe from BIOS...\n");
12424 board_config = ALC269_AUTO;
12427 if (board_config == ALC269_AUTO) {
12428 /* automatic parse from the BIOS config */
12429 err = alc269_parse_auto_config(codec);
12435 "hda_codec: Cannot set up configuration "
12436 "from BIOS. Using base mode...\n");
12437 board_config = ALC269_BASIC;
12441 if (board_config != ALC269_AUTO)
12442 setup_preset(spec, &alc269_presets[board_config]);
12444 spec->stream_name_analog = "ALC269 Analog";
12445 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12446 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12448 spec->stream_name_digital = "ALC269 Digital";
12449 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12450 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12452 spec->adc_nids = alc269_adc_nids;
12453 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12454 spec->capsrc_nids = alc269_capsrc_nids;
12456 codec->patch_ops = alc_patch_ops;
12457 if (board_config == ALC269_AUTO)
12458 spec->init_hook = alc269_auto_init;
12459 #ifdef CONFIG_SND_HDA_POWER_SAVE
12460 if (!spec->loopback.amplist)
12461 spec->loopback.amplist = alc269_loopbacks;
12468 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12472 * set the path ways for 2 channel output
12473 * need to set the codec line out and mic 1 pin widgets to inputs
12475 static struct hda_verb alc861_threestack_ch2_init[] = {
12476 /* set pin widget 1Ah (line in) for input */
12477 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12478 /* set pin widget 18h (mic1/2) for input, for mic also enable
12481 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12483 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12485 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12486 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12492 * need to set the codec line out and mic 1 pin widgets to outputs
12494 static struct hda_verb alc861_threestack_ch6_init[] = {
12495 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12496 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12497 /* set pin widget 18h (mic1) for output (CLFE)*/
12498 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12500 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12501 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12503 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12505 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12506 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12511 static struct hda_channel_mode alc861_threestack_modes[2] = {
12512 { 2, alc861_threestack_ch2_init },
12513 { 6, alc861_threestack_ch6_init },
12515 /* Set mic1 as input and unmute the mixer */
12516 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12517 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12518 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12521 /* Set mic1 as output and mute mixer */
12522 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12523 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12524 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12528 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12529 { 2, alc861_uniwill_m31_ch2_init },
12530 { 4, alc861_uniwill_m31_ch4_init },
12533 /* Set mic1 and line-in as input and unmute the mixer */
12534 static struct hda_verb alc861_asus_ch2_init[] = {
12535 /* set pin widget 1Ah (line in) for input */
12536 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12537 /* set pin widget 18h (mic1/2) for input, for mic also enable
12540 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12542 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12544 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12545 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12549 /* Set mic1 nad line-in as output and mute mixer */
12550 static struct hda_verb alc861_asus_ch6_init[] = {
12551 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12552 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12553 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12554 /* set pin widget 18h (mic1) for output (CLFE)*/
12555 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12556 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12557 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12558 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12560 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12562 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12563 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12568 static struct hda_channel_mode alc861_asus_modes[2] = {
12569 { 2, alc861_asus_ch2_init },
12570 { 6, alc861_asus_ch6_init },
12575 static struct snd_kcontrol_new alc861_base_mixer[] = {
12576 /* output mixer control */
12577 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12578 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12579 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12580 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12581 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12583 /*Input mixer control */
12584 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12585 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12586 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12587 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12588 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12589 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12590 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12591 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12592 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12593 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12595 /* Capture mixer control */
12596 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12597 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12599 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12600 .name = "Capture Source",
12602 .info = alc_mux_enum_info,
12603 .get = alc_mux_enum_get,
12604 .put = alc_mux_enum_put,
12609 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12610 /* output mixer control */
12611 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12612 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12613 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12614 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12615 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12617 /* Input mixer control */
12618 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12619 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12620 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12621 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12622 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12623 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12625 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12626 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12627 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12629 /* Capture mixer control */
12630 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12631 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12633 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12634 .name = "Capture Source",
12636 .info = alc_mux_enum_info,
12637 .get = alc_mux_enum_get,
12638 .put = alc_mux_enum_put,
12641 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12642 .name = "Channel Mode",
12643 .info = alc_ch_mode_info,
12644 .get = alc_ch_mode_get,
12645 .put = alc_ch_mode_put,
12646 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12651 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12652 /* output mixer control */
12653 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12654 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12655 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12657 /*Capture mixer control */
12658 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12659 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12661 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12662 .name = "Capture Source",
12664 .info = alc_mux_enum_info,
12665 .get = alc_mux_enum_get,
12666 .put = alc_mux_enum_put,
12672 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12673 /* output mixer control */
12674 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12675 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12676 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12677 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12678 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12680 /* Input mixer control */
12681 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12682 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12683 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12684 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12685 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12686 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12688 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12689 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12692 /* Capture mixer control */
12693 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12694 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12696 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12697 .name = "Capture Source",
12699 .info = alc_mux_enum_info,
12700 .get = alc_mux_enum_get,
12701 .put = alc_mux_enum_put,
12704 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12705 .name = "Channel Mode",
12706 .info = alc_ch_mode_info,
12707 .get = alc_ch_mode_get,
12708 .put = alc_ch_mode_put,
12709 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12714 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12715 /* output mixer control */
12716 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12717 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12718 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12719 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12720 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12722 /* Input mixer control */
12723 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12724 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12725 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12726 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12727 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12728 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12730 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12731 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12734 /* Capture mixer control */
12735 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12736 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12738 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12739 .name = "Capture Source",
12741 .info = alc_mux_enum_info,
12742 .get = alc_mux_enum_get,
12743 .put = alc_mux_enum_put,
12746 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12747 .name = "Channel Mode",
12748 .info = alc_ch_mode_info,
12749 .get = alc_ch_mode_get,
12750 .put = alc_ch_mode_put,
12751 .private_value = ARRAY_SIZE(alc861_asus_modes),
12756 /* additional mixer */
12757 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12758 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12759 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12760 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12761 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12766 * generic initialization of ADC, input mixers and output mixers
12768 static struct hda_verb alc861_base_init_verbs[] = {
12770 * Unmute ADC0 and set the default input to mic-in
12772 /* port-A for surround (rear panel) */
12773 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12774 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
12775 /* port-B for mic-in (rear panel) with vref */
12776 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12777 /* port-C for line-in (rear panel) */
12778 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12779 /* port-D for Front */
12780 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12781 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12782 /* port-E for HP out (front panel) */
12783 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12784 /* route front PCM to HP */
12785 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12786 /* port-F for mic-in (front panel) with vref */
12787 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12788 /* port-G for CLFE (rear panel) */
12789 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12790 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12791 /* port-H for side (rear panel) */
12792 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12793 { 0x20, AC_VERB_SET_CONNECT_SEL, 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)},
12800 /* Unmute DAC0~3 & spdif out*/
12801 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12802 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12803 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12804 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12805 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12807 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12808 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12809 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12810 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12811 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12813 /* Unmute Stereo Mixer 15 */
12814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12815 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12819 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12822 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12824 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12827 /* hp used DAC 3 (Front) */
12828 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12834 static struct hda_verb alc861_threestack_init_verbs[] = {
12836 * Unmute ADC0 and set the default input to mic-in
12838 /* port-A for surround (rear panel) */
12839 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12840 /* port-B for mic-in (rear panel) with vref */
12841 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12842 /* port-C for line-in (rear panel) */
12843 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12844 /* port-D for Front */
12845 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12846 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12847 /* port-E for HP out (front panel) */
12848 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12849 /* route front PCM to HP */
12850 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12851 /* port-F for mic-in (front panel) with vref */
12852 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12853 /* port-G for CLFE (rear panel) */
12854 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12855 /* port-H for side (rear panel) */
12856 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12858 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12859 /* route front mic to ADC1*/
12860 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12861 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12862 /* Unmute DAC0~3 & spdif out*/
12863 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12864 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12865 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12866 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12869 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12870 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12871 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12872 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12873 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12875 /* Unmute Stereo Mixer 15 */
12876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12877 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12881 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12882 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12883 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12884 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12885 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12886 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12887 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12888 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12889 /* hp used DAC 3 (Front) */
12890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12891 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12895 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
12897 * Unmute ADC0 and set the default input to mic-in
12899 /* port-A for surround (rear panel) */
12900 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12901 /* port-B for mic-in (rear panel) with vref */
12902 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12903 /* port-C for line-in (rear panel) */
12904 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12905 /* port-D for Front */
12906 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12907 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12908 /* port-E for HP out (front panel) */
12909 /* this has to be set to VREF80 */
12910 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12911 /* route front PCM to HP */
12912 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12913 /* port-F for mic-in (front panel) with vref */
12914 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12915 /* port-G for CLFE (rear panel) */
12916 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12917 /* port-H for side (rear panel) */
12918 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12920 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12921 /* route front mic to ADC1*/
12922 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12923 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12924 /* Unmute DAC0~3 & spdif out*/
12925 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12926 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12927 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12928 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12931 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12932 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12933 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12934 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12935 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12937 /* Unmute Stereo Mixer 15 */
12938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12943 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12944 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12945 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12946 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12947 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12948 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12949 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12950 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12951 /* hp used DAC 3 (Front) */
12952 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12953 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12957 static struct hda_verb alc861_asus_init_verbs[] = {
12959 * Unmute ADC0 and set the default input to mic-in
12961 /* port-A for surround (rear panel)
12962 * according to codec#0 this is the HP jack
12964 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12965 /* route front PCM to HP */
12966 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12967 /* port-B for mic-in (rear panel) with vref */
12968 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12969 /* port-C for line-in (rear panel) */
12970 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12971 /* port-D for Front */
12972 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12973 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12974 /* port-E for HP out (front panel) */
12975 /* this has to be set to VREF80 */
12976 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12977 /* route front PCM to HP */
12978 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12979 /* port-F for mic-in (front panel) with vref */
12980 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12981 /* port-G for CLFE (rear panel) */
12982 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12983 /* port-H for side (rear panel) */
12984 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12986 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12987 /* route front mic to ADC1*/
12988 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12989 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12990 /* Unmute DAC0~3 & spdif out*/
12991 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12992 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12993 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12994 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12996 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12997 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12998 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12999 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13000 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13002 /* Unmute Stereo Mixer 15 */
13003 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13004 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13008 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13009 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13010 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13011 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13012 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13013 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13014 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13015 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13016 /* hp used DAC 3 (Front) */
13017 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13018 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13022 /* additional init verbs for ASUS laptops */
13023 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13024 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13025 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13030 * generic initialization of ADC, input mixers and output mixers
13032 static struct hda_verb alc861_auto_init_verbs[] = {
13034 * Unmute ADC0 and set the default input to mic-in
13036 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13037 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13039 /* Unmute DAC0~3 & spdif out*/
13040 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13041 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13042 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13043 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13044 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13046 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13047 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13048 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13049 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13050 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13052 /* Unmute Stereo Mixer 15 */
13053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13058 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13059 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13060 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13061 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13062 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13063 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13065 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13067 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13069 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13070 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13071 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13072 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13073 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13074 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13076 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13081 static struct hda_verb alc861_toshiba_init_verbs[] = {
13082 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13087 /* toggle speaker-output according to the hp-jack state */
13088 static void alc861_toshiba_automute(struct hda_codec *codec)
13090 unsigned int present;
13092 present = snd_hda_codec_read(codec, 0x0f, 0,
13093 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13094 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13095 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13096 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13097 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13100 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13103 if ((res >> 26) == ALC880_HP_EVENT)
13104 alc861_toshiba_automute(codec);
13107 /* pcm configuration: identiacal with ALC880 */
13108 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13109 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13110 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13111 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13114 #define ALC861_DIGOUT_NID 0x07
13116 static struct hda_channel_mode alc861_8ch_modes[1] = {
13120 static hda_nid_t alc861_dac_nids[4] = {
13121 /* front, surround, clfe, side */
13122 0x03, 0x06, 0x05, 0x04
13125 static hda_nid_t alc660_dac_nids[3] = {
13126 /* front, clfe, surround */
13130 static hda_nid_t alc861_adc_nids[1] = {
13135 static struct hda_input_mux alc861_capture_source = {
13139 { "Front Mic", 0x3 },
13146 /* fill in the dac_nids table from the parsed pin configuration */
13147 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13148 const struct auto_pin_cfg *cfg)
13153 spec->multiout.dac_nids = spec->private_dac_nids;
13154 for (i = 0; i < cfg->line_outs; i++) {
13155 nid = cfg->line_out_pins[i];
13157 if (i >= ARRAY_SIZE(alc861_dac_nids))
13159 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13162 spec->multiout.num_dacs = cfg->line_outs;
13166 /* add playback controls from the parsed DAC table */
13167 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13168 const struct auto_pin_cfg *cfg)
13171 static const char *chname[4] = {
13172 "Front", "Surround", NULL /*CLFE*/, "Side"
13177 for (i = 0; i < cfg->line_outs; i++) {
13178 nid = spec->multiout.dac_nids[i];
13183 err = add_control(spec, ALC_CTL_BIND_MUTE,
13184 "Center Playback Switch",
13185 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13189 err = add_control(spec, ALC_CTL_BIND_MUTE,
13190 "LFE Playback Switch",
13191 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13196 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13198 if (nid == alc861_dac_nids[idx])
13200 sprintf(name, "%s Playback Switch", chname[idx]);
13201 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13202 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13211 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13219 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13221 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13222 "Headphone Playback Switch",
13223 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13226 spec->multiout.hp_nid = nid;
13231 /* create playback/capture controls for input pins */
13232 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13233 const struct auto_pin_cfg *cfg)
13235 struct hda_input_mux *imux = &spec->private_imux;
13236 int i, err, idx, idx1;
13238 for (i = 0; i < AUTO_PIN_LAST; i++) {
13239 switch (cfg->input_pins[i]) {
13242 idx = 2; /* Line In */
13246 idx = 2; /* Line In */
13250 idx = 1; /* Mic In */
13254 idx = 1; /* Mic In */
13264 err = new_analog_input(spec, cfg->input_pins[i],
13265 auto_pin_cfg_labels[i], idx, 0x15);
13269 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13270 imux->items[imux->num_items].index = idx1;
13276 static struct snd_kcontrol_new alc861_capture_mixer[] = {
13277 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13278 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13281 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13282 /* The multiple "Capture Source" controls confuse alsamixer
13283 * So call somewhat different..
13285 /* .name = "Capture Source", */
13286 .name = "Input Source",
13288 .info = alc_mux_enum_info,
13289 .get = alc_mux_enum_get,
13290 .put = alc_mux_enum_put,
13295 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13297 int pin_type, int dac_idx)
13299 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13301 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13305 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13307 struct alc_spec *spec = codec->spec;
13310 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13311 for (i = 0; i < spec->autocfg.line_outs; i++) {
13312 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13313 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13315 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13316 spec->multiout.dac_nids[i]);
13320 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13322 struct alc_spec *spec = codec->spec;
13325 pin = spec->autocfg.hp_pins[0];
13326 if (pin) /* connect to front */
13327 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13328 spec->multiout.dac_nids[0]);
13329 pin = spec->autocfg.speaker_pins[0];
13331 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13334 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13336 struct alc_spec *spec = codec->spec;
13339 for (i = 0; i < AUTO_PIN_LAST; i++) {
13340 hda_nid_t nid = spec->autocfg.input_pins[i];
13341 if (nid >= 0x0c && nid <= 0x11) {
13342 snd_hda_codec_write(codec, nid, 0,
13343 AC_VERB_SET_PIN_WIDGET_CONTROL,
13344 i <= AUTO_PIN_FRONT_MIC ?
13345 PIN_VREF80 : PIN_IN);
13350 /* parse the BIOS configuration and set up the alc_spec */
13351 /* return 1 if successful, 0 if the proper config is not found,
13352 * or a negative error code
13354 static int alc861_parse_auto_config(struct hda_codec *codec)
13356 struct alc_spec *spec = codec->spec;
13358 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13360 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13364 if (!spec->autocfg.line_outs)
13365 return 0; /* can't find valid BIOS pin config */
13367 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13370 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13373 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13376 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13380 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13382 if (spec->autocfg.dig_out_pin)
13383 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13385 if (spec->kctl_alloc)
13386 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13388 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
13390 spec->num_mux_defs = 1;
13391 spec->input_mux = &spec->private_imux;
13393 spec->adc_nids = alc861_adc_nids;
13394 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13395 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
13396 spec->num_mixers++;
13398 store_pin_configs(codec);
13402 /* additional initialization for auto-configuration model */
13403 static void alc861_auto_init(struct hda_codec *codec)
13405 struct alc_spec *spec = codec->spec;
13406 alc861_auto_init_multi_out(codec);
13407 alc861_auto_init_hp_out(codec);
13408 alc861_auto_init_analog_input(codec);
13409 if (spec->unsol_event)
13410 alc_inithook(codec);
13413 #ifdef CONFIG_SND_HDA_POWER_SAVE
13414 static struct hda_amp_list alc861_loopbacks[] = {
13415 { 0x15, HDA_INPUT, 0 },
13416 { 0x15, HDA_INPUT, 1 },
13417 { 0x15, HDA_INPUT, 2 },
13418 { 0x15, HDA_INPUT, 3 },
13425 * configuration and preset
13427 static const char *alc861_models[ALC861_MODEL_LAST] = {
13428 [ALC861_3ST] = "3stack",
13429 [ALC660_3ST] = "3stack-660",
13430 [ALC861_3ST_DIG] = "3stack-dig",
13431 [ALC861_6ST_DIG] = "6stack-dig",
13432 [ALC861_UNIWILL_M31] = "uniwill-m31",
13433 [ALC861_TOSHIBA] = "toshiba",
13434 [ALC861_ASUS] = "asus",
13435 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13436 [ALC861_AUTO] = "auto",
13439 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13440 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13441 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13442 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13443 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13444 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13445 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13446 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13447 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13448 * Any other models that need this preset?
13450 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13451 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13452 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13453 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13454 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13455 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13456 /* FIXME: the below seems conflict */
13457 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13458 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13459 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13463 static struct alc_config_preset alc861_presets[] = {
13465 .mixers = { alc861_3ST_mixer },
13466 .init_verbs = { alc861_threestack_init_verbs },
13467 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13468 .dac_nids = alc861_dac_nids,
13469 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13470 .channel_mode = alc861_threestack_modes,
13472 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13473 .adc_nids = alc861_adc_nids,
13474 .input_mux = &alc861_capture_source,
13476 [ALC861_3ST_DIG] = {
13477 .mixers = { alc861_base_mixer },
13478 .init_verbs = { alc861_threestack_init_verbs },
13479 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13480 .dac_nids = alc861_dac_nids,
13481 .dig_out_nid = ALC861_DIGOUT_NID,
13482 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13483 .channel_mode = alc861_threestack_modes,
13485 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13486 .adc_nids = alc861_adc_nids,
13487 .input_mux = &alc861_capture_source,
13489 [ALC861_6ST_DIG] = {
13490 .mixers = { alc861_base_mixer },
13491 .init_verbs = { alc861_base_init_verbs },
13492 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13493 .dac_nids = alc861_dac_nids,
13494 .dig_out_nid = ALC861_DIGOUT_NID,
13495 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13496 .channel_mode = alc861_8ch_modes,
13497 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13498 .adc_nids = alc861_adc_nids,
13499 .input_mux = &alc861_capture_source,
13502 .mixers = { alc861_3ST_mixer },
13503 .init_verbs = { alc861_threestack_init_verbs },
13504 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13505 .dac_nids = alc660_dac_nids,
13506 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13507 .channel_mode = alc861_threestack_modes,
13509 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13510 .adc_nids = alc861_adc_nids,
13511 .input_mux = &alc861_capture_source,
13513 [ALC861_UNIWILL_M31] = {
13514 .mixers = { alc861_uniwill_m31_mixer },
13515 .init_verbs = { alc861_uniwill_m31_init_verbs },
13516 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13517 .dac_nids = alc861_dac_nids,
13518 .dig_out_nid = ALC861_DIGOUT_NID,
13519 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13520 .channel_mode = alc861_uniwill_m31_modes,
13522 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13523 .adc_nids = alc861_adc_nids,
13524 .input_mux = &alc861_capture_source,
13526 [ALC861_TOSHIBA] = {
13527 .mixers = { alc861_toshiba_mixer },
13528 .init_verbs = { alc861_base_init_verbs,
13529 alc861_toshiba_init_verbs },
13530 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13531 .dac_nids = alc861_dac_nids,
13532 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13533 .channel_mode = alc883_3ST_2ch_modes,
13534 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13535 .adc_nids = alc861_adc_nids,
13536 .input_mux = &alc861_capture_source,
13537 .unsol_event = alc861_toshiba_unsol_event,
13538 .init_hook = alc861_toshiba_automute,
13541 .mixers = { alc861_asus_mixer },
13542 .init_verbs = { alc861_asus_init_verbs },
13543 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13544 .dac_nids = alc861_dac_nids,
13545 .dig_out_nid = ALC861_DIGOUT_NID,
13546 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13547 .channel_mode = alc861_asus_modes,
13550 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13551 .adc_nids = alc861_adc_nids,
13552 .input_mux = &alc861_capture_source,
13554 [ALC861_ASUS_LAPTOP] = {
13555 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13556 .init_verbs = { alc861_asus_init_verbs,
13557 alc861_asus_laptop_init_verbs },
13558 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13559 .dac_nids = alc861_dac_nids,
13560 .dig_out_nid = ALC861_DIGOUT_NID,
13561 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13562 .channel_mode = alc883_3ST_2ch_modes,
13564 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13565 .adc_nids = alc861_adc_nids,
13566 .input_mux = &alc861_capture_source,
13571 static int patch_alc861(struct hda_codec *codec)
13573 struct alc_spec *spec;
13577 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13581 codec->spec = spec;
13583 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13587 if (board_config < 0) {
13588 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13589 "trying auto-probe from BIOS...\n");
13590 board_config = ALC861_AUTO;
13593 if (board_config == ALC861_AUTO) {
13594 /* automatic parse from the BIOS config */
13595 err = alc861_parse_auto_config(codec);
13601 "hda_codec: Cannot set up configuration "
13602 "from BIOS. Using base mode...\n");
13603 board_config = ALC861_3ST_DIG;
13607 if (board_config != ALC861_AUTO)
13608 setup_preset(spec, &alc861_presets[board_config]);
13610 spec->stream_name_analog = "ALC861 Analog";
13611 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13612 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13614 spec->stream_name_digital = "ALC861 Digital";
13615 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13616 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13618 spec->vmaster_nid = 0x03;
13620 codec->patch_ops = alc_patch_ops;
13621 if (board_config == ALC861_AUTO)
13622 spec->init_hook = alc861_auto_init;
13623 #ifdef CONFIG_SND_HDA_POWER_SAVE
13624 if (!spec->loopback.amplist)
13625 spec->loopback.amplist = alc861_loopbacks;
13632 * ALC861-VD support
13636 * In addition, an independent DAC
13638 #define ALC861VD_DIGOUT_NID 0x06
13640 static hda_nid_t alc861vd_dac_nids[4] = {
13641 /* front, surr, clfe, side surr */
13642 0x02, 0x03, 0x04, 0x05
13645 /* dac_nids for ALC660vd are in a different order - according to
13646 * Realtek's driver.
13647 * This should probably tesult in a different mixer for 6stack models
13648 * of ALC660vd codecs, but for now there is only 3stack mixer
13649 * - and it is the same as in 861vd.
13650 * adc_nids in ALC660vd are (is) the same as in 861vd
13652 static hda_nid_t alc660vd_dac_nids[3] = {
13653 /* front, rear, clfe, rear_surr */
13657 static hda_nid_t alc861vd_adc_nids[1] = {
13662 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13665 /* FIXME: should be a matrix-type input source selection */
13666 static struct hda_input_mux alc861vd_capture_source = {
13670 { "Front Mic", 0x1 },
13676 static struct hda_input_mux alc861vd_dallas_capture_source = {
13679 { "Ext Mic", 0x0 },
13680 { "Int Mic", 0x1 },
13684 static struct hda_input_mux alc861vd_hp_capture_source = {
13687 { "Front Mic", 0x0 },
13688 { "ATAPI Mic", 0x1 },
13692 #define alc861vd_mux_enum_info alc_mux_enum_info
13693 #define alc861vd_mux_enum_get alc_mux_enum_get
13694 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
13695 #define alc861vd_mux_enum_put alc882_mux_enum_put
13700 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13707 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13708 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13709 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13710 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13711 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13718 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13719 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13720 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13721 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13722 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13726 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13727 { 6, alc861vd_6stack_ch6_init },
13728 { 8, alc861vd_6stack_ch8_init },
13731 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13733 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13734 .name = "Channel Mode",
13735 .info = alc_ch_mode_info,
13736 .get = alc_ch_mode_get,
13737 .put = alc_ch_mode_put,
13742 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
13743 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13744 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13747 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13748 /* The multiple "Capture Source" controls confuse alsamixer
13749 * So call somewhat different..
13751 /* .name = "Capture Source", */
13752 .name = "Input Source",
13754 .info = alc861vd_mux_enum_info,
13755 .get = alc861vd_mux_enum_get,
13756 .put = alc861vd_mux_enum_put,
13761 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13762 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13764 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13765 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13766 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13768 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13769 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13771 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13773 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13778 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13779 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13781 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13783 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13785 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13787 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13788 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13789 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13791 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13792 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13794 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13795 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13797 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13798 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13803 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13804 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13805 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13807 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13809 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13811 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13813 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13814 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13815 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13817 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13818 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13820 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13821 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13823 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13824 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13829 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
13830 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13831 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13832 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13834 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13836 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13840 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13841 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13844 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13845 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13850 /* Pin assignment: Speaker=0x14, HP = 0x15,
13851 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
13853 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
13854 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13855 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
13856 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13857 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13858 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13859 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13860 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13861 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13862 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13863 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13864 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
13865 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
13869 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
13870 * Front Mic=0x18, ATAPI Mic = 0x19,
13872 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
13873 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13874 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13875 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13876 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13877 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13878 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13879 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13880 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13886 * generic initialization of ADC, input mixers and output mixers
13888 static struct hda_verb alc861vd_volume_init_verbs[] = {
13890 * Unmute ADC0 and set the default input to mic-in
13892 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13893 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13895 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13896 * the analog-loopback mixer widget
13898 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13900 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13905 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13912 * Set up output mixers (0x02 - 0x05)
13914 /* set vol=0 to output mixers */
13915 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13916 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13917 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13918 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13920 /* set up input amps for analog loopback */
13921 /* Amp Indices: DAC = 0, mixer = 1 */
13922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13924 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13925 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13926 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13927 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13928 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13929 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13935 * 3-stack pin configuration:
13936 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13938 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13940 * Set pin mode and muting
13942 /* set front pin widgets 0x14 for output */
13943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13944 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13945 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13947 /* Mic (rear) pin: input vref at 80% */
13948 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13949 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13950 /* Front Mic pin: input vref at 80% */
13951 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13952 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13953 /* Line In pin: input */
13954 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13955 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13956 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13957 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13958 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13959 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13960 /* CD pin widget for input */
13961 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13967 * 6-stack pin configuration:
13969 static struct hda_verb alc861vd_6stack_init_verbs[] = {
13971 * Set pin mode and muting
13973 /* set front pin widgets 0x14 for output */
13974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13975 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13976 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13978 /* Rear Pin: output 1 (0x0d) */
13979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13981 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13982 /* CLFE Pin: output 2 (0x0e) */
13983 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13984 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13985 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13986 /* Side Pin: output 3 (0x0f) */
13987 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13988 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13989 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13991 /* Mic (rear) pin: input vref at 80% */
13992 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13993 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13994 /* Front Mic pin: input vref at 80% */
13995 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13996 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13997 /* Line In pin: input */
13998 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13999 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14000 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14001 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14002 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14003 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14004 /* CD pin widget for input */
14005 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14010 static struct hda_verb alc861vd_eapd_verbs[] = {
14011 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14015 static struct hda_verb alc660vd_eapd_verbs[] = {
14016 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14017 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14021 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14025 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14026 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14030 /* toggle speaker-output according to the hp-jack state */
14031 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14033 unsigned int present;
14034 unsigned char bits;
14036 present = snd_hda_codec_read(codec, 0x1b, 0,
14037 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14038 bits = present ? HDA_AMP_MUTE : 0;
14039 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14040 HDA_AMP_MUTE, bits);
14043 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14045 unsigned int present;
14046 unsigned char bits;
14048 present = snd_hda_codec_read(codec, 0x18, 0,
14049 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14050 bits = present ? HDA_AMP_MUTE : 0;
14051 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14052 HDA_AMP_MUTE, bits);
14055 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14057 alc861vd_lenovo_hp_automute(codec);
14058 alc861vd_lenovo_mic_automute(codec);
14061 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14064 switch (res >> 26) {
14065 case ALC880_HP_EVENT:
14066 alc861vd_lenovo_hp_automute(codec);
14068 case ALC880_MIC_EVENT:
14069 alc861vd_lenovo_mic_automute(codec);
14074 static struct hda_verb alc861vd_dallas_verbs[] = {
14075 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14076 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14077 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14078 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14080 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14082 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14083 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14084 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14085 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14086 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14087 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14089 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14091 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14093 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14094 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14095 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14096 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14098 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14100 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14101 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14102 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14103 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14104 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14105 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14112 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14113 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14114 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14119 /* toggle speaker-output according to the hp-jack state */
14120 static void alc861vd_dallas_automute(struct hda_codec *codec)
14122 unsigned int present;
14124 present = snd_hda_codec_read(codec, 0x15, 0,
14125 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14126 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14127 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14130 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14132 if ((res >> 26) == ALC880_HP_EVENT)
14133 alc861vd_dallas_automute(codec);
14136 #ifdef CONFIG_SND_HDA_POWER_SAVE
14137 #define alc861vd_loopbacks alc880_loopbacks
14140 /* pcm configuration: identiacal with ALC880 */
14141 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14142 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14143 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14144 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14147 * configuration and preset
14149 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14150 [ALC660VD_3ST] = "3stack-660",
14151 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14152 [ALC861VD_3ST] = "3stack",
14153 [ALC861VD_3ST_DIG] = "3stack-digout",
14154 [ALC861VD_6ST_DIG] = "6stack-digout",
14155 [ALC861VD_LENOVO] = "lenovo",
14156 [ALC861VD_DALLAS] = "dallas",
14157 [ALC861VD_HP] = "hp",
14158 [ALC861VD_AUTO] = "auto",
14161 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14162 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14163 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14164 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14165 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14166 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO),
14167 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14168 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14169 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14170 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14171 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14172 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14173 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14174 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14175 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14176 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14177 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14178 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14182 static struct alc_config_preset alc861vd_presets[] = {
14184 .mixers = { alc861vd_3st_mixer },
14185 .init_verbs = { alc861vd_volume_init_verbs,
14186 alc861vd_3stack_init_verbs },
14187 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14188 .dac_nids = alc660vd_dac_nids,
14189 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14190 .channel_mode = alc861vd_3stack_2ch_modes,
14191 .input_mux = &alc861vd_capture_source,
14193 [ALC660VD_3ST_DIG] = {
14194 .mixers = { alc861vd_3st_mixer },
14195 .init_verbs = { alc861vd_volume_init_verbs,
14196 alc861vd_3stack_init_verbs },
14197 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14198 .dac_nids = alc660vd_dac_nids,
14199 .dig_out_nid = ALC861VD_DIGOUT_NID,
14200 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14201 .channel_mode = alc861vd_3stack_2ch_modes,
14202 .input_mux = &alc861vd_capture_source,
14205 .mixers = { alc861vd_3st_mixer },
14206 .init_verbs = { alc861vd_volume_init_verbs,
14207 alc861vd_3stack_init_verbs },
14208 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14209 .dac_nids = alc861vd_dac_nids,
14210 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14211 .channel_mode = alc861vd_3stack_2ch_modes,
14212 .input_mux = &alc861vd_capture_source,
14214 [ALC861VD_3ST_DIG] = {
14215 .mixers = { alc861vd_3st_mixer },
14216 .init_verbs = { alc861vd_volume_init_verbs,
14217 alc861vd_3stack_init_verbs },
14218 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14219 .dac_nids = alc861vd_dac_nids,
14220 .dig_out_nid = ALC861VD_DIGOUT_NID,
14221 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14222 .channel_mode = alc861vd_3stack_2ch_modes,
14223 .input_mux = &alc861vd_capture_source,
14225 [ALC861VD_6ST_DIG] = {
14226 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14227 .init_verbs = { alc861vd_volume_init_verbs,
14228 alc861vd_6stack_init_verbs },
14229 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14230 .dac_nids = alc861vd_dac_nids,
14231 .dig_out_nid = ALC861VD_DIGOUT_NID,
14232 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14233 .channel_mode = alc861vd_6stack_modes,
14234 .input_mux = &alc861vd_capture_source,
14236 [ALC861VD_LENOVO] = {
14237 .mixers = { alc861vd_lenovo_mixer },
14238 .init_verbs = { alc861vd_volume_init_verbs,
14239 alc861vd_3stack_init_verbs,
14240 alc861vd_eapd_verbs,
14241 alc861vd_lenovo_unsol_verbs },
14242 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14243 .dac_nids = alc660vd_dac_nids,
14244 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14245 .channel_mode = alc861vd_3stack_2ch_modes,
14246 .input_mux = &alc861vd_capture_source,
14247 .unsol_event = alc861vd_lenovo_unsol_event,
14248 .init_hook = alc861vd_lenovo_automute,
14250 [ALC861VD_DALLAS] = {
14251 .mixers = { alc861vd_dallas_mixer },
14252 .init_verbs = { alc861vd_dallas_verbs },
14253 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14254 .dac_nids = alc861vd_dac_nids,
14255 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14256 .channel_mode = alc861vd_3stack_2ch_modes,
14257 .input_mux = &alc861vd_dallas_capture_source,
14258 .unsol_event = alc861vd_dallas_unsol_event,
14259 .init_hook = alc861vd_dallas_automute,
14262 .mixers = { alc861vd_hp_mixer },
14263 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14264 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14265 .dac_nids = alc861vd_dac_nids,
14266 .dig_out_nid = ALC861VD_DIGOUT_NID,
14267 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14268 .channel_mode = alc861vd_3stack_2ch_modes,
14269 .input_mux = &alc861vd_hp_capture_source,
14270 .unsol_event = alc861vd_dallas_unsol_event,
14271 .init_hook = alc861vd_dallas_automute,
14276 * BIOS auto configuration
14278 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14279 hda_nid_t nid, int pin_type, int dac_idx)
14281 alc_set_pin_output(codec, nid, pin_type);
14284 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14286 struct alc_spec *spec = codec->spec;
14289 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14290 for (i = 0; i <= HDA_SIDE; i++) {
14291 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14292 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14294 alc861vd_auto_set_output_and_unmute(codec, nid,
14300 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14302 struct alc_spec *spec = codec->spec;
14305 pin = spec->autocfg.hp_pins[0];
14306 if (pin) /* connect to front and use dac 0 */
14307 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14308 pin = spec->autocfg.speaker_pins[0];
14310 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14313 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14314 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14316 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14318 struct alc_spec *spec = codec->spec;
14321 for (i = 0; i < AUTO_PIN_LAST; i++) {
14322 hda_nid_t nid = spec->autocfg.input_pins[i];
14323 if (alc861vd_is_input_pin(nid)) {
14324 snd_hda_codec_write(codec, nid, 0,
14325 AC_VERB_SET_PIN_WIDGET_CONTROL,
14326 i <= AUTO_PIN_FRONT_MIC ?
14327 PIN_VREF80 : PIN_IN);
14328 if (nid != ALC861VD_PIN_CD_NID)
14329 snd_hda_codec_write(codec, nid, 0,
14330 AC_VERB_SET_AMP_GAIN_MUTE,
14336 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14338 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14339 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14341 /* add playback controls from the parsed DAC table */
14342 /* Based on ALC880 version. But ALC861VD has separate,
14343 * different NIDs for mute/unmute switch and volume control */
14344 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14345 const struct auto_pin_cfg *cfg)
14348 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14349 hda_nid_t nid_v, nid_s;
14352 for (i = 0; i < cfg->line_outs; i++) {
14353 if (!spec->multiout.dac_nids[i])
14355 nid_v = alc861vd_idx_to_mixer_vol(
14357 spec->multiout.dac_nids[i]));
14358 nid_s = alc861vd_idx_to_mixer_switch(
14360 spec->multiout.dac_nids[i]));
14364 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14365 "Center Playback Volume",
14366 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14370 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14371 "LFE Playback Volume",
14372 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14376 err = add_control(spec, ALC_CTL_BIND_MUTE,
14377 "Center Playback Switch",
14378 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14382 err = add_control(spec, ALC_CTL_BIND_MUTE,
14383 "LFE Playback Switch",
14384 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14389 sprintf(name, "%s Playback Volume", chname[i]);
14390 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14391 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14395 sprintf(name, "%s Playback Switch", chname[i]);
14396 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14397 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14406 /* add playback controls for speaker and HP outputs */
14407 /* Based on ALC880 version. But ALC861VD has separate,
14408 * different NIDs for mute/unmute switch and volume control */
14409 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14410 hda_nid_t pin, const char *pfx)
14412 hda_nid_t nid_v, nid_s;
14419 if (alc880_is_fixed_pin(pin)) {
14420 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14421 /* specify the DAC as the extra output */
14422 if (!spec->multiout.hp_nid)
14423 spec->multiout.hp_nid = nid_v;
14425 spec->multiout.extra_out_nid[0] = nid_v;
14426 /* control HP volume/switch on the output mixer amp */
14427 nid_v = alc861vd_idx_to_mixer_vol(
14428 alc880_fixed_pin_idx(pin));
14429 nid_s = alc861vd_idx_to_mixer_switch(
14430 alc880_fixed_pin_idx(pin));
14432 sprintf(name, "%s Playback Volume", pfx);
14433 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14434 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14437 sprintf(name, "%s Playback Switch", pfx);
14438 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14439 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14442 } else if (alc880_is_multi_pin(pin)) {
14443 /* set manual connection */
14444 /* we have only a switch on HP-out PIN */
14445 sprintf(name, "%s Playback Switch", pfx);
14446 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14447 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14454 /* parse the BIOS configuration and set up the alc_spec
14455 * return 1 if successful, 0 if the proper config is not found,
14456 * or a negative error code
14457 * Based on ALC880 version - had to change it to override
14458 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14459 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14461 struct alc_spec *spec = codec->spec;
14463 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14465 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14469 if (!spec->autocfg.line_outs)
14470 return 0; /* can't find valid BIOS pin config */
14472 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14475 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14478 err = alc861vd_auto_create_extra_out(spec,
14479 spec->autocfg.speaker_pins[0],
14483 err = alc861vd_auto_create_extra_out(spec,
14484 spec->autocfg.hp_pins[0],
14488 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14492 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14494 if (spec->autocfg.dig_out_pin)
14495 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14497 if (spec->kctl_alloc)
14498 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14500 spec->init_verbs[spec->num_init_verbs++]
14501 = alc861vd_volume_init_verbs;
14503 spec->num_mux_defs = 1;
14504 spec->input_mux = &spec->private_imux;
14506 err = alc_auto_add_mic_boost(codec);
14510 store_pin_configs(codec);
14514 /* additional initialization for auto-configuration model */
14515 static void alc861vd_auto_init(struct hda_codec *codec)
14517 struct alc_spec *spec = codec->spec;
14518 alc861vd_auto_init_multi_out(codec);
14519 alc861vd_auto_init_hp_out(codec);
14520 alc861vd_auto_init_analog_input(codec);
14521 alc861vd_auto_init_input_src(codec);
14522 if (spec->unsol_event)
14523 alc_inithook(codec);
14526 static int patch_alc861vd(struct hda_codec *codec)
14528 struct alc_spec *spec;
14529 int err, board_config;
14531 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14535 codec->spec = spec;
14537 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14541 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14542 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14543 "ALC861VD, trying auto-probe from BIOS...\n");
14544 board_config = ALC861VD_AUTO;
14547 if (board_config == ALC861VD_AUTO) {
14548 /* automatic parse from the BIOS config */
14549 err = alc861vd_parse_auto_config(codec);
14555 "hda_codec: Cannot set up configuration "
14556 "from BIOS. Using base mode...\n");
14557 board_config = ALC861VD_3ST;
14561 if (board_config != ALC861VD_AUTO)
14562 setup_preset(spec, &alc861vd_presets[board_config]);
14564 if (codec->vendor_id == 0x10ec0660) {
14565 spec->stream_name_analog = "ALC660-VD Analog";
14566 spec->stream_name_digital = "ALC660-VD Digital";
14567 /* always turn on EAPD */
14568 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
14570 spec->stream_name_analog = "ALC861VD Analog";
14571 spec->stream_name_digital = "ALC861VD Digital";
14574 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14575 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14577 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14578 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14580 spec->adc_nids = alc861vd_adc_nids;
14581 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14582 spec->capsrc_nids = alc861vd_capsrc_nids;
14584 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
14585 spec->num_mixers++;
14587 spec->vmaster_nid = 0x02;
14589 codec->patch_ops = alc_patch_ops;
14591 if (board_config == ALC861VD_AUTO)
14592 spec->init_hook = alc861vd_auto_init;
14593 #ifdef CONFIG_SND_HDA_POWER_SAVE
14594 if (!spec->loopback.amplist)
14595 spec->loopback.amplist = alc861vd_loopbacks;
14604 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14605 * configuration. Each pin widget can choose any input DACs and a mixer.
14606 * Each ADC is connected from a mixer of all inputs. This makes possible
14607 * 6-channel independent captures.
14609 * In addition, an independent DAC for the multi-playback (not used in this
14612 #define ALC662_DIGOUT_NID 0x06
14613 #define ALC662_DIGIN_NID 0x0a
14615 static hda_nid_t alc662_dac_nids[4] = {
14616 /* front, rear, clfe, rear_surr */
14620 static hda_nid_t alc662_adc_nids[1] = {
14625 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14628 /* FIXME: should be a matrix-type input source selection */
14629 static struct hda_input_mux alc662_capture_source = {
14633 { "Front Mic", 0x1 },
14639 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14647 static struct hda_input_mux alc662_eeepc_capture_source = {
14655 static struct hda_input_mux alc663_capture_source = {
14659 { "Front Mic", 0x1 },
14664 static struct hda_input_mux alc663_m51va_capture_source = {
14667 { "Ext-Mic", 0x0 },
14672 #define alc662_mux_enum_info alc_mux_enum_info
14673 #define alc662_mux_enum_get alc_mux_enum_get
14674 #define alc662_mux_enum_put alc882_mux_enum_put
14679 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14686 static struct hda_verb alc662_3ST_ch2_init[] = {
14687 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14688 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14689 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14690 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14697 static struct hda_verb alc662_3ST_ch6_init[] = {
14698 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14699 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14700 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14701 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14702 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14703 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14707 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14708 { 2, alc662_3ST_ch2_init },
14709 { 6, alc662_3ST_ch6_init },
14715 static struct hda_verb alc662_sixstack_ch6_init[] = {
14716 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14717 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14718 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14725 static struct hda_verb alc662_sixstack_ch8_init[] = {
14726 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14727 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14728 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14732 static struct hda_channel_mode alc662_5stack_modes[2] = {
14733 { 2, alc662_sixstack_ch6_init },
14734 { 6, alc662_sixstack_ch8_init },
14737 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14738 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14741 static struct snd_kcontrol_new alc662_base_mixer[] = {
14742 /* output mixer control */
14743 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14744 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14745 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14746 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14747 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14748 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14749 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14750 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14753 /*Input mixer control */
14754 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14755 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14756 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14757 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14758 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14759 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14760 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14761 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14765 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14766 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14767 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14775 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14777 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14778 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14782 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14783 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14784 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14785 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14786 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14787 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14788 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14789 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14790 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
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("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14799 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14800 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14801 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14805 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
14806 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14807 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
14808 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14809 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
14810 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14811 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14812 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14813 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14814 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14818 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
14819 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14821 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14822 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14824 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
14825 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14826 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14828 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
14829 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14830 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14834 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
14835 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14836 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14837 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14838 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
14839 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14840 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14841 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
14842 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
14843 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14844 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
14845 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14846 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14852 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14853 .ops = &snd_hda_bind_vol,
14855 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14856 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14861 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14862 .ops = &snd_hda_bind_sw,
14864 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14865 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14870 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14871 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14872 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14878 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14879 .ops = &snd_hda_bind_sw,
14881 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14882 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14883 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14888 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14889 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14890 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14893 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14894 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14899 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14900 .ops = &snd_hda_bind_sw,
14902 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14903 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14904 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14909 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14910 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14911 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14914 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14915 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14919 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
14920 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14921 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14922 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14924 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14925 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14926 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14930 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14931 .ops = &snd_hda_bind_vol,
14933 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14934 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14939 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14940 .ops = &snd_hda_bind_sw,
14942 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14943 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14948 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14949 HDA_BIND_VOL("Master Playback Volume",
14950 &alc663_asus_two_bind_master_vol),
14951 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14952 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14953 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14955 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14959 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14960 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14961 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14962 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14965 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14969 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
14970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14971 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14972 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14973 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14974 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14978 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14979 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14983 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
14984 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14985 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14986 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14989 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14990 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14991 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14997 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
14999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15000 .name = "Channel Mode",
15001 .info = alc_ch_mode_info,
15002 .get = alc_ch_mode_get,
15003 .put = alc_ch_mode_put,
15008 static struct hda_verb alc662_init_verbs[] = {
15009 /* ADC: mute amp left and right */
15010 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15011 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15012 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15017 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15018 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15022 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15023 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15025 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15027 /* Front Pin: output 0 (0x0c) */
15028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15031 /* Rear Pin: output 1 (0x0d) */
15032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15035 /* CLFE Pin: output 2 (0x0e) */
15036 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15037 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15039 /* Mic (rear) pin: input vref at 80% */
15040 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15041 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15042 /* Front Mic pin: input vref at 80% */
15043 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15044 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15045 /* Line In pin: input */
15046 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15047 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15048 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15049 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15050 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15051 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15052 /* CD pin widget for input */
15053 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15055 /* FIXME: use matrix-type input source selection */
15056 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15064 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15065 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15066 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15068 /* always trun on EAPD */
15069 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15070 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15075 static struct hda_verb alc662_sue_init_verbs[] = {
15076 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15077 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15081 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15082 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15083 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15087 /* Set Unsolicited Event*/
15088 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15089 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15090 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15095 * generic initialization of ADC, input mixers and output mixers
15097 static struct hda_verb alc662_auto_init_verbs[] = {
15099 * Unmute ADC and set the default input to mic-in
15101 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15102 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15104 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15106 * Note: PASD motherboards uses the Line In 2 as the input for front
15107 * panel mic (mic 2)
15109 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15117 * Set up output mixers (0x0c - 0x0f)
15119 /* set vol=0 to output mixers */
15120 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15121 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15122 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15124 /* set up input amps for analog loopback */
15125 /* Amp Indices: DAC = 0, mixer = 1 */
15126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15128 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15129 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15130 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15131 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15134 /* FIXME: use matrix-type input source selection */
15135 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15137 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15138 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15142 /* additional verbs for ALC663 */
15143 static struct hda_verb alc663_auto_init_verbs[] = {
15144 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15145 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15149 static struct hda_verb alc663_m51va_init_verbs[] = {
15150 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15151 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15152 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15153 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15154 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15157 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15158 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15162 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15163 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15164 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15165 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15167 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15168 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15169 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15173 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15174 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15175 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15176 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15177 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15180 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15181 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15185 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15186 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15188 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15191 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15192 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15196 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15197 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15198 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15199 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15200 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15203 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15206 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15207 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15208 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15212 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15213 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15215 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15216 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15218 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15219 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15220 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15221 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15222 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15224 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15228 static struct hda_verb alc663_g71v_init_verbs[] = {
15229 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15230 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15231 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15233 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15234 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15235 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15237 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15238 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15239 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15243 static struct hda_verb alc663_g50v_init_verbs[] = {
15244 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15245 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15246 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15248 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15249 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15253 static struct hda_verb alc662_ecs_init_verbs[] = {
15254 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15255 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15256 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15257 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15261 /* capture mixer elements */
15262 static struct snd_kcontrol_new alc662_capture_mixer[] = {
15263 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15264 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15267 /* The multiple "Capture Source" controls confuse alsamixer
15268 * So call somewhat different..
15270 /* .name = "Capture Source", */
15271 .name = "Input Source",
15273 .info = alc662_mux_enum_info,
15274 .get = alc662_mux_enum_get,
15275 .put = alc662_mux_enum_put,
15280 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15281 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15282 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15286 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15288 unsigned int present;
15289 unsigned char bits;
15291 present = snd_hda_codec_read(codec, 0x14, 0,
15292 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15293 bits = present ? HDA_AMP_MUTE : 0;
15294 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15295 HDA_AMP_MUTE, bits);
15298 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15300 unsigned int present;
15301 unsigned char bits;
15303 present = snd_hda_codec_read(codec, 0x1b, 0,
15304 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15305 bits = present ? HDA_AMP_MUTE : 0;
15306 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15307 HDA_AMP_MUTE, bits);
15308 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15309 HDA_AMP_MUTE, bits);
15312 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15315 if ((res >> 26) == ALC880_HP_EVENT)
15316 alc662_lenovo_101e_all_automute(codec);
15317 if ((res >> 26) == ALC880_FRONT_EVENT)
15318 alc662_lenovo_101e_ispeaker_automute(codec);
15321 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15323 unsigned int present;
15325 present = snd_hda_codec_read(codec, 0x18, 0,
15326 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15327 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15328 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15329 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15330 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15331 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15332 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15333 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15334 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15337 /* unsolicited event for HP jack sensing */
15338 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15341 if ((res >> 26) == ALC880_HP_EVENT)
15342 alc262_hippo1_automute( codec );
15344 if ((res >> 26) == ALC880_MIC_EVENT)
15345 alc662_eeepc_mic_automute(codec);
15348 static void alc662_eeepc_inithook(struct hda_codec *codec)
15350 alc262_hippo1_automute( codec );
15351 alc662_eeepc_mic_automute(codec);
15354 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15357 unsigned int present;
15359 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15360 present = snd_hda_codec_read(codec, 0x14, 0,
15361 AC_VERB_GET_PIN_SENSE, 0);
15362 present = (present & 0x80000000) != 0;
15364 /* mute internal speaker */
15365 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15366 HDA_AMP_MUTE, HDA_AMP_MUTE);
15368 /* unmute internal speaker if necessary */
15369 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15370 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15371 HDA_AMP_MUTE, mute);
15375 /* unsolicited event for HP jack sensing */
15376 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15379 if ((res >> 26) == ALC880_HP_EVENT)
15380 alc662_eeepc_ep20_automute(codec);
15383 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15385 alc662_eeepc_ep20_automute(codec);
15388 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15390 unsigned int present;
15391 unsigned char bits;
15393 present = snd_hda_codec_read(codec, 0x21, 0,
15394 AC_VERB_GET_PIN_SENSE, 0)
15395 & AC_PINSENSE_PRESENCE;
15396 bits = present ? HDA_AMP_MUTE : 0;
15397 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15398 AMP_IN_MUTE(0), bits);
15399 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15400 AMP_IN_MUTE(0), bits);
15403 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15405 unsigned int present;
15406 unsigned char bits;
15408 present = snd_hda_codec_read(codec, 0x21, 0,
15409 AC_VERB_GET_PIN_SENSE, 0)
15410 & AC_PINSENSE_PRESENCE;
15411 bits = present ? HDA_AMP_MUTE : 0;
15412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15413 AMP_IN_MUTE(0), bits);
15414 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15415 AMP_IN_MUTE(0), bits);
15416 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15417 AMP_IN_MUTE(0), bits);
15418 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15419 AMP_IN_MUTE(0), bits);
15422 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15424 unsigned int present;
15425 unsigned char bits;
15427 present = snd_hda_codec_read(codec, 0x15, 0,
15428 AC_VERB_GET_PIN_SENSE, 0)
15429 & AC_PINSENSE_PRESENCE;
15430 bits = present ? HDA_AMP_MUTE : 0;
15431 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15432 AMP_IN_MUTE(0), bits);
15433 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15434 AMP_IN_MUTE(0), bits);
15435 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15436 AMP_IN_MUTE(0), bits);
15437 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15438 AMP_IN_MUTE(0), bits);
15441 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15443 unsigned int present;
15444 unsigned char bits;
15446 present = snd_hda_codec_read(codec, 0x1b, 0,
15447 AC_VERB_GET_PIN_SENSE, 0)
15448 & AC_PINSENSE_PRESENCE;
15449 bits = present ? 0 : PIN_OUT;
15450 snd_hda_codec_write(codec, 0x14, 0,
15451 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15454 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15456 unsigned int present1, present2;
15458 present1 = snd_hda_codec_read(codec, 0x21, 0,
15459 AC_VERB_GET_PIN_SENSE, 0)
15460 & AC_PINSENSE_PRESENCE;
15461 present2 = snd_hda_codec_read(codec, 0x15, 0,
15462 AC_VERB_GET_PIN_SENSE, 0)
15463 & AC_PINSENSE_PRESENCE;
15465 if (present1 || present2) {
15466 snd_hda_codec_write_cache(codec, 0x14, 0,
15467 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15469 snd_hda_codec_write_cache(codec, 0x14, 0,
15470 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15474 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15476 unsigned int present1, present2;
15478 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15479 AC_VERB_GET_PIN_SENSE, 0)
15480 & AC_PINSENSE_PRESENCE;
15481 present2 = snd_hda_codec_read(codec, 0x15, 0,
15482 AC_VERB_GET_PIN_SENSE, 0)
15483 & AC_PINSENSE_PRESENCE;
15485 if (present1 || present2) {
15486 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15487 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15488 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15489 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15491 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15492 AMP_IN_MUTE(0), 0);
15493 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15494 AMP_IN_MUTE(0), 0);
15498 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15500 unsigned int present;
15502 present = snd_hda_codec_read(codec, 0x18, 0,
15503 AC_VERB_GET_PIN_SENSE, 0)
15504 & AC_PINSENSE_PRESENCE;
15505 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15506 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15507 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15508 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15509 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15510 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15511 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15512 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15515 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15518 switch (res >> 26) {
15519 case ALC880_HP_EVENT:
15520 alc663_m51va_speaker_automute(codec);
15522 case ALC880_MIC_EVENT:
15523 alc663_m51va_mic_automute(codec);
15528 static void alc663_m51va_inithook(struct hda_codec *codec)
15530 alc663_m51va_speaker_automute(codec);
15531 alc663_m51va_mic_automute(codec);
15534 /* ***************** Mode1 ******************************/
15535 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15538 switch (res >> 26) {
15539 case ALC880_HP_EVENT:
15540 alc663_m51va_speaker_automute(codec);
15542 case ALC880_MIC_EVENT:
15543 alc662_eeepc_mic_automute(codec);
15548 static void alc663_mode1_inithook(struct hda_codec *codec)
15550 alc663_m51va_speaker_automute(codec);
15551 alc662_eeepc_mic_automute(codec);
15553 /* ***************** Mode2 ******************************/
15554 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15557 switch (res >> 26) {
15558 case ALC880_HP_EVENT:
15559 alc662_f5z_speaker_automute(codec);
15561 case ALC880_MIC_EVENT:
15562 alc662_eeepc_mic_automute(codec);
15567 static void alc662_mode2_inithook(struct hda_codec *codec)
15569 alc662_f5z_speaker_automute(codec);
15570 alc662_eeepc_mic_automute(codec);
15572 /* ***************** Mode3 ******************************/
15573 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15576 switch (res >> 26) {
15577 case ALC880_HP_EVENT:
15578 alc663_two_hp_m1_speaker_automute(codec);
15580 case ALC880_MIC_EVENT:
15581 alc662_eeepc_mic_automute(codec);
15586 static void alc663_mode3_inithook(struct hda_codec *codec)
15588 alc663_two_hp_m1_speaker_automute(codec);
15589 alc662_eeepc_mic_automute(codec);
15591 /* ***************** Mode4 ******************************/
15592 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15595 switch (res >> 26) {
15596 case ALC880_HP_EVENT:
15597 alc663_21jd_two_speaker_automute(codec);
15599 case ALC880_MIC_EVENT:
15600 alc662_eeepc_mic_automute(codec);
15605 static void alc663_mode4_inithook(struct hda_codec *codec)
15607 alc663_21jd_two_speaker_automute(codec);
15608 alc662_eeepc_mic_automute(codec);
15610 /* ***************** Mode5 ******************************/
15611 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15614 switch (res >> 26) {
15615 case ALC880_HP_EVENT:
15616 alc663_15jd_two_speaker_automute(codec);
15618 case ALC880_MIC_EVENT:
15619 alc662_eeepc_mic_automute(codec);
15624 static void alc663_mode5_inithook(struct hda_codec *codec)
15626 alc663_15jd_two_speaker_automute(codec);
15627 alc662_eeepc_mic_automute(codec);
15629 /* ***************** Mode6 ******************************/
15630 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15633 switch (res >> 26) {
15634 case ALC880_HP_EVENT:
15635 alc663_two_hp_m2_speaker_automute(codec);
15637 case ALC880_MIC_EVENT:
15638 alc662_eeepc_mic_automute(codec);
15643 static void alc663_mode6_inithook(struct hda_codec *codec)
15645 alc663_two_hp_m2_speaker_automute(codec);
15646 alc662_eeepc_mic_automute(codec);
15649 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15651 unsigned int present;
15652 unsigned char bits;
15654 present = snd_hda_codec_read(codec, 0x21, 0,
15655 AC_VERB_GET_PIN_SENSE, 0)
15656 & AC_PINSENSE_PRESENCE;
15657 bits = present ? HDA_AMP_MUTE : 0;
15658 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15659 HDA_AMP_MUTE, bits);
15660 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15661 HDA_AMP_MUTE, bits);
15664 static void alc663_g71v_front_automute(struct hda_codec *codec)
15666 unsigned int present;
15667 unsigned char bits;
15669 present = snd_hda_codec_read(codec, 0x15, 0,
15670 AC_VERB_GET_PIN_SENSE, 0)
15671 & AC_PINSENSE_PRESENCE;
15672 bits = present ? HDA_AMP_MUTE : 0;
15673 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15674 HDA_AMP_MUTE, bits);
15677 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15680 switch (res >> 26) {
15681 case ALC880_HP_EVENT:
15682 alc663_g71v_hp_automute(codec);
15684 case ALC880_FRONT_EVENT:
15685 alc663_g71v_front_automute(codec);
15687 case ALC880_MIC_EVENT:
15688 alc662_eeepc_mic_automute(codec);
15693 static void alc663_g71v_inithook(struct hda_codec *codec)
15695 alc663_g71v_front_automute(codec);
15696 alc663_g71v_hp_automute(codec);
15697 alc662_eeepc_mic_automute(codec);
15700 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15703 switch (res >> 26) {
15704 case ALC880_HP_EVENT:
15705 alc663_m51va_speaker_automute(codec);
15707 case ALC880_MIC_EVENT:
15708 alc662_eeepc_mic_automute(codec);
15713 static void alc663_g50v_inithook(struct hda_codec *codec)
15715 alc663_m51va_speaker_automute(codec);
15716 alc662_eeepc_mic_automute(codec);
15719 /* bind hp and internal speaker mute (with plug check) */
15720 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15721 struct snd_ctl_elem_value *ucontrol)
15723 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15724 long *valp = ucontrol->value.integer.value;
15727 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15729 valp[0] ? 0 : HDA_AMP_MUTE);
15730 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15732 valp[1] ? 0 : HDA_AMP_MUTE);
15734 alc262_hippo1_automute(codec);
15738 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15739 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15742 .name = "Master Playback Switch",
15743 .info = snd_hda_mixer_amp_switch_info,
15744 .get = snd_hda_mixer_amp_switch_get,
15745 .put = alc662_ecs_master_sw_put,
15746 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15749 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15750 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15751 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15753 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15754 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15755 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15759 #ifdef CONFIG_SND_HDA_POWER_SAVE
15760 #define alc662_loopbacks alc880_loopbacks
15764 /* pcm configuration: identiacal with ALC880 */
15765 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15766 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15767 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15768 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15771 * configuration and preset
15773 static const char *alc662_models[ALC662_MODEL_LAST] = {
15774 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15775 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15776 [ALC662_3ST_6ch] = "3stack-6ch",
15777 [ALC662_5ST_DIG] = "6stack-dig",
15778 [ALC662_LENOVO_101E] = "lenovo-101e",
15779 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15780 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15781 [ALC662_ECS] = "ecs",
15782 [ALC663_ASUS_M51VA] = "m51va",
15783 [ALC663_ASUS_G71V] = "g71v",
15784 [ALC663_ASUS_H13] = "h13",
15785 [ALC663_ASUS_G50V] = "g50v",
15786 [ALC663_ASUS_MODE1] = "asus-mode1",
15787 [ALC662_ASUS_MODE2] = "asus-mode2",
15788 [ALC663_ASUS_MODE3] = "asus-mode3",
15789 [ALC663_ASUS_MODE4] = "asus-mode4",
15790 [ALC663_ASUS_MODE5] = "asus-mode5",
15791 [ALC663_ASUS_MODE6] = "asus-mode6",
15792 [ALC662_AUTO] = "auto",
15795 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15796 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15797 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15798 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15799 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15800 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15801 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15802 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15803 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15804 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15805 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15806 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15807 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15808 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15809 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15810 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15811 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15812 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15813 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15814 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15815 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15816 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15817 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15818 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15819 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15820 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15821 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15822 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15823 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15824 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15825 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15826 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15827 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15828 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15829 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15830 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15831 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15832 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15833 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15834 ALC662_3ST_6ch_DIG),
15835 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15836 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15837 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15838 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15839 ALC662_3ST_6ch_DIG),
15840 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15841 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15842 ALC662_3ST_6ch_DIG),
15843 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15844 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15845 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
15849 static struct alc_config_preset alc662_presets[] = {
15850 [ALC662_3ST_2ch_DIG] = {
15851 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
15852 .init_verbs = { alc662_init_verbs },
15853 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15854 .dac_nids = alc662_dac_nids,
15855 .dig_out_nid = ALC662_DIGOUT_NID,
15856 .dig_in_nid = ALC662_DIGIN_NID,
15857 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15858 .channel_mode = alc662_3ST_2ch_modes,
15859 .input_mux = &alc662_capture_source,
15861 [ALC662_3ST_6ch_DIG] = {
15862 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
15863 alc662_capture_mixer },
15864 .init_verbs = { alc662_init_verbs },
15865 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15866 .dac_nids = alc662_dac_nids,
15867 .dig_out_nid = ALC662_DIGOUT_NID,
15868 .dig_in_nid = ALC662_DIGIN_NID,
15869 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15870 .channel_mode = alc662_3ST_6ch_modes,
15872 .input_mux = &alc662_capture_source,
15874 [ALC662_3ST_6ch] = {
15875 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
15876 alc662_capture_mixer },
15877 .init_verbs = { alc662_init_verbs },
15878 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15879 .dac_nids = alc662_dac_nids,
15880 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15881 .channel_mode = alc662_3ST_6ch_modes,
15883 .input_mux = &alc662_capture_source,
15885 [ALC662_5ST_DIG] = {
15886 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
15887 alc662_capture_mixer },
15888 .init_verbs = { alc662_init_verbs },
15889 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15890 .dac_nids = alc662_dac_nids,
15891 .dig_out_nid = ALC662_DIGOUT_NID,
15892 .dig_in_nid = ALC662_DIGIN_NID,
15893 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
15894 .channel_mode = alc662_5stack_modes,
15895 .input_mux = &alc662_capture_source,
15897 [ALC662_LENOVO_101E] = {
15898 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
15899 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
15900 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15901 .dac_nids = alc662_dac_nids,
15902 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15903 .channel_mode = alc662_3ST_2ch_modes,
15904 .input_mux = &alc662_lenovo_101e_capture_source,
15905 .unsol_event = alc662_lenovo_101e_unsol_event,
15906 .init_hook = alc662_lenovo_101e_all_automute,
15908 [ALC662_ASUS_EEEPC_P701] = {
15909 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
15910 .init_verbs = { alc662_init_verbs,
15911 alc662_eeepc_sue_init_verbs },
15912 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15913 .dac_nids = alc662_dac_nids,
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 = alc662_eeepc_unsol_event,
15918 .init_hook = alc662_eeepc_inithook,
15920 [ALC662_ASUS_EEEPC_EP20] = {
15921 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
15922 alc662_chmode_mixer },
15923 .init_verbs = { alc662_init_verbs,
15924 alc662_eeepc_ep20_sue_init_verbs },
15925 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15926 .dac_nids = alc662_dac_nids,
15927 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15928 .channel_mode = alc662_3ST_6ch_modes,
15929 .input_mux = &alc662_lenovo_101e_capture_source,
15930 .unsol_event = alc662_eeepc_ep20_unsol_event,
15931 .init_hook = alc662_eeepc_ep20_inithook,
15934 .mixers = { alc662_ecs_mixer, alc662_capture_mixer },
15935 .init_verbs = { alc662_init_verbs,
15936 alc662_ecs_init_verbs },
15937 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15938 .dac_nids = alc662_dac_nids,
15939 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15940 .channel_mode = alc662_3ST_2ch_modes,
15941 .input_mux = &alc662_eeepc_capture_source,
15942 .unsol_event = alc662_eeepc_unsol_event,
15943 .init_hook = alc662_eeepc_inithook,
15945 [ALC663_ASUS_M51VA] = {
15946 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15947 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15948 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15949 .dac_nids = alc662_dac_nids,
15950 .dig_out_nid = ALC662_DIGOUT_NID,
15951 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15952 .channel_mode = alc662_3ST_2ch_modes,
15953 .input_mux = &alc663_m51va_capture_source,
15954 .unsol_event = alc663_m51va_unsol_event,
15955 .init_hook = alc663_m51va_inithook,
15957 [ALC663_ASUS_G71V] = {
15958 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
15959 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
15960 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15961 .dac_nids = alc662_dac_nids,
15962 .dig_out_nid = ALC662_DIGOUT_NID,
15963 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15964 .channel_mode = alc662_3ST_2ch_modes,
15965 .input_mux = &alc662_eeepc_capture_source,
15966 .unsol_event = alc663_g71v_unsol_event,
15967 .init_hook = alc663_g71v_inithook,
15969 [ALC663_ASUS_H13] = {
15970 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15971 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15972 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15973 .dac_nids = alc662_dac_nids,
15974 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15975 .channel_mode = alc662_3ST_2ch_modes,
15976 .input_mux = &alc663_m51va_capture_source,
15977 .unsol_event = alc663_m51va_unsol_event,
15978 .init_hook = alc663_m51va_inithook,
15980 [ALC663_ASUS_G50V] = {
15981 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
15982 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
15983 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15984 .dac_nids = alc662_dac_nids,
15985 .dig_out_nid = ALC662_DIGOUT_NID,
15986 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15987 .channel_mode = alc662_3ST_6ch_modes,
15988 .input_mux = &alc663_capture_source,
15989 .unsol_event = alc663_g50v_unsol_event,
15990 .init_hook = alc663_g50v_inithook,
15992 [ALC663_ASUS_MODE1] = {
15993 .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer },
15994 .init_verbs = { alc662_init_verbs,
15995 alc663_21jd_amic_init_verbs },
15996 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15998 .dac_nids = alc662_dac_nids,
15999 .dig_out_nid = ALC662_DIGOUT_NID,
16000 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16001 .channel_mode = alc662_3ST_2ch_modes,
16002 .input_mux = &alc662_eeepc_capture_source,
16003 .unsol_event = alc663_mode1_unsol_event,
16004 .init_hook = alc663_mode1_inithook,
16006 [ALC662_ASUS_MODE2] = {
16007 .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer },
16008 .init_verbs = { alc662_init_verbs,
16009 alc662_1bjd_amic_init_verbs },
16010 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16011 .dac_nids = alc662_dac_nids,
16012 .dig_out_nid = ALC662_DIGOUT_NID,
16013 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16014 .channel_mode = alc662_3ST_2ch_modes,
16015 .input_mux = &alc662_eeepc_capture_source,
16016 .unsol_event = alc662_mode2_unsol_event,
16017 .init_hook = alc662_mode2_inithook,
16019 [ALC663_ASUS_MODE3] = {
16020 .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer },
16021 .init_verbs = { alc662_init_verbs,
16022 alc663_two_hp_amic_m1_init_verbs },
16023 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16025 .dac_nids = alc662_dac_nids,
16026 .dig_out_nid = ALC662_DIGOUT_NID,
16027 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16028 .channel_mode = alc662_3ST_2ch_modes,
16029 .input_mux = &alc662_eeepc_capture_source,
16030 .unsol_event = alc663_mode3_unsol_event,
16031 .init_hook = alc663_mode3_inithook,
16033 [ALC663_ASUS_MODE4] = {
16034 .mixers = { alc663_asus_21jd_clfe_mixer,
16035 alc662_auto_capture_mixer},
16036 .init_verbs = { alc662_init_verbs,
16037 alc663_21jd_amic_init_verbs},
16038 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16040 .dac_nids = alc662_dac_nids,
16041 .dig_out_nid = ALC662_DIGOUT_NID,
16042 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16043 .channel_mode = alc662_3ST_2ch_modes,
16044 .input_mux = &alc662_eeepc_capture_source,
16045 .unsol_event = alc663_mode4_unsol_event,
16046 .init_hook = alc663_mode4_inithook,
16048 [ALC663_ASUS_MODE5] = {
16049 .mixers = { alc663_asus_15jd_clfe_mixer,
16050 alc662_auto_capture_mixer },
16051 .init_verbs = { alc662_init_verbs,
16052 alc663_15jd_amic_init_verbs },
16053 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16055 .dac_nids = alc662_dac_nids,
16056 .dig_out_nid = ALC662_DIGOUT_NID,
16057 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16058 .channel_mode = alc662_3ST_2ch_modes,
16059 .input_mux = &alc662_eeepc_capture_source,
16060 .unsol_event = alc663_mode5_unsol_event,
16061 .init_hook = alc663_mode5_inithook,
16063 [ALC663_ASUS_MODE6] = {
16064 .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer },
16065 .init_verbs = { alc662_init_verbs,
16066 alc663_two_hp_amic_m2_init_verbs },
16067 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16069 .dac_nids = alc662_dac_nids,
16070 .dig_out_nid = ALC662_DIGOUT_NID,
16071 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16072 .channel_mode = alc662_3ST_2ch_modes,
16073 .input_mux = &alc662_eeepc_capture_source,
16074 .unsol_event = alc663_mode6_unsol_event,
16075 .init_hook = alc663_mode6_inithook,
16081 * BIOS auto configuration
16084 /* add playback controls from the parsed DAC table */
16085 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16086 const struct auto_pin_cfg *cfg)
16089 static const char *chname[4] = {
16090 "Front", "Surround", NULL /*CLFE*/, "Side"
16095 for (i = 0; i < cfg->line_outs; i++) {
16096 if (!spec->multiout.dac_nids[i])
16098 nid = alc880_idx_to_dac(i);
16101 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16102 "Center Playback Volume",
16103 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16107 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16108 "LFE Playback Volume",
16109 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16113 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16114 "Center Playback Switch",
16115 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16119 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16120 "LFE Playback Switch",
16121 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16126 sprintf(name, "%s Playback Volume", chname[i]);
16127 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16128 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16132 sprintf(name, "%s Playback Switch", chname[i]);
16133 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16134 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16143 /* add playback controls for speaker and HP outputs */
16144 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16155 /* ALC663 has a mono output pin on 0x17 */
16156 sprintf(name, "%s Playback Switch", pfx);
16157 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16158 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16162 if (alc880_is_fixed_pin(pin)) {
16163 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16164 /* printk("DAC nid=%x\n",nid); */
16165 /* specify the DAC as the extra output */
16166 if (!spec->multiout.hp_nid)
16167 spec->multiout.hp_nid = nid;
16169 spec->multiout.extra_out_nid[0] = nid;
16170 /* control HP volume/switch on the output mixer amp */
16171 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16172 sprintf(name, "%s Playback Volume", pfx);
16173 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16174 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16177 sprintf(name, "%s Playback Switch", pfx);
16178 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16179 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16182 } else if (alc880_is_multi_pin(pin)) {
16183 /* set manual connection */
16184 /* we have only a switch on HP-out PIN */
16185 sprintf(name, "%s Playback Switch", pfx);
16186 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16187 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16194 /* create playback/capture controls for input pins */
16195 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16196 const struct auto_pin_cfg *cfg)
16198 struct hda_input_mux *imux = &spec->private_imux;
16201 for (i = 0; i < AUTO_PIN_LAST; i++) {
16202 if (alc880_is_input_pin(cfg->input_pins[i])) {
16203 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16204 err = new_analog_input(spec, cfg->input_pins[i],
16205 auto_pin_cfg_labels[i],
16209 imux->items[imux->num_items].label =
16210 auto_pin_cfg_labels[i];
16211 imux->items[imux->num_items].index =
16212 alc880_input_pin_idx(cfg->input_pins[i]);
16219 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16220 hda_nid_t nid, int pin_type,
16223 alc_set_pin_output(codec, nid, pin_type);
16224 /* need the manual connection? */
16225 if (alc880_is_multi_pin(nid)) {
16226 struct alc_spec *spec = codec->spec;
16227 int idx = alc880_multi_pin_idx(nid);
16228 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16229 AC_VERB_SET_CONNECT_SEL,
16230 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16234 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16236 struct alc_spec *spec = codec->spec;
16239 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16240 for (i = 0; i <= HDA_SIDE; i++) {
16241 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16242 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16244 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16249 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16251 struct alc_spec *spec = codec->spec;
16254 pin = spec->autocfg.hp_pins[0];
16255 if (pin) /* connect to front */
16257 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16258 pin = spec->autocfg.speaker_pins[0];
16260 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16263 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16264 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16266 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16268 struct alc_spec *spec = codec->spec;
16271 for (i = 0; i < AUTO_PIN_LAST; i++) {
16272 hda_nid_t nid = spec->autocfg.input_pins[i];
16273 if (alc662_is_input_pin(nid)) {
16274 snd_hda_codec_write(codec, nid, 0,
16275 AC_VERB_SET_PIN_WIDGET_CONTROL,
16276 (i <= AUTO_PIN_FRONT_MIC ?
16277 PIN_VREF80 : PIN_IN));
16278 if (nid != ALC662_PIN_CD_NID)
16279 snd_hda_codec_write(codec, nid, 0,
16280 AC_VERB_SET_AMP_GAIN_MUTE,
16286 #define alc662_auto_init_input_src alc882_auto_init_input_src
16288 static int alc662_parse_auto_config(struct hda_codec *codec)
16290 struct alc_spec *spec = codec->spec;
16292 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16294 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16298 if (!spec->autocfg.line_outs)
16299 return 0; /* can't find valid BIOS pin config */
16301 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16304 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16307 err = alc662_auto_create_extra_out(spec,
16308 spec->autocfg.speaker_pins[0],
16312 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16316 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16320 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16322 if (spec->autocfg.dig_out_pin)
16323 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16325 if (spec->kctl_alloc)
16326 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
16328 spec->num_mux_defs = 1;
16329 spec->input_mux = &spec->private_imux;
16331 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
16332 if (codec->vendor_id == 0x10ec0663)
16333 spec->init_verbs[spec->num_init_verbs++] =
16334 alc663_auto_init_verbs;
16336 err = alc_auto_add_mic_boost(codec);
16340 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
16341 spec->num_mixers++;
16343 store_pin_configs(codec);
16347 /* additional initialization for auto-configuration model */
16348 static void alc662_auto_init(struct hda_codec *codec)
16350 struct alc_spec *spec = codec->spec;
16351 alc662_auto_init_multi_out(codec);
16352 alc662_auto_init_hp_out(codec);
16353 alc662_auto_init_analog_input(codec);
16354 alc662_auto_init_input_src(codec);
16355 if (spec->unsol_event)
16356 alc_inithook(codec);
16359 static int patch_alc662(struct hda_codec *codec)
16361 struct alc_spec *spec;
16362 int err, board_config;
16364 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16368 codec->spec = spec;
16370 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16372 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16375 if (board_config < 0) {
16376 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16377 "trying auto-probe from BIOS...\n");
16378 board_config = ALC662_AUTO;
16381 if (board_config == ALC662_AUTO) {
16382 /* automatic parse from the BIOS config */
16383 err = alc662_parse_auto_config(codec);
16389 "hda_codec: Cannot set up configuration "
16390 "from BIOS. Using base mode...\n");
16391 board_config = ALC662_3ST_2ch_DIG;
16395 if (board_config != ALC662_AUTO)
16396 setup_preset(spec, &alc662_presets[board_config]);
16398 if (codec->vendor_id == 0x10ec0663) {
16399 spec->stream_name_analog = "ALC663 Analog";
16400 spec->stream_name_digital = "ALC663 Digital";
16401 } else if (codec->vendor_id == 0x10ec0272) {
16402 spec->stream_name_analog = "ALC272 Analog";
16403 spec->stream_name_digital = "ALC272 Digital";
16405 spec->stream_name_analog = "ALC662 Analog";
16406 spec->stream_name_digital = "ALC662 Digital";
16409 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16410 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16412 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16413 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16415 spec->adc_nids = alc662_adc_nids;
16416 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16417 spec->capsrc_nids = alc662_capsrc_nids;
16419 spec->vmaster_nid = 0x02;
16421 codec->patch_ops = alc_patch_ops;
16422 if (board_config == ALC662_AUTO)
16423 spec->init_hook = alc662_auto_init;
16424 #ifdef CONFIG_SND_HDA_POWER_SAVE
16425 if (!spec->loopback.amplist)
16426 spec->loopback.amplist = alc662_loopbacks;
16435 struct hda_codec_preset snd_hda_preset_realtek[] = {
16436 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16437 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16438 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16439 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16440 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16441 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16442 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16443 .patch = patch_alc861 },
16444 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16445 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16446 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16447 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16448 .patch = patch_alc883 },
16449 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16450 .patch = patch_alc662 },
16451 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16452 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16453 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16454 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16455 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16456 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16457 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16458 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16459 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16460 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16461 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16462 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16463 .patch = patch_alc883 },
16464 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16465 {} /* terminator */