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 static void alc_mic_automute(struct hda_codec *codec)
834 struct alc_spec *spec = codec->spec;
835 unsigned int present;
836 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
837 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
838 unsigned int mix_nid = spec->capsrc_nids[0];
839 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
841 capsrc_idx_mic = mic_nid - 0x18;
842 capsrc_idx_fmic = fmic_nid - 0x18;
843 present = snd_hda_codec_read(codec, mic_nid, 0,
844 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
845 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
846 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
847 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
848 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
849 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
850 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
853 /* unsolicited event for HP jack sensing */
854 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
856 if (codec->vendor_id == 0x10ec0880)
860 if (res == ALC880_HP_EVENT)
861 alc_sku_automute(codec);
863 if (res == ALC880_MIC_EVENT)
864 alc_mic_automute(codec);
867 static void alc_inithook(struct hda_codec *codec)
869 alc_sku_automute(codec);
870 alc_mic_automute(codec);
873 /* additional initialization for ALC888 variants */
874 static void alc888_coef_init(struct hda_codec *codec)
878 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
879 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
880 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
881 if ((tmp & 0xf0) == 2)
883 snd_hda_codec_read(codec, 0x20, 0,
884 AC_VERB_SET_PROC_COEF, 0x830);
887 snd_hda_codec_read(codec, 0x20, 0,
888 AC_VERB_SET_PROC_COEF, 0x3030);
891 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
892 * 31 ~ 16 : Manufacture ID
894 * 7 ~ 0 : Assembly ID
895 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
897 static void alc_subsystem_id(struct hda_codec *codec,
898 unsigned int porta, unsigned int porte,
901 unsigned int ass, tmp, i;
903 struct alc_spec *spec = codec->spec;
905 ass = codec->subsystem_id & 0xffff;
906 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
910 * 31~30 : port conetcivity
913 * 19~16 : Check sum (15:1)
918 if (codec->vendor_id == 0x10ec0260)
920 ass = snd_hda_codec_read(codec, nid, 0,
921 AC_VERB_GET_CONFIG_DEFAULT, 0);
922 if (!(ass & 1) && !(ass & 0x100000))
924 if ((ass >> 30) != 1) /* no physical connection */
929 for (i = 1; i < 16; i++) {
933 if (((ass >> 16) & 0xf) != tmp)
939 * 2 : 0 --> Desktop, 1 --> Laptop
940 * 3~5 : External Amplifier control
943 tmp = (ass & 0x38) >> 3; /* external Amp control */
946 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
949 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
952 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
954 case 5: /* set EAPD output high */
955 switch (codec->vendor_id) {
957 snd_hda_codec_write(codec, 0x0f, 0,
958 AC_VERB_SET_EAPD_BTLENABLE, 2);
959 snd_hda_codec_write(codec, 0x10, 0,
960 AC_VERB_SET_EAPD_BTLENABLE, 2);
971 snd_hda_codec_write(codec, 0x14, 0,
972 AC_VERB_SET_EAPD_BTLENABLE, 2);
973 snd_hda_codec_write(codec, 0x15, 0,
974 AC_VERB_SET_EAPD_BTLENABLE, 2);
977 switch (codec->vendor_id) {
979 snd_hda_codec_write(codec, 0x1a, 0,
980 AC_VERB_SET_COEF_INDEX, 7);
981 tmp = snd_hda_codec_read(codec, 0x1a, 0,
982 AC_VERB_GET_PROC_COEF, 0);
983 snd_hda_codec_write(codec, 0x1a, 0,
984 AC_VERB_SET_COEF_INDEX, 7);
985 snd_hda_codec_write(codec, 0x1a, 0,
986 AC_VERB_SET_PROC_COEF,
995 snd_hda_codec_write(codec, 0x20, 0,
996 AC_VERB_SET_COEF_INDEX, 7);
997 tmp = snd_hda_codec_read(codec, 0x20, 0,
998 AC_VERB_GET_PROC_COEF, 0);
999 snd_hda_codec_write(codec, 0x20, 0,
1000 AC_VERB_SET_COEF_INDEX, 7);
1001 snd_hda_codec_write(codec, 0x20, 0,
1002 AC_VERB_SET_PROC_COEF,
1006 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1010 snd_hda_codec_write(codec, 0x20, 0,
1011 AC_VERB_SET_COEF_INDEX, 7);
1012 tmp = snd_hda_codec_read(codec, 0x20, 0,
1013 AC_VERB_GET_PROC_COEF, 0);
1014 snd_hda_codec_write(codec, 0x20, 0,
1015 AC_VERB_SET_COEF_INDEX, 7);
1016 snd_hda_codec_write(codec, 0x20, 0,
1017 AC_VERB_SET_PROC_COEF,
1025 /* is laptop or Desktop and enable the function "Mute internal speaker
1026 * when the external headphone out jack is plugged"
1028 if (!(ass & 0x8000))
1031 * 10~8 : Jack location
1032 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1034 * 15 : 1 --> enable the function "Mute internal speaker
1035 * when the external headphone out jack is plugged"
1037 if (!spec->autocfg.speaker_pins[0]) {
1038 if (spec->autocfg.line_out_pins[0])
1039 spec->autocfg.speaker_pins[0] =
1040 spec->autocfg.line_out_pins[0];
1045 if (!spec->autocfg.hp_pins[0]) {
1046 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1048 spec->autocfg.hp_pins[0] = porta;
1050 spec->autocfg.hp_pins[0] = porte;
1052 spec->autocfg.hp_pins[0] = portd;
1056 if (spec->autocfg.hp_pins[0])
1057 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1058 AC_VERB_SET_UNSOLICITED_ENABLE,
1059 AC_USRSP_EN | ALC880_HP_EVENT);
1061 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1062 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1063 snd_hda_codec_write(codec,
1064 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1065 AC_VERB_SET_UNSOLICITED_ENABLE,
1066 AC_USRSP_EN | ALC880_MIC_EVENT);
1068 spec->unsol_event = alc_sku_unsol_event;
1072 * Fix-up pin default configurations
1080 static void alc_fix_pincfg(struct hda_codec *codec,
1081 const struct snd_pci_quirk *quirk,
1082 const struct alc_pincfg **pinfix)
1084 const struct alc_pincfg *cfg;
1086 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1090 cfg = pinfix[quirk->value];
1091 for (; cfg->nid; cfg++) {
1094 for (i = 0; i < 4; i++) {
1095 snd_hda_codec_write(codec, cfg->nid, 0,
1096 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1104 * ALC880 3-stack model
1106 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1107 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1108 * F-Mic = 0x1b, HP = 0x19
1111 static hda_nid_t alc880_dac_nids[4] = {
1112 /* front, rear, clfe, rear_surr */
1113 0x02, 0x05, 0x04, 0x03
1116 static hda_nid_t alc880_adc_nids[3] = {
1121 /* The datasheet says the node 0x07 is connected from inputs,
1122 * but it shows zero connection in the real implementation on some devices.
1123 * Note: this is a 915GAV bug, fixed on 915GLV
1125 static hda_nid_t alc880_adc_nids_alt[2] = {
1130 #define ALC880_DIGOUT_NID 0x06
1131 #define ALC880_DIGIN_NID 0x0a
1133 static struct hda_input_mux alc880_capture_source = {
1137 { "Front Mic", 0x3 },
1143 /* channel source setting (2/6 channel selection for 3-stack) */
1145 static struct hda_verb alc880_threestack_ch2_init[] = {
1146 /* set line-in to input, mute it */
1147 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1148 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1149 /* set mic-in to input vref 80%, mute it */
1150 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1151 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1156 static struct hda_verb alc880_threestack_ch6_init[] = {
1157 /* set line-in to output, unmute it */
1158 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1159 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1160 /* set mic-in to output, unmute it */
1161 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1162 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1166 static struct hda_channel_mode alc880_threestack_modes[2] = {
1167 { 2, alc880_threestack_ch2_init },
1168 { 6, alc880_threestack_ch6_init },
1171 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1173 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1174 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1175 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1176 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1177 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1178 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1179 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1180 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1181 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1186 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1187 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1188 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1189 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1192 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1193 .name = "Channel Mode",
1194 .info = alc_ch_mode_info,
1195 .get = alc_ch_mode_get,
1196 .put = alc_ch_mode_put,
1201 /* capture mixer elements */
1202 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1203 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1204 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1205 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1206 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1207 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1208 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1210 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1211 /* The multiple "Capture Source" controls confuse alsamixer
1212 * So call somewhat different..
1214 /* .name = "Capture Source", */
1215 .name = "Input Source",
1217 .info = alc_mux_enum_info,
1218 .get = alc_mux_enum_get,
1219 .put = alc_mux_enum_put,
1224 /* capture mixer elements (in case NID 0x07 not available) */
1225 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1226 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1227 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1228 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1229 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1231 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1232 /* The multiple "Capture Source" controls confuse alsamixer
1233 * So call somewhat different..
1235 /* .name = "Capture Source", */
1236 .name = "Input Source",
1238 .info = alc_mux_enum_info,
1239 .get = alc_mux_enum_get,
1240 .put = alc_mux_enum_put,
1248 * ALC880 5-stack model
1250 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1252 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1253 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1256 /* additional mixers to alc880_three_stack_mixer */
1257 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1258 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1259 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1263 /* channel source setting (6/8 channel selection for 5-stack) */
1265 static struct hda_verb alc880_fivestack_ch6_init[] = {
1266 /* set line-in to input, mute it */
1267 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1268 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1273 static struct hda_verb alc880_fivestack_ch8_init[] = {
1274 /* set line-in to output, unmute it */
1275 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1276 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1280 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1281 { 6, alc880_fivestack_ch6_init },
1282 { 8, alc880_fivestack_ch8_init },
1287 * ALC880 6-stack model
1289 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1290 * Side = 0x05 (0x0f)
1291 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1292 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1295 static hda_nid_t alc880_6st_dac_nids[4] = {
1296 /* front, rear, clfe, rear_surr */
1297 0x02, 0x03, 0x04, 0x05
1300 static struct hda_input_mux alc880_6stack_capture_source = {
1304 { "Front Mic", 0x1 },
1310 /* fixed 8-channels */
1311 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1315 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1316 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1317 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1318 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1319 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1320 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1321 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1322 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1323 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1324 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1325 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1326 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1327 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1328 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1329 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1330 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1332 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1333 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1334 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1335 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1337 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1338 .name = "Channel Mode",
1339 .info = alc_ch_mode_info,
1340 .get = alc_ch_mode_get,
1341 .put = alc_ch_mode_put,
1350 * W810 has rear IO for:
1353 * Center/LFE (DAC 04)
1356 * The system also has a pair of internal speakers, and a headphone jack.
1357 * These are both connected to Line2 on the codec, hence to DAC 02.
1359 * There is a variable resistor to control the speaker or headphone
1360 * volume. This is a hardware-only device without a software API.
1362 * Plugging headphones in will disable the internal speakers. This is
1363 * implemented in hardware, not via the driver using jack sense. In
1364 * a similar fashion, plugging into the rear socket marked "front" will
1365 * disable both the speakers and headphones.
1367 * For input, there's a microphone jack, and an "audio in" jack.
1368 * These may not do anything useful with this driver yet, because I
1369 * haven't setup any initialization verbs for these yet...
1372 static hda_nid_t alc880_w810_dac_nids[3] = {
1373 /* front, rear/surround, clfe */
1377 /* fixed 6 channels */
1378 static struct hda_channel_mode alc880_w810_modes[1] = {
1382 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1383 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1384 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1385 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1386 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1387 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1388 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1389 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1390 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1391 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1392 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1400 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1401 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1405 static hda_nid_t alc880_z71v_dac_nids[1] = {
1408 #define ALC880_Z71V_HP_DAC 0x03
1410 /* fixed 2 channels */
1411 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1415 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1417 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1418 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1419 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1420 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1421 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1429 * ALC880 F1734 model
1431 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1432 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1435 static hda_nid_t alc880_f1734_dac_nids[1] = {
1438 #define ALC880_F1734_HP_DAC 0x02
1440 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1441 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1442 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1443 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1444 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1445 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1446 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1448 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1452 static struct hda_input_mux alc880_f1734_capture_source = {
1464 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1465 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1466 * Mic = 0x18, Line = 0x1a
1469 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1470 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1472 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1473 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1474 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1475 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1476 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1477 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1478 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1479 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1480 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1481 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1482 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1483 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1484 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1489 .name = "Channel Mode",
1490 .info = alc_ch_mode_info,
1491 .get = alc_ch_mode_get,
1492 .put = alc_ch_mode_put,
1498 * ALC880 ASUS W1V model
1500 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1501 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1502 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1505 /* additional mixers to alc880_asus_mixer */
1506 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1507 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1508 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1512 /* additional mixers to alc880_asus_mixer */
1513 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1514 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1515 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1520 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1521 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1522 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1523 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1524 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1525 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1526 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1527 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1528 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1529 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1531 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1532 /* The multiple "Capture Source" controls confuse alsamixer
1533 * So call somewhat different..
1535 /* .name = "Capture Source", */
1536 .name = "Input Source",
1538 .info = alc_mux_enum_info,
1539 .get = alc_mux_enum_get,
1540 .put = alc_mux_enum_put,
1546 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1547 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1548 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1549 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1550 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1551 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1552 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1553 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1554 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1555 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1556 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1557 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1558 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1560 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1561 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1562 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1563 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1564 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1566 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1567 .name = "Channel Mode",
1568 .info = alc_ch_mode_info,
1569 .get = alc_ch_mode_get,
1570 .put = alc_ch_mode_put,
1575 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1576 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1577 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1578 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1579 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1580 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1581 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1582 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1583 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1584 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1585 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1589 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1590 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1591 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1592 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1593 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1600 * virtual master controls
1604 * slave controls for virtual master
1606 static const char *alc_slave_vols[] = {
1607 "Front Playback Volume",
1608 "Surround Playback Volume",
1609 "Center Playback Volume",
1610 "LFE Playback Volume",
1611 "Side Playback Volume",
1612 "Headphone Playback Volume",
1613 "Speaker Playback Volume",
1614 "Mono Playback Volume",
1615 "Line-Out Playback Volume",
1619 static const char *alc_slave_sws[] = {
1620 "Front Playback Switch",
1621 "Surround Playback Switch",
1622 "Center Playback Switch",
1623 "LFE Playback Switch",
1624 "Side Playback Switch",
1625 "Headphone Playback Switch",
1626 "Speaker Playback Switch",
1627 "Mono Playback Switch",
1628 "IEC958 Playback Switch",
1633 * build control elements
1635 static int alc_build_controls(struct hda_codec *codec)
1637 struct alc_spec *spec = codec->spec;
1641 for (i = 0; i < spec->num_mixers; i++) {
1642 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1647 if (spec->multiout.dig_out_nid) {
1648 err = snd_hda_create_spdif_out_ctls(codec,
1649 spec->multiout.dig_out_nid);
1652 err = snd_hda_create_spdif_share_sw(codec,
1656 spec->multiout.share_spdif = 1;
1658 if (spec->dig_in_nid) {
1659 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1664 /* if we have no master control, let's create it */
1665 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1666 unsigned int vmaster_tlv[4];
1667 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1668 HDA_OUTPUT, vmaster_tlv);
1669 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1670 vmaster_tlv, alc_slave_vols);
1674 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1675 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1676 NULL, alc_slave_sws);
1686 * initialize the codec volumes, etc
1690 * generic initialization of ADC, input mixers and output mixers
1692 static struct hda_verb alc880_volume_init_verbs[] = {
1694 * Unmute ADC0-2 and set the default input to mic-in
1696 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1698 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1700 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1703 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1705 * Note: PASD motherboards uses the Line In 2 as the input for front
1708 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1718 * Set up output mixers (0x0c - 0x0f)
1720 /* set vol=0 to output mixers */
1721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1722 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1723 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1724 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1725 /* set up input amps for analog loopback */
1726 /* Amp Indices: DAC = 0, mixer = 1 */
1727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1729 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1730 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1731 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1732 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1733 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1734 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1740 * 3-stack pin configuration:
1741 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1743 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1745 * preset connection lists of input pins
1746 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1748 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1749 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1750 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1753 * Set pin mode and muting
1755 /* set front pin widgets 0x14 for output */
1756 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1757 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1758 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1759 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1761 /* Mic2 (as headphone out) for HP output */
1762 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1763 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1764 /* Line In pin widget for input */
1765 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1767 /* Line2 (as front mic) pin widget for input and vref at 80% */
1768 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1769 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1770 /* CD pin widget for input */
1771 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1777 * 5-stack pin configuration:
1778 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1779 * line-in/side = 0x1a, f-mic = 0x1b
1781 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1783 * preset connection lists of input pins
1784 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1786 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1787 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1790 * Set pin mode and muting
1792 /* set pin widgets 0x14-0x17 for output */
1793 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1794 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1795 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1796 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1797 /* unmute pins for output (no gain on this amp) */
1798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1800 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1801 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1803 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1804 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1805 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1806 /* Mic2 (as headphone out) for HP output */
1807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1809 /* Line In pin widget for input */
1810 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1811 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1812 /* Line2 (as front mic) pin widget for input and vref at 80% */
1813 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1814 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1815 /* CD pin widget for input */
1816 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1822 * W810 pin configuration:
1823 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1825 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1826 /* hphone/speaker input selector: front DAC */
1827 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1830 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1831 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1834 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1836 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1837 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1843 * Z71V pin configuration:
1844 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1846 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1847 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1848 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1849 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1850 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1853 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1854 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1855 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1861 * 6-stack pin configuration:
1862 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1863 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1865 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1866 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1869 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1872 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1873 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1874 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1875 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1877 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1878 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1879 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1880 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1881 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1883 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1884 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1885 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1891 * Uniwill pin configuration:
1892 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1895 static struct hda_verb alc880_uniwill_init_verbs[] = {
1896 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1898 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1899 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1901 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1903 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1904 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1905 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1906 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1910 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1913 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1914 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1915 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1916 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1917 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1918 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1919 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1920 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1921 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1923 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1924 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1931 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1933 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1934 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1936 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1937 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1940 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1942 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1944 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1945 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1946 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1947 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1949 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1950 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1951 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1952 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1956 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1957 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1962 static struct hda_verb alc880_beep_init_verbs[] = {
1963 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1967 /* toggle speaker-output according to the hp-jack state */
1968 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1970 unsigned int present;
1973 present = snd_hda_codec_read(codec, 0x14, 0,
1974 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1975 bits = present ? HDA_AMP_MUTE : 0;
1976 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1977 HDA_AMP_MUTE, bits);
1978 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1979 HDA_AMP_MUTE, bits);
1982 /* auto-toggle front mic */
1983 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1985 unsigned int present;
1988 present = snd_hda_codec_read(codec, 0x18, 0,
1989 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1990 bits = present ? HDA_AMP_MUTE : 0;
1991 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1994 static void alc880_uniwill_automute(struct hda_codec *codec)
1996 alc880_uniwill_hp_automute(codec);
1997 alc880_uniwill_mic_automute(codec);
2000 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2003 /* Looks like the unsol event is incompatible with the standard
2004 * definition. 4bit tag is placed at 28 bit!
2006 switch (res >> 28) {
2007 case ALC880_HP_EVENT:
2008 alc880_uniwill_hp_automute(codec);
2010 case ALC880_MIC_EVENT:
2011 alc880_uniwill_mic_automute(codec);
2016 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2018 unsigned int present;
2021 present = snd_hda_codec_read(codec, 0x14, 0,
2022 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2023 bits = present ? HDA_AMP_MUTE : 0;
2024 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2027 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2029 unsigned int present;
2031 present = snd_hda_codec_read(codec, 0x21, 0,
2032 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2033 present &= HDA_AMP_VOLMASK;
2034 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2035 HDA_AMP_VOLMASK, present);
2036 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2037 HDA_AMP_VOLMASK, present);
2040 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2043 /* Looks like the unsol event is incompatible with the standard
2044 * definition. 4bit tag is placed at 28 bit!
2046 if ((res >> 28) == ALC880_HP_EVENT)
2047 alc880_uniwill_p53_hp_automute(codec);
2048 if ((res >> 28) == ALC880_DCVOL_EVENT)
2049 alc880_uniwill_p53_dcvol_automute(codec);
2053 * F1734 pin configuration:
2054 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2056 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2057 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2058 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2059 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2060 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2061 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2063 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2064 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2068 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2072 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2073 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2074 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2075 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2076 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2078 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2079 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2085 * ASUS pin configuration:
2086 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2088 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2089 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2090 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2091 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2092 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2095 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2096 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2097 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2098 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2099 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2100 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2101 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2103 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2104 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2105 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2107 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2108 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2109 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2110 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2111 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2116 /* Enable GPIO mask and set output */
2117 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2118 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2120 /* Clevo m520g init */
2121 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2122 /* headphone output */
2123 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2126 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2128 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2129 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2131 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2132 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2133 /* Mic1 (rear panel) */
2134 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2135 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2136 /* Mic2 (front panel) */
2137 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2138 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2140 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2142 /* change to EAPD mode */
2143 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2144 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2149 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2150 /* change to EAPD mode */
2151 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2152 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2154 /* Headphone output */
2155 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2158 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2160 /* Line In pin widget for input */
2161 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2162 /* CD pin widget for input */
2163 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2164 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2165 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2167 /* change to EAPD mode */
2168 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2169 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2175 * LG m1 express dual
2178 * Rear Line-In/Out (blue): 0x14
2179 * Build-in Mic-In: 0x15
2181 * HP-Out (green): 0x1b
2182 * Mic-In/Out (red): 0x19
2186 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2187 static hda_nid_t alc880_lg_dac_nids[3] = {
2191 /* seems analog CD is not working */
2192 static struct hda_input_mux alc880_lg_capture_source = {
2197 { "Internal Mic", 0x6 },
2201 /* 2,4,6 channel modes */
2202 static struct hda_verb alc880_lg_ch2_init[] = {
2203 /* set line-in and mic-in to input */
2204 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2205 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2209 static struct hda_verb alc880_lg_ch4_init[] = {
2210 /* set line-in to out and mic-in to input */
2211 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2212 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2216 static struct hda_verb alc880_lg_ch6_init[] = {
2217 /* set line-in and mic-in to output */
2218 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2219 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2223 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2224 { 2, alc880_lg_ch2_init },
2225 { 4, alc880_lg_ch4_init },
2226 { 6, alc880_lg_ch6_init },
2229 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2230 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2231 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2232 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2233 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2234 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2235 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2236 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2237 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2240 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2241 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2242 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2243 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2245 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2246 .name = "Channel Mode",
2247 .info = alc_ch_mode_info,
2248 .get = alc_ch_mode_get,
2249 .put = alc_ch_mode_put,
2254 static struct hda_verb alc880_lg_init_verbs[] = {
2255 /* set capture source to mic-in */
2256 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2257 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2258 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2259 /* mute all amp mixer inputs */
2260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2263 /* line-in to input */
2264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2265 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2267 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2268 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2270 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2271 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2272 /* mic-in to input */
2273 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2274 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2275 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2277 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2281 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2285 /* toggle speaker-output according to the hp-jack state */
2286 static void alc880_lg_automute(struct hda_codec *codec)
2288 unsigned int present;
2291 present = snd_hda_codec_read(codec, 0x1b, 0,
2292 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2293 bits = present ? HDA_AMP_MUTE : 0;
2294 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2295 HDA_AMP_MUTE, bits);
2298 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2300 /* Looks like the unsol event is incompatible with the standard
2301 * definition. 4bit tag is placed at 28 bit!
2303 if ((res >> 28) == 0x01)
2304 alc880_lg_automute(codec);
2313 * Built-in Mic-In: 0x19
2319 static struct hda_input_mux alc880_lg_lw_capture_source = {
2323 { "Internal Mic", 0x1 },
2328 #define alc880_lg_lw_modes alc880_threestack_modes
2330 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2331 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2332 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2334 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2336 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2337 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2338 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2340 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2342 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2343 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2344 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2346 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2347 .name = "Channel Mode",
2348 .info = alc_ch_mode_info,
2349 .get = alc_ch_mode_get,
2350 .put = alc_ch_mode_put,
2355 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2356 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2357 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2358 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2360 /* set capture source to mic-in */
2361 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2362 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2364 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2367 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2369 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2370 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2371 /* mic-in to input */
2372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2373 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2375 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2378 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2382 /* toggle speaker-output according to the hp-jack state */
2383 static void alc880_lg_lw_automute(struct hda_codec *codec)
2385 unsigned int present;
2388 present = snd_hda_codec_read(codec, 0x1b, 0,
2389 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2390 bits = present ? HDA_AMP_MUTE : 0;
2391 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2392 HDA_AMP_MUTE, bits);
2395 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2397 /* Looks like the unsol event is incompatible with the standard
2398 * definition. 4bit tag is placed at 28 bit!
2400 if ((res >> 28) == 0x01)
2401 alc880_lg_lw_automute(codec);
2404 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2405 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2406 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2407 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2408 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2409 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2410 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2414 static struct hda_input_mux alc880_medion_rim_capture_source = {
2418 { "Internal Mic", 0x1 },
2422 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2423 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2426 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2428 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2431 /* Mic2 (as headphone out) for HP output */
2432 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2433 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2434 /* Internal Speaker */
2435 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2436 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2438 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2439 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2441 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2445 /* toggle speaker-output according to the hp-jack state */
2446 static void alc880_medion_rim_automute(struct hda_codec *codec)
2448 unsigned int present;
2451 present = snd_hda_codec_read(codec, 0x14, 0,
2452 AC_VERB_GET_PIN_SENSE, 0)
2453 & AC_PINSENSE_PRESENCE;
2454 bits = present ? HDA_AMP_MUTE : 0;
2455 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2456 HDA_AMP_MUTE, bits);
2458 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2460 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2463 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2466 /* Looks like the unsol event is incompatible with the standard
2467 * definition. 4bit tag is placed at 28 bit!
2469 if ((res >> 28) == ALC880_HP_EVENT)
2470 alc880_medion_rim_automute(codec);
2473 #ifdef CONFIG_SND_HDA_POWER_SAVE
2474 static struct hda_amp_list alc880_loopbacks[] = {
2475 { 0x0b, HDA_INPUT, 0 },
2476 { 0x0b, HDA_INPUT, 1 },
2477 { 0x0b, HDA_INPUT, 2 },
2478 { 0x0b, HDA_INPUT, 3 },
2479 { 0x0b, HDA_INPUT, 4 },
2483 static struct hda_amp_list alc880_lg_loopbacks[] = {
2484 { 0x0b, HDA_INPUT, 1 },
2485 { 0x0b, HDA_INPUT, 6 },
2486 { 0x0b, HDA_INPUT, 7 },
2495 static int alc_init(struct hda_codec *codec)
2497 struct alc_spec *spec = codec->spec;
2501 if (codec->vendor_id == 0x10ec0888)
2502 alc888_coef_init(codec);
2504 for (i = 0; i < spec->num_init_verbs; i++)
2505 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2507 if (spec->init_hook)
2508 spec->init_hook(codec);
2513 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2515 struct alc_spec *spec = codec->spec;
2517 if (spec->unsol_event)
2518 spec->unsol_event(codec, res);
2521 #ifdef CONFIG_SND_HDA_POWER_SAVE
2522 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2524 struct alc_spec *spec = codec->spec;
2525 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2530 * Analog playback callbacks
2532 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2533 struct hda_codec *codec,
2534 struct snd_pcm_substream *substream)
2536 struct alc_spec *spec = codec->spec;
2537 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2541 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2542 struct hda_codec *codec,
2543 unsigned int stream_tag,
2544 unsigned int format,
2545 struct snd_pcm_substream *substream)
2547 struct alc_spec *spec = codec->spec;
2548 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2549 stream_tag, format, substream);
2552 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2553 struct hda_codec *codec,
2554 struct snd_pcm_substream *substream)
2556 struct alc_spec *spec = codec->spec;
2557 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2563 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2564 struct hda_codec *codec,
2565 struct snd_pcm_substream *substream)
2567 struct alc_spec *spec = codec->spec;
2568 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2571 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2572 struct hda_codec *codec,
2573 unsigned int stream_tag,
2574 unsigned int format,
2575 struct snd_pcm_substream *substream)
2577 struct alc_spec *spec = codec->spec;
2578 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2579 stream_tag, format, substream);
2582 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2583 struct hda_codec *codec,
2584 struct snd_pcm_substream *substream)
2586 struct alc_spec *spec = codec->spec;
2587 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2593 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2594 struct hda_codec *codec,
2595 unsigned int stream_tag,
2596 unsigned int format,
2597 struct snd_pcm_substream *substream)
2599 struct alc_spec *spec = codec->spec;
2601 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2602 stream_tag, 0, format);
2606 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2607 struct hda_codec *codec,
2608 struct snd_pcm_substream *substream)
2610 struct alc_spec *spec = codec->spec;
2612 snd_hda_codec_cleanup_stream(codec,
2613 spec->adc_nids[substream->number + 1]);
2620 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2624 /* NID is set in alc_build_pcms */
2626 .open = alc880_playback_pcm_open,
2627 .prepare = alc880_playback_pcm_prepare,
2628 .cleanup = alc880_playback_pcm_cleanup
2632 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2636 /* NID is set in alc_build_pcms */
2639 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2643 /* NID is set in alc_build_pcms */
2646 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2647 .substreams = 2, /* can be overridden */
2650 /* NID is set in alc_build_pcms */
2652 .prepare = alc880_alt_capture_pcm_prepare,
2653 .cleanup = alc880_alt_capture_pcm_cleanup
2657 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2661 /* NID is set in alc_build_pcms */
2663 .open = alc880_dig_playback_pcm_open,
2664 .close = alc880_dig_playback_pcm_close,
2665 .prepare = alc880_dig_playback_pcm_prepare
2669 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2673 /* NID is set in alc_build_pcms */
2676 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2677 static struct hda_pcm_stream alc_pcm_null_stream = {
2683 static int alc_build_pcms(struct hda_codec *codec)
2685 struct alc_spec *spec = codec->spec;
2686 struct hda_pcm *info = spec->pcm_rec;
2689 codec->num_pcms = 1;
2690 codec->pcm_info = info;
2692 info->name = spec->stream_name_analog;
2693 if (spec->stream_analog_playback) {
2694 if (snd_BUG_ON(!spec->multiout.dac_nids))
2696 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2697 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2699 if (spec->stream_analog_capture) {
2700 if (snd_BUG_ON(!spec->adc_nids))
2702 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2703 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2706 if (spec->channel_mode) {
2707 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2708 for (i = 0; i < spec->num_channel_mode; i++) {
2709 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2710 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2715 /* SPDIF for stream index #1 */
2716 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2717 codec->num_pcms = 2;
2718 info = spec->pcm_rec + 1;
2719 info->name = spec->stream_name_digital;
2720 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2721 if (spec->multiout.dig_out_nid &&
2722 spec->stream_digital_playback) {
2723 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2724 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2726 if (spec->dig_in_nid &&
2727 spec->stream_digital_capture) {
2728 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2729 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2731 /* FIXME: do we need this for all Realtek codec models? */
2732 codec->spdif_status_reset = 1;
2735 /* If the use of more than one ADC is requested for the current
2736 * model, configure a second analog capture-only PCM.
2738 /* Additional Analaog capture for index #2 */
2739 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2740 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2741 codec->num_pcms = 3;
2742 info = spec->pcm_rec + 2;
2743 info->name = spec->stream_name_analog;
2744 if (spec->alt_dac_nid) {
2745 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2746 *spec->stream_analog_alt_playback;
2747 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2750 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2751 alc_pcm_null_stream;
2752 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2754 if (spec->num_adc_nids > 1) {
2755 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2756 *spec->stream_analog_alt_capture;
2757 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2759 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2760 spec->num_adc_nids - 1;
2762 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2763 alc_pcm_null_stream;
2764 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2771 static void alc_free(struct hda_codec *codec)
2773 struct alc_spec *spec = codec->spec;
2779 if (spec->kctl_alloc) {
2780 for (i = 0; i < spec->num_kctl_used; i++)
2781 kfree(spec->kctl_alloc[i].name);
2782 kfree(spec->kctl_alloc);
2785 codec->spec = NULL; /* to be sure */
2788 #ifdef SND_HDA_NEEDS_RESUME
2789 static void store_pin_configs(struct hda_codec *codec)
2791 struct alc_spec *spec = codec->spec;
2792 hda_nid_t nid, end_nid;
2794 end_nid = codec->start_nid + codec->num_nodes;
2795 for (nid = codec->start_nid; nid < end_nid; nid++) {
2796 unsigned int wid_caps = get_wcaps(codec, nid);
2797 unsigned int wid_type =
2798 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2799 if (wid_type != AC_WID_PIN)
2801 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
2803 spec->pin_nids[spec->num_pins] = nid;
2804 spec->pin_cfgs[spec->num_pins] =
2805 snd_hda_codec_read(codec, nid, 0,
2806 AC_VERB_GET_CONFIG_DEFAULT, 0);
2811 static void resume_pin_configs(struct hda_codec *codec)
2813 struct alc_spec *spec = codec->spec;
2816 for (i = 0; i < spec->num_pins; i++) {
2817 hda_nid_t pin_nid = spec->pin_nids[i];
2818 unsigned int pin_config = spec->pin_cfgs[i];
2819 snd_hda_codec_write(codec, pin_nid, 0,
2820 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2821 pin_config & 0x000000ff);
2822 snd_hda_codec_write(codec, pin_nid, 0,
2823 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2824 (pin_config & 0x0000ff00) >> 8);
2825 snd_hda_codec_write(codec, pin_nid, 0,
2826 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2827 (pin_config & 0x00ff0000) >> 16);
2828 snd_hda_codec_write(codec, pin_nid, 0,
2829 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2834 static int alc_resume(struct hda_codec *codec)
2836 resume_pin_configs(codec);
2837 codec->patch_ops.init(codec);
2838 snd_hda_codec_resume_amp(codec);
2839 snd_hda_codec_resume_cache(codec);
2843 #define store_pin_configs(codec)
2848 static struct hda_codec_ops alc_patch_ops = {
2849 .build_controls = alc_build_controls,
2850 .build_pcms = alc_build_pcms,
2853 .unsol_event = alc_unsol_event,
2854 #ifdef SND_HDA_NEEDS_RESUME
2855 .resume = alc_resume,
2857 #ifdef CONFIG_SND_HDA_POWER_SAVE
2858 .check_power_status = alc_check_power_status,
2864 * Test configuration for debugging
2866 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2869 #ifdef CONFIG_SND_DEBUG
2870 static hda_nid_t alc880_test_dac_nids[4] = {
2871 0x02, 0x03, 0x04, 0x05
2874 static struct hda_input_mux alc880_test_capture_source = {
2883 { "Surround", 0x6 },
2887 static struct hda_channel_mode alc880_test_modes[4] = {
2894 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2895 struct snd_ctl_elem_info *uinfo)
2897 static char *texts[] = {
2898 "N/A", "Line Out", "HP Out",
2899 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2901 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2903 uinfo->value.enumerated.items = 8;
2904 if (uinfo->value.enumerated.item >= 8)
2905 uinfo->value.enumerated.item = 7;
2906 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2910 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2911 struct snd_ctl_elem_value *ucontrol)
2913 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2914 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2915 unsigned int pin_ctl, item = 0;
2917 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2918 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2919 if (pin_ctl & AC_PINCTL_OUT_EN) {
2920 if (pin_ctl & AC_PINCTL_HP_EN)
2924 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2925 switch (pin_ctl & AC_PINCTL_VREFEN) {
2926 case AC_PINCTL_VREF_HIZ: item = 3; break;
2927 case AC_PINCTL_VREF_50: item = 4; break;
2928 case AC_PINCTL_VREF_GRD: item = 5; break;
2929 case AC_PINCTL_VREF_80: item = 6; break;
2930 case AC_PINCTL_VREF_100: item = 7; break;
2933 ucontrol->value.enumerated.item[0] = item;
2937 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2938 struct snd_ctl_elem_value *ucontrol)
2940 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2941 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2942 static unsigned int ctls[] = {
2943 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2944 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2945 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2946 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2947 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2948 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2950 unsigned int old_ctl, new_ctl;
2952 old_ctl = snd_hda_codec_read(codec, nid, 0,
2953 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2954 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2955 if (old_ctl != new_ctl) {
2957 snd_hda_codec_write_cache(codec, nid, 0,
2958 AC_VERB_SET_PIN_WIDGET_CONTROL,
2960 val = ucontrol->value.enumerated.item[0] >= 3 ?
2962 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2969 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2970 struct snd_ctl_elem_info *uinfo)
2972 static char *texts[] = {
2973 "Front", "Surround", "CLFE", "Side"
2975 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2977 uinfo->value.enumerated.items = 4;
2978 if (uinfo->value.enumerated.item >= 4)
2979 uinfo->value.enumerated.item = 3;
2980 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2984 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2985 struct snd_ctl_elem_value *ucontrol)
2987 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2988 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2991 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2992 ucontrol->value.enumerated.item[0] = sel & 3;
2996 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2997 struct snd_ctl_elem_value *ucontrol)
2999 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3000 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3003 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3004 if (ucontrol->value.enumerated.item[0] != sel) {
3005 sel = ucontrol->value.enumerated.item[0] & 3;
3006 snd_hda_codec_write_cache(codec, nid, 0,
3007 AC_VERB_SET_CONNECT_SEL, sel);
3013 #define PIN_CTL_TEST(xname,nid) { \
3014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3016 .info = alc_test_pin_ctl_info, \
3017 .get = alc_test_pin_ctl_get, \
3018 .put = alc_test_pin_ctl_put, \
3019 .private_value = nid \
3022 #define PIN_SRC_TEST(xname,nid) { \
3023 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3025 .info = alc_test_pin_src_info, \
3026 .get = alc_test_pin_src_get, \
3027 .put = alc_test_pin_src_put, \
3028 .private_value = nid \
3031 static struct snd_kcontrol_new alc880_test_mixer[] = {
3032 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3033 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3034 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3035 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3036 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3037 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3038 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3039 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3040 PIN_CTL_TEST("Front Pin Mode", 0x14),
3041 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3042 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3043 PIN_CTL_TEST("Side Pin Mode", 0x17),
3044 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3045 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3046 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3047 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3048 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3049 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3050 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3051 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3052 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3053 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3054 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3055 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3056 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3057 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3058 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3059 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3060 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3061 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3063 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3064 .name = "Channel Mode",
3065 .info = alc_ch_mode_info,
3066 .get = alc_ch_mode_get,
3067 .put = alc_ch_mode_put,
3072 static struct hda_verb alc880_test_init_verbs[] = {
3073 /* Unmute inputs of 0x0c - 0x0f */
3074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3076 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3079 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3080 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3082 /* Vol output for 0x0c-0x0f */
3083 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3084 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3085 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3086 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3087 /* Set output pins 0x14-0x17 */
3088 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3089 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3090 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3091 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3092 /* Unmute output pins 0x14-0x17 */
3093 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3094 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3095 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3096 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3097 /* Set input pins 0x18-0x1c */
3098 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3099 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3100 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3101 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3102 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3103 /* Mute input pins 0x18-0x1b */
3104 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3105 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3106 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3107 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3110 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3111 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3112 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3113 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3114 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3115 /* Analog input/passthru */
3116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3128 static const char *alc880_models[ALC880_MODEL_LAST] = {
3129 [ALC880_3ST] = "3stack",
3130 [ALC880_TCL_S700] = "tcl",
3131 [ALC880_3ST_DIG] = "3stack-digout",
3132 [ALC880_CLEVO] = "clevo",
3133 [ALC880_5ST] = "5stack",
3134 [ALC880_5ST_DIG] = "5stack-digout",
3135 [ALC880_W810] = "w810",
3136 [ALC880_Z71V] = "z71v",
3137 [ALC880_6ST] = "6stack",
3138 [ALC880_6ST_DIG] = "6stack-digout",
3139 [ALC880_ASUS] = "asus",
3140 [ALC880_ASUS_W1V] = "asus-w1v",
3141 [ALC880_ASUS_DIG] = "asus-dig",
3142 [ALC880_ASUS_DIG2] = "asus-dig2",
3143 [ALC880_UNIWILL_DIG] = "uniwill",
3144 [ALC880_UNIWILL_P53] = "uniwill-p53",
3145 [ALC880_FUJITSU] = "fujitsu",
3146 [ALC880_F1734] = "F1734",
3148 [ALC880_LG_LW] = "lg-lw",
3149 [ALC880_MEDION_RIM] = "medion",
3150 #ifdef CONFIG_SND_DEBUG
3151 [ALC880_TEST] = "test",
3153 [ALC880_AUTO] = "auto",
3156 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3157 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3158 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3159 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3160 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3161 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3162 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3163 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3164 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3165 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3166 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3167 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3168 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3169 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3170 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3171 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3172 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3173 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3174 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3175 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3176 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3177 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3178 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3179 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3180 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3181 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3182 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3183 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3184 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3185 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3186 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3187 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3188 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3189 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3190 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3191 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3192 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3193 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3194 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3195 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3196 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3197 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3198 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3199 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3200 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3201 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3202 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3203 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3204 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3205 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3206 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3207 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3208 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3209 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3210 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3211 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3212 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3213 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3214 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3215 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3216 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3217 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3218 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3219 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3220 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3221 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3222 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3223 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3224 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3225 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3226 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3227 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3232 * ALC880 codec presets
3234 static struct alc_config_preset alc880_presets[] = {
3236 .mixers = { alc880_three_stack_mixer },
3237 .init_verbs = { alc880_volume_init_verbs,
3238 alc880_pin_3stack_init_verbs },
3239 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3240 .dac_nids = alc880_dac_nids,
3241 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3242 .channel_mode = alc880_threestack_modes,
3244 .input_mux = &alc880_capture_source,
3246 [ALC880_3ST_DIG] = {
3247 .mixers = { alc880_three_stack_mixer },
3248 .init_verbs = { alc880_volume_init_verbs,
3249 alc880_pin_3stack_init_verbs },
3250 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3251 .dac_nids = alc880_dac_nids,
3252 .dig_out_nid = ALC880_DIGOUT_NID,
3253 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3254 .channel_mode = alc880_threestack_modes,
3256 .input_mux = &alc880_capture_source,
3258 [ALC880_TCL_S700] = {
3259 .mixers = { alc880_tcl_s700_mixer },
3260 .init_verbs = { alc880_volume_init_verbs,
3261 alc880_pin_tcl_S700_init_verbs,
3262 alc880_gpio2_init_verbs },
3263 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3264 .dac_nids = alc880_dac_nids,
3266 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3267 .channel_mode = alc880_2_jack_modes,
3268 .input_mux = &alc880_capture_source,
3271 .mixers = { alc880_three_stack_mixer,
3272 alc880_five_stack_mixer},
3273 .init_verbs = { alc880_volume_init_verbs,
3274 alc880_pin_5stack_init_verbs },
3275 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3276 .dac_nids = alc880_dac_nids,
3277 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3278 .channel_mode = alc880_fivestack_modes,
3279 .input_mux = &alc880_capture_source,
3281 [ALC880_5ST_DIG] = {
3282 .mixers = { alc880_three_stack_mixer,
3283 alc880_five_stack_mixer },
3284 .init_verbs = { alc880_volume_init_verbs,
3285 alc880_pin_5stack_init_verbs },
3286 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3287 .dac_nids = alc880_dac_nids,
3288 .dig_out_nid = ALC880_DIGOUT_NID,
3289 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3290 .channel_mode = alc880_fivestack_modes,
3291 .input_mux = &alc880_capture_source,
3294 .mixers = { alc880_six_stack_mixer },
3295 .init_verbs = { alc880_volume_init_verbs,
3296 alc880_pin_6stack_init_verbs },
3297 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3298 .dac_nids = alc880_6st_dac_nids,
3299 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3300 .channel_mode = alc880_sixstack_modes,
3301 .input_mux = &alc880_6stack_capture_source,
3303 [ALC880_6ST_DIG] = {
3304 .mixers = { alc880_six_stack_mixer },
3305 .init_verbs = { alc880_volume_init_verbs,
3306 alc880_pin_6stack_init_verbs },
3307 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3308 .dac_nids = alc880_6st_dac_nids,
3309 .dig_out_nid = ALC880_DIGOUT_NID,
3310 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3311 .channel_mode = alc880_sixstack_modes,
3312 .input_mux = &alc880_6stack_capture_source,
3315 .mixers = { alc880_w810_base_mixer },
3316 .init_verbs = { alc880_volume_init_verbs,
3317 alc880_pin_w810_init_verbs,
3318 alc880_gpio2_init_verbs },
3319 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3320 .dac_nids = alc880_w810_dac_nids,
3321 .dig_out_nid = ALC880_DIGOUT_NID,
3322 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3323 .channel_mode = alc880_w810_modes,
3324 .input_mux = &alc880_capture_source,
3327 .mixers = { alc880_z71v_mixer },
3328 .init_verbs = { alc880_volume_init_verbs,
3329 alc880_pin_z71v_init_verbs },
3330 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3331 .dac_nids = alc880_z71v_dac_nids,
3332 .dig_out_nid = ALC880_DIGOUT_NID,
3334 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3335 .channel_mode = alc880_2_jack_modes,
3336 .input_mux = &alc880_capture_source,
3339 .mixers = { alc880_f1734_mixer },
3340 .init_verbs = { alc880_volume_init_verbs,
3341 alc880_pin_f1734_init_verbs },
3342 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3343 .dac_nids = alc880_f1734_dac_nids,
3345 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3346 .channel_mode = alc880_2_jack_modes,
3347 .input_mux = &alc880_f1734_capture_source,
3348 .unsol_event = alc880_uniwill_p53_unsol_event,
3349 .init_hook = alc880_uniwill_p53_hp_automute,
3352 .mixers = { alc880_asus_mixer },
3353 .init_verbs = { alc880_volume_init_verbs,
3354 alc880_pin_asus_init_verbs,
3355 alc880_gpio1_init_verbs },
3356 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3357 .dac_nids = alc880_asus_dac_nids,
3358 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3359 .channel_mode = alc880_asus_modes,
3361 .input_mux = &alc880_capture_source,
3363 [ALC880_ASUS_DIG] = {
3364 .mixers = { alc880_asus_mixer },
3365 .init_verbs = { alc880_volume_init_verbs,
3366 alc880_pin_asus_init_verbs,
3367 alc880_gpio1_init_verbs },
3368 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3369 .dac_nids = alc880_asus_dac_nids,
3370 .dig_out_nid = ALC880_DIGOUT_NID,
3371 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3372 .channel_mode = alc880_asus_modes,
3374 .input_mux = &alc880_capture_source,
3376 [ALC880_ASUS_DIG2] = {
3377 .mixers = { alc880_asus_mixer },
3378 .init_verbs = { alc880_volume_init_verbs,
3379 alc880_pin_asus_init_verbs,
3380 alc880_gpio2_init_verbs }, /* use GPIO2 */
3381 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3382 .dac_nids = alc880_asus_dac_nids,
3383 .dig_out_nid = ALC880_DIGOUT_NID,
3384 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3385 .channel_mode = alc880_asus_modes,
3387 .input_mux = &alc880_capture_source,
3389 [ALC880_ASUS_W1V] = {
3390 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3391 .init_verbs = { alc880_volume_init_verbs,
3392 alc880_pin_asus_init_verbs,
3393 alc880_gpio1_init_verbs },
3394 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3395 .dac_nids = alc880_asus_dac_nids,
3396 .dig_out_nid = ALC880_DIGOUT_NID,
3397 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3398 .channel_mode = alc880_asus_modes,
3400 .input_mux = &alc880_capture_source,
3402 [ALC880_UNIWILL_DIG] = {
3403 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3404 .init_verbs = { alc880_volume_init_verbs,
3405 alc880_pin_asus_init_verbs },
3406 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3407 .dac_nids = alc880_asus_dac_nids,
3408 .dig_out_nid = ALC880_DIGOUT_NID,
3409 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3410 .channel_mode = alc880_asus_modes,
3412 .input_mux = &alc880_capture_source,
3414 [ALC880_UNIWILL] = {
3415 .mixers = { alc880_uniwill_mixer },
3416 .init_verbs = { alc880_volume_init_verbs,
3417 alc880_uniwill_init_verbs },
3418 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3419 .dac_nids = alc880_asus_dac_nids,
3420 .dig_out_nid = ALC880_DIGOUT_NID,
3421 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3422 .channel_mode = alc880_threestack_modes,
3424 .input_mux = &alc880_capture_source,
3425 .unsol_event = alc880_uniwill_unsol_event,
3426 .init_hook = alc880_uniwill_automute,
3428 [ALC880_UNIWILL_P53] = {
3429 .mixers = { alc880_uniwill_p53_mixer },
3430 .init_verbs = { alc880_volume_init_verbs,
3431 alc880_uniwill_p53_init_verbs },
3432 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3433 .dac_nids = alc880_asus_dac_nids,
3434 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3435 .channel_mode = alc880_threestack_modes,
3436 .input_mux = &alc880_capture_source,
3437 .unsol_event = alc880_uniwill_p53_unsol_event,
3438 .init_hook = alc880_uniwill_p53_hp_automute,
3440 [ALC880_FUJITSU] = {
3441 .mixers = { alc880_fujitsu_mixer,
3442 alc880_pcbeep_mixer, },
3443 .init_verbs = { alc880_volume_init_verbs,
3444 alc880_uniwill_p53_init_verbs,
3445 alc880_beep_init_verbs },
3446 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3447 .dac_nids = alc880_dac_nids,
3448 .dig_out_nid = ALC880_DIGOUT_NID,
3449 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3450 .channel_mode = alc880_2_jack_modes,
3451 .input_mux = &alc880_capture_source,
3452 .unsol_event = alc880_uniwill_p53_unsol_event,
3453 .init_hook = alc880_uniwill_p53_hp_automute,
3456 .mixers = { alc880_three_stack_mixer },
3457 .init_verbs = { alc880_volume_init_verbs,
3458 alc880_pin_clevo_init_verbs },
3459 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3460 .dac_nids = alc880_dac_nids,
3462 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3463 .channel_mode = alc880_threestack_modes,
3465 .input_mux = &alc880_capture_source,
3468 .mixers = { alc880_lg_mixer },
3469 .init_verbs = { alc880_volume_init_verbs,
3470 alc880_lg_init_verbs },
3471 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3472 .dac_nids = alc880_lg_dac_nids,
3473 .dig_out_nid = ALC880_DIGOUT_NID,
3474 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3475 .channel_mode = alc880_lg_ch_modes,
3477 .input_mux = &alc880_lg_capture_source,
3478 .unsol_event = alc880_lg_unsol_event,
3479 .init_hook = alc880_lg_automute,
3480 #ifdef CONFIG_SND_HDA_POWER_SAVE
3481 .loopbacks = alc880_lg_loopbacks,
3485 .mixers = { alc880_lg_lw_mixer },
3486 .init_verbs = { alc880_volume_init_verbs,
3487 alc880_lg_lw_init_verbs },
3488 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3489 .dac_nids = alc880_dac_nids,
3490 .dig_out_nid = ALC880_DIGOUT_NID,
3491 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3492 .channel_mode = alc880_lg_lw_modes,
3493 .input_mux = &alc880_lg_lw_capture_source,
3494 .unsol_event = alc880_lg_lw_unsol_event,
3495 .init_hook = alc880_lg_lw_automute,
3497 [ALC880_MEDION_RIM] = {
3498 .mixers = { alc880_medion_rim_mixer },
3499 .init_verbs = { alc880_volume_init_verbs,
3500 alc880_medion_rim_init_verbs,
3501 alc_gpio2_init_verbs },
3502 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3503 .dac_nids = alc880_dac_nids,
3504 .dig_out_nid = ALC880_DIGOUT_NID,
3505 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3506 .channel_mode = alc880_2_jack_modes,
3507 .input_mux = &alc880_medion_rim_capture_source,
3508 .unsol_event = alc880_medion_rim_unsol_event,
3509 .init_hook = alc880_medion_rim_automute,
3511 #ifdef CONFIG_SND_DEBUG
3513 .mixers = { alc880_test_mixer },
3514 .init_verbs = { alc880_test_init_verbs },
3515 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3516 .dac_nids = alc880_test_dac_nids,
3517 .dig_out_nid = ALC880_DIGOUT_NID,
3518 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3519 .channel_mode = alc880_test_modes,
3520 .input_mux = &alc880_test_capture_source,
3526 * Automatic parse of I/O pins from the BIOS configuration
3529 #define NUM_CONTROL_ALLOC 32
3530 #define NUM_VERB_ALLOC 32
3534 ALC_CTL_WIDGET_MUTE,
3537 static struct snd_kcontrol_new alc880_control_templates[] = {
3538 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3539 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3540 HDA_BIND_MUTE(NULL, 0, 0, 0),
3543 /* add dynamic controls */
3544 static int add_control(struct alc_spec *spec, int type, const char *name,
3547 struct snd_kcontrol_new *knew;
3549 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3550 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3552 /* array + terminator */
3553 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3556 if (spec->kctl_alloc) {
3557 memcpy(knew, spec->kctl_alloc,
3558 sizeof(*knew) * spec->num_kctl_alloc);
3559 kfree(spec->kctl_alloc);
3561 spec->kctl_alloc = knew;
3562 spec->num_kctl_alloc = num;
3565 knew = &spec->kctl_alloc[spec->num_kctl_used];
3566 *knew = alc880_control_templates[type];
3567 knew->name = kstrdup(name, GFP_KERNEL);
3570 knew->private_value = val;
3571 spec->num_kctl_used++;
3575 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3576 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3577 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3578 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3579 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3580 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3581 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3582 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3583 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3584 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3585 #define ALC880_PIN_CD_NID 0x1c
3587 /* fill in the dac_nids table from the parsed pin configuration */
3588 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3589 const struct auto_pin_cfg *cfg)
3595 memset(assigned, 0, sizeof(assigned));
3596 spec->multiout.dac_nids = spec->private_dac_nids;
3598 /* check the pins hardwired to audio widget */
3599 for (i = 0; i < cfg->line_outs; i++) {
3600 nid = cfg->line_out_pins[i];
3601 if (alc880_is_fixed_pin(nid)) {
3602 int idx = alc880_fixed_pin_idx(nid);
3603 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3607 /* left pins can be connect to any audio widget */
3608 for (i = 0; i < cfg->line_outs; i++) {
3609 nid = cfg->line_out_pins[i];
3610 if (alc880_is_fixed_pin(nid))
3612 /* search for an empty channel */
3613 for (j = 0; j < cfg->line_outs; j++) {
3615 spec->multiout.dac_nids[i] =
3616 alc880_idx_to_dac(j);
3622 spec->multiout.num_dacs = cfg->line_outs;
3626 /* add playback controls from the parsed DAC table */
3627 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3628 const struct auto_pin_cfg *cfg)
3631 static const char *chname[4] = {
3632 "Front", "Surround", NULL /*CLFE*/, "Side"
3637 for (i = 0; i < cfg->line_outs; i++) {
3638 if (!spec->multiout.dac_nids[i])
3640 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3643 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3644 "Center Playback Volume",
3645 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3649 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3650 "LFE Playback Volume",
3651 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3655 err = add_control(spec, ALC_CTL_BIND_MUTE,
3656 "Center Playback Switch",
3657 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3661 err = add_control(spec, ALC_CTL_BIND_MUTE,
3662 "LFE Playback Switch",
3663 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3668 sprintf(name, "%s Playback Volume", chname[i]);
3669 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3670 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3674 sprintf(name, "%s Playback Switch", chname[i]);
3675 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3676 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3685 /* add playback controls for speaker and HP outputs */
3686 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3696 if (alc880_is_fixed_pin(pin)) {
3697 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3698 /* specify the DAC as the extra output */
3699 if (!spec->multiout.hp_nid)
3700 spec->multiout.hp_nid = nid;
3702 spec->multiout.extra_out_nid[0] = nid;
3703 /* control HP volume/switch on the output mixer amp */
3704 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3705 sprintf(name, "%s Playback Volume", pfx);
3706 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3707 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3710 sprintf(name, "%s Playback Switch", pfx);
3711 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3712 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3715 } else if (alc880_is_multi_pin(pin)) {
3716 /* set manual connection */
3717 /* we have only a switch on HP-out PIN */
3718 sprintf(name, "%s Playback Switch", pfx);
3719 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3720 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3727 /* create input playback/capture controls for the given pin */
3728 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3729 const char *ctlname,
3730 int idx, hda_nid_t mix_nid)
3735 sprintf(name, "%s Playback Volume", ctlname);
3736 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3737 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3740 sprintf(name, "%s Playback Switch", ctlname);
3741 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3742 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3748 /* create playback/capture controls for input pins */
3749 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3750 const struct auto_pin_cfg *cfg)
3752 struct hda_input_mux *imux = &spec->private_imux;
3755 for (i = 0; i < AUTO_PIN_LAST; i++) {
3756 if (alc880_is_input_pin(cfg->input_pins[i])) {
3757 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3758 err = new_analog_input(spec, cfg->input_pins[i],
3759 auto_pin_cfg_labels[i],
3763 imux->items[imux->num_items].label =
3764 auto_pin_cfg_labels[i];
3765 imux->items[imux->num_items].index =
3766 alc880_input_pin_idx(cfg->input_pins[i]);
3773 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3774 unsigned int pin_type)
3776 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3779 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3783 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3784 hda_nid_t nid, int pin_type,
3787 alc_set_pin_output(codec, nid, pin_type);
3788 /* need the manual connection? */
3789 if (alc880_is_multi_pin(nid)) {
3790 struct alc_spec *spec = codec->spec;
3791 int idx = alc880_multi_pin_idx(nid);
3792 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3793 AC_VERB_SET_CONNECT_SEL,
3794 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3798 static int get_pin_type(int line_out_type)
3800 if (line_out_type == AUTO_PIN_HP_OUT)
3806 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3808 struct alc_spec *spec = codec->spec;
3811 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3812 for (i = 0; i < spec->autocfg.line_outs; i++) {
3813 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3814 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3815 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3819 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3821 struct alc_spec *spec = codec->spec;
3824 pin = spec->autocfg.speaker_pins[0];
3825 if (pin) /* connect to front */
3826 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3827 pin = spec->autocfg.hp_pins[0];
3828 if (pin) /* connect to front */
3829 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3832 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3834 struct alc_spec *spec = codec->spec;
3837 for (i = 0; i < AUTO_PIN_LAST; i++) {
3838 hda_nid_t nid = spec->autocfg.input_pins[i];
3839 if (alc880_is_input_pin(nid)) {
3840 snd_hda_codec_write(codec, nid, 0,
3841 AC_VERB_SET_PIN_WIDGET_CONTROL,
3842 i <= AUTO_PIN_FRONT_MIC ?
3843 PIN_VREF80 : PIN_IN);
3844 if (nid != ALC880_PIN_CD_NID)
3845 snd_hda_codec_write(codec, nid, 0,
3846 AC_VERB_SET_AMP_GAIN_MUTE,
3852 /* parse the BIOS configuration and set up the alc_spec */
3853 /* return 1 if successful, 0 if the proper config is not found,
3854 * or a negative error code
3856 static int alc880_parse_auto_config(struct hda_codec *codec)
3858 struct alc_spec *spec = codec->spec;
3860 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3862 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3866 if (!spec->autocfg.line_outs)
3867 return 0; /* can't find valid BIOS pin config */
3869 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3872 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3875 err = alc880_auto_create_extra_out(spec,
3876 spec->autocfg.speaker_pins[0],
3880 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3884 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3888 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3890 if (spec->autocfg.dig_out_pin)
3891 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3892 if (spec->autocfg.dig_in_pin)
3893 spec->dig_in_nid = ALC880_DIGIN_NID;
3895 if (spec->kctl_alloc)
3896 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3898 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3900 spec->num_mux_defs = 1;
3901 spec->input_mux = &spec->private_imux;
3903 store_pin_configs(codec);
3907 /* additional initialization for auto-configuration model */
3908 static void alc880_auto_init(struct hda_codec *codec)
3910 struct alc_spec *spec = codec->spec;
3911 alc880_auto_init_multi_out(codec);
3912 alc880_auto_init_extra_out(codec);
3913 alc880_auto_init_analog_input(codec);
3914 if (spec->unsol_event)
3915 alc_inithook(codec);
3919 * OK, here we have finally the patch for ALC880
3922 static int patch_alc880(struct hda_codec *codec)
3924 struct alc_spec *spec;
3928 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3934 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3937 if (board_config < 0) {
3938 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3939 "trying auto-probe from BIOS...\n");
3940 board_config = ALC880_AUTO;
3943 if (board_config == ALC880_AUTO) {
3944 /* automatic parse from the BIOS config */
3945 err = alc880_parse_auto_config(codec);
3951 "hda_codec: Cannot set up configuration "
3952 "from BIOS. Using 3-stack mode...\n");
3953 board_config = ALC880_3ST;
3957 if (board_config != ALC880_AUTO)
3958 setup_preset(spec, &alc880_presets[board_config]);
3960 spec->stream_name_analog = "ALC880 Analog";
3961 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3962 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3963 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3965 spec->stream_name_digital = "ALC880 Digital";
3966 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3967 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3969 if (!spec->adc_nids && spec->input_mux) {
3970 /* check whether NID 0x07 is valid */
3971 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3973 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3974 if (wcap != AC_WID_AUD_IN) {
3975 spec->adc_nids = alc880_adc_nids_alt;
3976 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3977 spec->mixers[spec->num_mixers] =
3978 alc880_capture_alt_mixer;
3981 spec->adc_nids = alc880_adc_nids;
3982 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3983 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3988 spec->vmaster_nid = 0x0c;
3990 codec->patch_ops = alc_patch_ops;
3991 if (board_config == ALC880_AUTO)
3992 spec->init_hook = alc880_auto_init;
3993 #ifdef CONFIG_SND_HDA_POWER_SAVE
3994 if (!spec->loopback.amplist)
3995 spec->loopback.amplist = alc880_loopbacks;
4006 static hda_nid_t alc260_dac_nids[1] = {
4011 static hda_nid_t alc260_adc_nids[1] = {
4016 static hda_nid_t alc260_adc_nids_alt[1] = {
4021 static hda_nid_t alc260_hp_adc_nids[2] = {
4026 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4027 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4029 static hda_nid_t alc260_dual_adc_nids[2] = {
4034 #define ALC260_DIGOUT_NID 0x03
4035 #define ALC260_DIGIN_NID 0x06
4037 static struct hda_input_mux alc260_capture_source = {
4041 { "Front Mic", 0x1 },
4047 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4048 * headphone jack and the internal CD lines since these are the only pins at
4049 * which audio can appear. For flexibility, also allow the option of
4050 * recording the mixer output on the second ADC (ADC0 doesn't have a
4051 * connection to the mixer output).
4053 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4057 { "Mic/Line", 0x0 },
4059 { "Headphone", 0x2 },
4065 { "Mic/Line", 0x0 },
4067 { "Headphone", 0x2 },
4074 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4075 * the Fujitsu S702x, but jacks are marked differently.
4077 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4084 { "Headphone", 0x5 },
4093 { "Headphone", 0x6 },
4099 * This is just place-holder, so there's something for alc_build_pcms to look
4100 * at when it calculates the maximum number of channels. ALC260 has no mixer
4101 * element which allows changing the channel mode, so the verb list is
4104 static struct hda_channel_mode alc260_modes[1] = {
4109 /* Mixer combinations
4111 * basic: base_output + input + pc_beep + capture
4112 * HP: base_output + input + capture_alt
4113 * HP_3013: hp_3013 + input + capture
4114 * fujitsu: fujitsu + capture
4115 * acer: acer + capture
4118 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4119 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4120 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4121 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4122 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4123 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4124 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4128 static struct snd_kcontrol_new alc260_input_mixer[] = {
4129 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4130 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4131 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4132 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4134 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4135 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4136 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4140 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4141 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4142 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4146 /* update HP, line and mono out pins according to the master switch */
4147 static void alc260_hp_master_update(struct hda_codec *codec,
4148 hda_nid_t hp, hda_nid_t line,
4151 struct alc_spec *spec = codec->spec;
4152 unsigned int val = spec->master_sw ? PIN_HP : 0;
4153 /* change HP and line-out pins */
4154 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4156 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4158 /* mono (speaker) depending on the HP jack sense */
4159 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4160 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4164 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4165 struct snd_ctl_elem_value *ucontrol)
4167 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4168 struct alc_spec *spec = codec->spec;
4169 *ucontrol->value.integer.value = spec->master_sw;
4173 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4174 struct snd_ctl_elem_value *ucontrol)
4176 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4177 struct alc_spec *spec = codec->spec;
4178 int val = !!*ucontrol->value.integer.value;
4179 hda_nid_t hp, line, mono;
4181 if (val == spec->master_sw)
4183 spec->master_sw = val;
4184 hp = (kcontrol->private_value >> 16) & 0xff;
4185 line = (kcontrol->private_value >> 8) & 0xff;
4186 mono = kcontrol->private_value & 0xff;
4187 alc260_hp_master_update(codec, hp, line, mono);
4191 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4194 .name = "Master Playback Switch",
4195 .info = snd_ctl_boolean_mono_info,
4196 .get = alc260_hp_master_sw_get,
4197 .put = alc260_hp_master_sw_put,
4198 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4200 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4201 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4202 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4203 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4204 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4206 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4210 static struct hda_verb alc260_hp_unsol_verbs[] = {
4211 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4215 static void alc260_hp_automute(struct hda_codec *codec)
4217 struct alc_spec *spec = codec->spec;
4218 unsigned int present;
4220 present = snd_hda_codec_read(codec, 0x10, 0,
4221 AC_VERB_GET_PIN_SENSE, 0);
4222 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4223 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4226 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4228 if ((res >> 26) == ALC880_HP_EVENT)
4229 alc260_hp_automute(codec);
4232 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4234 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4235 .name = "Master Playback Switch",
4236 .info = snd_ctl_boolean_mono_info,
4237 .get = alc260_hp_master_sw_get,
4238 .put = alc260_hp_master_sw_put,
4239 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4241 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4242 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4243 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4244 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4245 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4246 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4247 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4248 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4252 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4253 .ops = &snd_hda_bind_vol,
4255 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4256 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4257 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4262 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4263 .ops = &snd_hda_bind_sw,
4265 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4266 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4271 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4272 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4273 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4274 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4279 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4280 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4284 static void alc260_hp_3013_automute(struct hda_codec *codec)
4286 struct alc_spec *spec = codec->spec;
4287 unsigned int present;
4289 present = snd_hda_codec_read(codec, 0x15, 0,
4290 AC_VERB_GET_PIN_SENSE, 0);
4291 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4292 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4295 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4298 if ((res >> 26) == ALC880_HP_EVENT)
4299 alc260_hp_3013_automute(codec);
4302 static void alc260_hp_3012_automute(struct hda_codec *codec)
4304 unsigned int present, bits;
4306 present = snd_hda_codec_read(codec, 0x10, 0,
4307 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4309 bits = present ? 0 : PIN_OUT;
4310 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4312 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4314 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4318 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4321 if ((res >> 26) == ALC880_HP_EVENT)
4322 alc260_hp_3012_automute(codec);
4325 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4326 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4328 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4329 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4330 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4331 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4332 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4333 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4334 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4335 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4336 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4337 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4338 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4339 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4340 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4344 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4345 * versions of the ALC260 don't act on requests to enable mic bias from NID
4346 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4347 * datasheet doesn't mention this restriction. At this stage it's not clear
4348 * whether this behaviour is intentional or is a hardware bug in chip
4349 * revisions available in early 2006. Therefore for now allow the
4350 * "Headphone Jack Mode" control to span all choices, but if it turns out
4351 * that the lack of mic bias for this NID is intentional we could change the
4352 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4354 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4355 * don't appear to make the mic bias available from the "line" jack, even
4356 * though the NID used for this jack (0x14) can supply it. The theory is
4357 * that perhaps Acer have included blocking capacitors between the ALC260
4358 * and the output jack. If this turns out to be the case for all such
4359 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4360 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4362 * The C20x Tablet series have a mono internal speaker which is controlled
4363 * via the chip's Mono sum widget and pin complex, so include the necessary
4364 * controls for such models. On models without a "mono speaker" the control
4365 * won't do anything.
4367 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4368 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4369 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4370 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4371 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4373 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4375 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4376 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4378 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4379 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4380 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4381 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4382 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4383 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4384 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4388 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4389 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4391 static struct snd_kcontrol_new alc260_will_mixer[] = {
4392 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4393 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4395 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4396 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4397 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4398 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4399 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4400 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4401 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4402 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4403 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4407 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4408 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4410 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4411 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4412 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4414 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4415 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4416 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4417 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4418 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4419 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4420 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4424 /* capture mixer elements */
4425 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4426 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4427 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4428 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4429 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4431 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4432 /* The multiple "Capture Source" controls confuse alsamixer
4433 * So call somewhat different..
4435 /* .name = "Capture Source", */
4436 .name = "Input Source",
4438 .info = alc_mux_enum_info,
4439 .get = alc_mux_enum_get,
4440 .put = alc_mux_enum_put,
4445 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4446 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4447 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4449 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4450 /* The multiple "Capture Source" controls confuse alsamixer
4451 * So call somewhat different..
4453 /* .name = "Capture Source", */
4454 .name = "Input Source",
4456 .info = alc_mux_enum_info,
4457 .get = alc_mux_enum_get,
4458 .put = alc_mux_enum_put,
4464 * initialization verbs
4466 static struct hda_verb alc260_init_verbs[] = {
4467 /* Line In pin widget for input */
4468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4469 /* CD pin widget for input */
4470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4471 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4472 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4473 /* Mic2 (front panel) pin widget for input and vref at 80% */
4474 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4475 /* LINE-2 is used for line-out in rear */
4476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4477 /* select line-out */
4478 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4480 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4482 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4484 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4485 /* mute capture amp left and right */
4486 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4487 /* set connection select to line in (default select for this ADC) */
4488 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4489 /* mute capture amp left and right */
4490 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4491 /* set connection select to line in (default select for this ADC) */
4492 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4493 /* set vol=0 Line-Out mixer amp left and right */
4494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4495 /* unmute pin widget amp left and right (no gain on this amp) */
4496 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4497 /* set vol=0 HP mixer amp left and right */
4498 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4499 /* unmute pin widget amp left and right (no gain on this amp) */
4500 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4501 /* set vol=0 Mono mixer amp left and right */
4502 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4503 /* unmute pin widget amp left and right (no gain on this amp) */
4504 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4505 /* unmute LINE-2 out pin */
4506 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4507 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4510 /* mute analog inputs */
4511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4513 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4514 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4515 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4516 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4517 /* mute Front out path */
4518 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4519 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4520 /* mute Headphone out path */
4521 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4522 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4523 /* mute Mono out path */
4524 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4525 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4529 #if 0 /* should be identical with alc260_init_verbs? */
4530 static struct hda_verb alc260_hp_init_verbs[] = {
4531 /* Headphone and output */
4532 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4534 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4535 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4536 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4537 /* Mic2 (front panel) pin widget for input and vref at 80% */
4538 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4539 /* Line In pin widget for input */
4540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4541 /* Line-2 pin widget for output */
4542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4543 /* CD pin widget for input */
4544 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4545 /* unmute amp left and right */
4546 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4547 /* set connection select to line in (default select for this ADC) */
4548 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4549 /* unmute Line-Out mixer amp left and right (volume = 0) */
4550 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4551 /* mute pin widget amp left and right (no gain on this amp) */
4552 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4553 /* unmute HP mixer amp left and right (volume = 0) */
4554 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4555 /* mute pin widget amp left and right (no gain on this amp) */
4556 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4557 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4560 /* mute analog inputs */
4561 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4563 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4566 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4567 /* Unmute Front out path */
4568 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4569 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4570 /* Unmute Headphone out path */
4571 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4572 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4573 /* Unmute Mono out path */
4574 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4575 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4580 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4581 /* Line out and output */
4582 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4584 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4585 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4586 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4587 /* Mic2 (front panel) pin widget for input and vref at 80% */
4588 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4589 /* Line In pin widget for input */
4590 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4591 /* Headphone pin widget for output */
4592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4593 /* CD pin widget for input */
4594 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4595 /* unmute amp left and right */
4596 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4597 /* set connection select to line in (default select for this ADC) */
4598 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4599 /* unmute Line-Out mixer amp left and right (volume = 0) */
4600 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4601 /* mute pin widget amp left and right (no gain on this amp) */
4602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4603 /* unmute HP mixer amp left and right (volume = 0) */
4604 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4605 /* mute pin widget amp left and right (no gain on this amp) */
4606 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4607 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4610 /* mute analog inputs */
4611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4616 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4617 /* Unmute Front out path */
4618 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4619 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4620 /* Unmute Headphone out path */
4621 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4622 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4623 /* Unmute Mono out path */
4624 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4625 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4629 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4630 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4631 * audio = 0x16, internal speaker = 0x10.
4633 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4634 /* Disable all GPIOs */
4635 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4636 /* Internal speaker is connected to headphone pin */
4637 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4638 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4639 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4640 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4641 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4642 /* Ensure all other unused pins are disabled and muted. */
4643 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4644 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4645 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4646 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4647 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4648 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4652 /* Disable digital (SPDIF) pins */
4653 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4654 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4656 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4657 * when acting as an output.
4659 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4661 /* Start with output sum widgets muted and their output gains at min */
4662 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4663 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4664 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4665 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4666 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4667 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4668 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4669 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4670 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4672 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4673 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4674 /* Unmute Line1 pin widget output buffer since it starts as an output.
4675 * If the pin mode is changed by the user the pin mode control will
4676 * take care of enabling the pin's input/output buffers as needed.
4677 * Therefore there's no need to enable the input buffer at this
4680 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4681 /* Unmute input buffer of pin widget used for Line-in (no equiv
4684 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4686 /* Mute capture amp left and right */
4687 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4688 /* Set ADC connection select to match default mixer setting - line
4691 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4693 /* Do the same for the second ADC: mute capture input amp and
4694 * set ADC connection to line in (on mic1 pin)
4696 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4697 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4699 /* Mute all inputs to mixer widget (even unconnected ones) */
4700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4704 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4705 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4706 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4707 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4712 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4713 * similar laptops (adapted from Fujitsu init verbs).
4715 static struct hda_verb alc260_acer_init_verbs[] = {
4716 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4717 * the headphone jack. Turn this on and rely on the standard mute
4718 * methods whenever the user wants to turn these outputs off.
4720 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4721 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4722 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4723 /* Internal speaker/Headphone jack is connected to Line-out pin */
4724 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4725 /* Internal microphone/Mic jack is connected to Mic1 pin */
4726 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4727 /* Line In jack is connected to Line1 pin */
4728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4729 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4730 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4731 /* Ensure all other unused pins are disabled and muted. */
4732 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4733 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4734 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4735 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4737 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4738 /* Disable digital (SPDIF) pins */
4739 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4740 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4742 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4743 * bus when acting as outputs.
4745 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4746 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4748 /* Start with output sum widgets muted and their output gains at min */
4749 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4750 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4751 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4752 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4753 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4754 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4755 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4756 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4757 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4759 /* Unmute Line-out pin widget amp left and right
4760 * (no equiv mixer ctrl)
4762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4763 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4764 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4765 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4766 * inputs. If the pin mode is changed by the user the pin mode control
4767 * will take care of enabling the pin's input/output buffers as needed.
4768 * Therefore there's no need to enable the input buffer at this
4771 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4774 /* Mute capture amp left and right */
4775 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4776 /* Set ADC connection select to match default mixer setting - mic
4779 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4781 /* Do similar with the second ADC: mute capture input amp and
4782 * set ADC connection to mic to match ALSA's default state.
4784 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4785 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4787 /* Mute all inputs to mixer widget (even unconnected ones) */
4788 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4789 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4790 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4792 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4793 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4794 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4800 static struct hda_verb alc260_will_verbs[] = {
4801 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4802 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4803 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4804 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4805 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4806 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4810 static struct hda_verb alc260_replacer_672v_verbs[] = {
4811 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4812 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4813 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4815 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4816 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4817 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4819 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4823 /* toggle speaker-output according to the hp-jack state */
4824 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4826 unsigned int present;
4828 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4829 present = snd_hda_codec_read(codec, 0x0f, 0,
4830 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4832 snd_hda_codec_write_cache(codec, 0x01, 0,
4833 AC_VERB_SET_GPIO_DATA, 1);
4834 snd_hda_codec_write_cache(codec, 0x0f, 0,
4835 AC_VERB_SET_PIN_WIDGET_CONTROL,
4838 snd_hda_codec_write_cache(codec, 0x01, 0,
4839 AC_VERB_SET_GPIO_DATA, 0);
4840 snd_hda_codec_write_cache(codec, 0x0f, 0,
4841 AC_VERB_SET_PIN_WIDGET_CONTROL,
4846 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4849 if ((res >> 26) == ALC880_HP_EVENT)
4850 alc260_replacer_672v_automute(codec);
4853 static struct hda_verb alc260_hp_dc7600_verbs[] = {
4854 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4856 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4857 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4858 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4859 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4860 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4861 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4862 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4863 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4867 /* Test configuration for debugging, modelled after the ALC880 test
4870 #ifdef CONFIG_SND_DEBUG
4871 static hda_nid_t alc260_test_dac_nids[1] = {
4874 static hda_nid_t alc260_test_adc_nids[2] = {
4877 /* For testing the ALC260, each input MUX needs its own definition since
4878 * the signal assignments are different. This assumes that the first ADC
4881 static struct hda_input_mux alc260_test_capture_sources[2] = {
4885 { "MIC1 pin", 0x0 },
4886 { "MIC2 pin", 0x1 },
4887 { "LINE1 pin", 0x2 },
4888 { "LINE2 pin", 0x3 },
4890 { "LINE-OUT pin", 0x5 },
4891 { "HP-OUT pin", 0x6 },
4897 { "MIC1 pin", 0x0 },
4898 { "MIC2 pin", 0x1 },
4899 { "LINE1 pin", 0x2 },
4900 { "LINE2 pin", 0x3 },
4903 { "LINE-OUT pin", 0x6 },
4904 { "HP-OUT pin", 0x7 },
4908 static struct snd_kcontrol_new alc260_test_mixer[] = {
4909 /* Output driver widgets */
4910 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4911 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4912 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4913 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4914 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4915 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4917 /* Modes for retasking pin widgets
4918 * Note: the ALC260 doesn't seem to act on requests to enable mic
4919 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4920 * mention this restriction. At this stage it's not clear whether
4921 * this behaviour is intentional or is a hardware bug in chip
4922 * revisions available at least up until early 2006. Therefore for
4923 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4924 * choices, but if it turns out that the lack of mic bias for these
4925 * NIDs is intentional we could change their modes from
4926 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4928 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4929 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4930 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4931 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4932 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4933 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4935 /* Loopback mixer controls */
4936 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4937 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4938 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4939 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4940 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4941 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4942 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4943 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4944 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4945 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4946 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4947 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4948 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4949 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4950 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4951 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4953 /* Controls for GPIO pins, assuming they are configured as outputs */
4954 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4955 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4956 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4957 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4959 /* Switches to allow the digital IO pins to be enabled. The datasheet
4960 * is ambigious as to which NID is which; testing on laptops which
4961 * make this output available should provide clarification.
4963 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4964 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4966 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4967 * this output to turn on an external amplifier.
4969 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4970 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4974 static struct hda_verb alc260_test_init_verbs[] = {
4975 /* Enable all GPIOs as outputs with an initial value of 0 */
4976 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4977 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4978 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4980 /* Enable retasking pins as output, initially without power amp */
4981 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4982 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4983 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4985 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4986 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4988 /* Disable digital (SPDIF) pins initially, but users can enable
4989 * them via a mixer switch. In the case of SPDIF-out, this initverb
4990 * payload also sets the generation to 0, output to be in "consumer"
4991 * PCM format, copyright asserted, no pre-emphasis and no validity
4994 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4995 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4997 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4998 * OUT1 sum bus when acting as an output.
5000 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5001 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5002 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5003 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5005 /* Start with output sum widgets muted and their output gains at min */
5006 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5007 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5009 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5010 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5012 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5013 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5014 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5016 /* Unmute retasking pin widget output buffers since the default
5017 * state appears to be output. As the pin mode is changed by the
5018 * user the pin mode control will take care of enabling the pin's
5019 * input/output buffers as needed.
5021 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5022 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5023 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5024 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5025 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5026 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5027 /* Also unmute the mono-out pin widget */
5028 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5030 /* Mute capture amp left and right */
5031 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5032 /* Set ADC connection select to match default mixer setting (mic1
5035 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5037 /* Do the same for the second ADC: mute capture input amp and
5038 * set ADC connection to mic1 pin
5040 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5041 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5043 /* Mute all inputs to mixer widget (even unconnected ones) */
5044 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5045 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5046 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5047 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5048 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5049 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5051 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5057 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5058 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5060 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5061 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5064 * for BIOS auto-configuration
5067 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5068 const char *pfx, int *vol_bits)
5071 unsigned long vol_val, sw_val;
5075 if (nid >= 0x0f && nid < 0x11) {
5076 nid_vol = nid - 0x7;
5077 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5078 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5079 } else if (nid == 0x11) {
5080 nid_vol = nid - 0x7;
5081 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5082 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5083 } else if (nid >= 0x12 && nid <= 0x15) {
5085 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5086 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5090 if (!(*vol_bits & (1 << nid_vol))) {
5091 /* first control for the volume widget */
5092 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5093 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5096 *vol_bits |= (1 << nid_vol);
5098 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5099 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5105 /* add playback controls from the parsed DAC table */
5106 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5107 const struct auto_pin_cfg *cfg)
5113 spec->multiout.num_dacs = 1;
5114 spec->multiout.dac_nids = spec->private_dac_nids;
5115 spec->multiout.dac_nids[0] = 0x02;
5117 nid = cfg->line_out_pins[0];
5119 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5124 nid = cfg->speaker_pins[0];
5126 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5131 nid = cfg->hp_pins[0];
5133 err = alc260_add_playback_controls(spec, nid, "Headphone",
5141 /* create playback/capture controls for input pins */
5142 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5143 const struct auto_pin_cfg *cfg)
5145 struct hda_input_mux *imux = &spec->private_imux;
5148 for (i = 0; i < AUTO_PIN_LAST; i++) {
5149 if (cfg->input_pins[i] >= 0x12) {
5150 idx = cfg->input_pins[i] - 0x12;
5151 err = new_analog_input(spec, cfg->input_pins[i],
5152 auto_pin_cfg_labels[i], idx,
5156 imux->items[imux->num_items].label =
5157 auto_pin_cfg_labels[i];
5158 imux->items[imux->num_items].index = idx;
5161 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5162 idx = cfg->input_pins[i] - 0x09;
5163 err = new_analog_input(spec, cfg->input_pins[i],
5164 auto_pin_cfg_labels[i], idx,
5168 imux->items[imux->num_items].label =
5169 auto_pin_cfg_labels[i];
5170 imux->items[imux->num_items].index = idx;
5177 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5178 hda_nid_t nid, int pin_type,
5181 alc_set_pin_output(codec, nid, pin_type);
5182 /* need the manual connection? */
5184 int idx = nid - 0x12;
5185 snd_hda_codec_write(codec, idx + 0x0b, 0,
5186 AC_VERB_SET_CONNECT_SEL, sel_idx);
5190 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5192 struct alc_spec *spec = codec->spec;
5195 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5196 nid = spec->autocfg.line_out_pins[0];
5198 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5199 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5202 nid = spec->autocfg.speaker_pins[0];
5204 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5206 nid = spec->autocfg.hp_pins[0];
5208 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5211 #define ALC260_PIN_CD_NID 0x16
5212 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5214 struct alc_spec *spec = codec->spec;
5217 for (i = 0; i < AUTO_PIN_LAST; i++) {
5218 hda_nid_t nid = spec->autocfg.input_pins[i];
5220 snd_hda_codec_write(codec, nid, 0,
5221 AC_VERB_SET_PIN_WIDGET_CONTROL,
5222 i <= AUTO_PIN_FRONT_MIC ?
5223 PIN_VREF80 : PIN_IN);
5224 if (nid != ALC260_PIN_CD_NID)
5225 snd_hda_codec_write(codec, nid, 0,
5226 AC_VERB_SET_AMP_GAIN_MUTE,
5233 * generic initialization of ADC, input mixers and output mixers
5235 static struct hda_verb alc260_volume_init_verbs[] = {
5237 * Unmute ADC0-1 and set the default input to mic-in
5239 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5240 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5241 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5242 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5244 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5246 * Note: PASD motherboards uses the Line In 2 as the input for
5247 * front panel mic (mic 2)
5249 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5250 /* mute analog inputs */
5251 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5253 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5254 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5258 * Set up output mixers (0x08 - 0x0a)
5260 /* set vol=0 to output mixers */
5261 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5262 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5263 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5264 /* set up input amps for analog loopback */
5265 /* Amp Indices: DAC = 0, mixer = 1 */
5266 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5269 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5270 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5271 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5276 static int alc260_parse_auto_config(struct hda_codec *codec)
5278 struct alc_spec *spec = codec->spec;
5281 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5283 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5287 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5290 if (!spec->kctl_alloc)
5291 return 0; /* can't find valid BIOS pin config */
5292 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5296 spec->multiout.max_channels = 2;
5298 if (spec->autocfg.dig_out_pin)
5299 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5300 if (spec->kctl_alloc)
5301 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5303 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5305 spec->num_mux_defs = 1;
5306 spec->input_mux = &spec->private_imux;
5308 /* check whether NID 0x04 is valid */
5309 wcap = get_wcaps(codec, 0x04);
5310 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5311 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5312 spec->adc_nids = alc260_adc_nids_alt;
5313 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5314 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5316 spec->adc_nids = alc260_adc_nids;
5317 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5318 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5322 store_pin_configs(codec);
5326 /* additional initialization for auto-configuration model */
5327 static void alc260_auto_init(struct hda_codec *codec)
5329 struct alc_spec *spec = codec->spec;
5330 alc260_auto_init_multi_out(codec);
5331 alc260_auto_init_analog_input(codec);
5332 if (spec->unsol_event)
5333 alc_inithook(codec);
5336 #ifdef CONFIG_SND_HDA_POWER_SAVE
5337 static struct hda_amp_list alc260_loopbacks[] = {
5338 { 0x07, HDA_INPUT, 0 },
5339 { 0x07, HDA_INPUT, 1 },
5340 { 0x07, HDA_INPUT, 2 },
5341 { 0x07, HDA_INPUT, 3 },
5342 { 0x07, HDA_INPUT, 4 },
5348 * ALC260 configurations
5350 static const char *alc260_models[ALC260_MODEL_LAST] = {
5351 [ALC260_BASIC] = "basic",
5353 [ALC260_HP_3013] = "hp-3013",
5354 [ALC260_HP_DC7600] = "hp-dc7600",
5355 [ALC260_FUJITSU_S702X] = "fujitsu",
5356 [ALC260_ACER] = "acer",
5357 [ALC260_WILL] = "will",
5358 [ALC260_REPLACER_672V] = "replacer",
5359 #ifdef CONFIG_SND_DEBUG
5360 [ALC260_TEST] = "test",
5362 [ALC260_AUTO] = "auto",
5365 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5366 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5367 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5368 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5369 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5370 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5371 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5372 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5373 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5374 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5375 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5376 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5377 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5378 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5379 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5380 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5381 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5382 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5383 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5387 static struct alc_config_preset alc260_presets[] = {
5389 .mixers = { alc260_base_output_mixer,
5391 alc260_pc_beep_mixer,
5392 alc260_capture_mixer },
5393 .init_verbs = { alc260_init_verbs },
5394 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5395 .dac_nids = alc260_dac_nids,
5396 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5397 .adc_nids = alc260_adc_nids,
5398 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5399 .channel_mode = alc260_modes,
5400 .input_mux = &alc260_capture_source,
5403 .mixers = { alc260_hp_output_mixer,
5405 alc260_capture_alt_mixer },
5406 .init_verbs = { alc260_init_verbs,
5407 alc260_hp_unsol_verbs },
5408 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5409 .dac_nids = alc260_dac_nids,
5410 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5411 .adc_nids = alc260_hp_adc_nids,
5412 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5413 .channel_mode = alc260_modes,
5414 .input_mux = &alc260_capture_source,
5415 .unsol_event = alc260_hp_unsol_event,
5416 .init_hook = alc260_hp_automute,
5418 [ALC260_HP_DC7600] = {
5419 .mixers = { alc260_hp_dc7600_mixer,
5421 alc260_capture_alt_mixer },
5422 .init_verbs = { alc260_init_verbs,
5423 alc260_hp_dc7600_verbs },
5424 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5425 .dac_nids = alc260_dac_nids,
5426 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5427 .adc_nids = alc260_hp_adc_nids,
5428 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5429 .channel_mode = alc260_modes,
5430 .input_mux = &alc260_capture_source,
5431 .unsol_event = alc260_hp_3012_unsol_event,
5432 .init_hook = alc260_hp_3012_automute,
5434 [ALC260_HP_3013] = {
5435 .mixers = { alc260_hp_3013_mixer,
5437 alc260_capture_alt_mixer },
5438 .init_verbs = { alc260_hp_3013_init_verbs,
5439 alc260_hp_3013_unsol_verbs },
5440 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5441 .dac_nids = alc260_dac_nids,
5442 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5443 .adc_nids = alc260_hp_adc_nids,
5444 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5445 .channel_mode = alc260_modes,
5446 .input_mux = &alc260_capture_source,
5447 .unsol_event = alc260_hp_3013_unsol_event,
5448 .init_hook = alc260_hp_3013_automute,
5450 [ALC260_FUJITSU_S702X] = {
5451 .mixers = { alc260_fujitsu_mixer,
5452 alc260_capture_mixer },
5453 .init_verbs = { alc260_fujitsu_init_verbs },
5454 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5455 .dac_nids = alc260_dac_nids,
5456 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5457 .adc_nids = alc260_dual_adc_nids,
5458 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5459 .channel_mode = alc260_modes,
5460 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5461 .input_mux = alc260_fujitsu_capture_sources,
5464 .mixers = { alc260_acer_mixer,
5465 alc260_capture_mixer },
5466 .init_verbs = { alc260_acer_init_verbs },
5467 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5468 .dac_nids = alc260_dac_nids,
5469 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5470 .adc_nids = alc260_dual_adc_nids,
5471 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5472 .channel_mode = alc260_modes,
5473 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5474 .input_mux = alc260_acer_capture_sources,
5477 .mixers = { alc260_will_mixer,
5478 alc260_capture_mixer },
5479 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5480 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5481 .dac_nids = alc260_dac_nids,
5482 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5483 .adc_nids = alc260_adc_nids,
5484 .dig_out_nid = ALC260_DIGOUT_NID,
5485 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5486 .channel_mode = alc260_modes,
5487 .input_mux = &alc260_capture_source,
5489 [ALC260_REPLACER_672V] = {
5490 .mixers = { alc260_replacer_672v_mixer,
5491 alc260_capture_mixer },
5492 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5493 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5494 .dac_nids = alc260_dac_nids,
5495 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5496 .adc_nids = alc260_adc_nids,
5497 .dig_out_nid = ALC260_DIGOUT_NID,
5498 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5499 .channel_mode = alc260_modes,
5500 .input_mux = &alc260_capture_source,
5501 .unsol_event = alc260_replacer_672v_unsol_event,
5502 .init_hook = alc260_replacer_672v_automute,
5504 #ifdef CONFIG_SND_DEBUG
5506 .mixers = { alc260_test_mixer,
5507 alc260_capture_mixer },
5508 .init_verbs = { alc260_test_init_verbs },
5509 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5510 .dac_nids = alc260_test_dac_nids,
5511 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5512 .adc_nids = alc260_test_adc_nids,
5513 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5514 .channel_mode = alc260_modes,
5515 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5516 .input_mux = alc260_test_capture_sources,
5521 static int patch_alc260(struct hda_codec *codec)
5523 struct alc_spec *spec;
5524 int err, board_config;
5526 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5532 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5535 if (board_config < 0) {
5536 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5537 "trying auto-probe from BIOS...\n");
5538 board_config = ALC260_AUTO;
5541 if (board_config == ALC260_AUTO) {
5542 /* automatic parse from the BIOS config */
5543 err = alc260_parse_auto_config(codec);
5549 "hda_codec: Cannot set up configuration "
5550 "from BIOS. Using base mode...\n");
5551 board_config = ALC260_BASIC;
5555 if (board_config != ALC260_AUTO)
5556 setup_preset(spec, &alc260_presets[board_config]);
5558 spec->stream_name_analog = "ALC260 Analog";
5559 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5560 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5562 spec->stream_name_digital = "ALC260 Digital";
5563 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5564 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5566 spec->vmaster_nid = 0x08;
5568 codec->patch_ops = alc_patch_ops;
5569 if (board_config == ALC260_AUTO)
5570 spec->init_hook = alc260_auto_init;
5571 #ifdef CONFIG_SND_HDA_POWER_SAVE
5572 if (!spec->loopback.amplist)
5573 spec->loopback.amplist = alc260_loopbacks;
5583 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5584 * configuration. Each pin widget can choose any input DACs and a mixer.
5585 * Each ADC is connected from a mixer of all inputs. This makes possible
5586 * 6-channel independent captures.
5588 * In addition, an independent DAC for the multi-playback (not used in this
5591 #define ALC882_DIGOUT_NID 0x06
5592 #define ALC882_DIGIN_NID 0x0a
5594 static struct hda_channel_mode alc882_ch_modes[1] = {
5598 static hda_nid_t alc882_dac_nids[4] = {
5599 /* front, rear, clfe, rear_surr */
5600 0x02, 0x03, 0x04, 0x05
5603 /* identical with ALC880 */
5604 #define alc882_adc_nids alc880_adc_nids
5605 #define alc882_adc_nids_alt alc880_adc_nids_alt
5607 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5608 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5611 /* FIXME: should be a matrix-type input source selection */
5613 static struct hda_input_mux alc882_capture_source = {
5617 { "Front Mic", 0x1 },
5622 #define alc882_mux_enum_info alc_mux_enum_info
5623 #define alc882_mux_enum_get alc_mux_enum_get
5625 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5626 struct snd_ctl_elem_value *ucontrol)
5628 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5629 struct alc_spec *spec = codec->spec;
5630 const struct hda_input_mux *imux = spec->input_mux;
5631 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5632 hda_nid_t nid = spec->capsrc_nids ?
5633 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5634 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5635 unsigned int i, idx;
5637 idx = ucontrol->value.enumerated.item[0];
5638 if (idx >= imux->num_items)
5639 idx = imux->num_items - 1;
5640 if (*cur_val == idx)
5642 for (i = 0; i < imux->num_items; i++) {
5643 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5644 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5645 imux->items[i].index,
5655 static struct hda_verb alc882_3ST_ch2_init[] = {
5656 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5657 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5658 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5659 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5666 static struct hda_verb alc882_3ST_ch6_init[] = {
5667 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5668 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5669 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5670 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5671 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5672 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5676 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5677 { 2, alc882_3ST_ch2_init },
5678 { 6, alc882_3ST_ch6_init },
5684 static struct hda_verb alc882_sixstack_ch6_init[] = {
5685 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5686 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5687 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5688 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5695 static struct hda_verb alc882_sixstack_ch8_init[] = {
5696 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5697 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5698 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5699 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5703 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5704 { 6, alc882_sixstack_ch6_init },
5705 { 8, alc882_sixstack_ch8_init },
5709 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5715 static struct hda_verb alc885_mbp_ch2_init[] = {
5716 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5717 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5718 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5725 static struct hda_verb alc885_mbp_ch6_init[] = {
5726 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5727 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5728 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5729 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5730 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5734 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5735 { 2, alc885_mbp_ch2_init },
5736 { 6, alc885_mbp_ch6_init },
5740 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5741 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5743 static struct snd_kcontrol_new alc882_base_mixer[] = {
5744 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5745 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5746 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5747 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5748 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5749 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5750 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5751 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5752 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5753 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5755 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5756 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5757 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5758 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5762 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5763 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5764 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5765 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5766 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5770 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5771 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5772 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5773 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5774 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5776 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5778 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5779 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5780 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5783 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5784 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5785 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5786 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5787 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5788 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5789 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5791 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5792 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5793 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5794 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5798 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5799 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5800 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5801 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5802 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5803 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5807 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5808 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5809 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5810 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5811 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5815 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5816 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5818 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5819 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5820 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5821 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5822 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5823 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5824 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5825 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5826 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5827 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5828 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5831 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5835 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5836 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5837 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5838 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5839 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5840 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5841 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5842 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5844 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5846 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5847 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5851 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5854 .name = "Channel Mode",
5855 .info = alc_ch_mode_info,
5856 .get = alc_ch_mode_get,
5857 .put = alc_ch_mode_put,
5862 static struct hda_verb alc882_init_verbs[] = {
5863 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5864 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5865 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5866 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5868 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5869 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5870 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5872 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5873 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5874 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5876 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5877 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5878 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5880 /* Front Pin: output 0 (0x0c) */
5881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5883 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5884 /* Rear Pin: output 1 (0x0d) */
5885 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5886 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5887 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5888 /* CLFE Pin: output 2 (0x0e) */
5889 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5890 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5891 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5892 /* Side Pin: output 3 (0x0f) */
5893 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5894 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5895 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5896 /* Mic (rear) pin: input vref at 80% */
5897 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5898 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5899 /* Front Mic pin: input vref at 80% */
5900 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5902 /* Line In pin: input */
5903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5905 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5906 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5907 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5908 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5909 /* CD pin widget for input */
5910 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5912 /* FIXME: use matrix-type input source selection */
5913 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5914 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5915 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5916 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5917 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5918 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5921 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5922 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5923 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5927 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5928 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5929 /* ADC1: mute amp left and right */
5930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5931 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5932 /* ADC2: mute amp left and right */
5933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5934 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5935 /* ADC3: mute amp left and right */
5936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5937 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5942 static struct hda_verb alc882_eapd_verbs[] = {
5943 /* change to EAPD mode */
5944 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5945 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5950 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5951 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5952 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5953 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5954 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5955 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5956 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5957 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5961 static struct hda_verb alc882_macpro_init_verbs[] = {
5962 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5963 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5964 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5965 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5966 /* Front Pin: output 0 (0x0c) */
5967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5968 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5969 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5970 /* Front Mic pin: input vref at 80% */
5971 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5972 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5973 /* Speaker: output */
5974 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5975 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5976 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5977 /* Headphone output (output 0 - 0x0c) */
5978 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5979 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5980 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5982 /* FIXME: use matrix-type input source selection */
5983 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5984 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5987 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5988 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5990 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5991 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5992 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5997 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5998 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5999 /* ADC1: mute amp left and right */
6000 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6001 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6002 /* ADC2: mute amp left and right */
6003 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6004 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6005 /* ADC3: mute amp left and right */
6006 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6007 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6012 /* Macbook Pro rev3 */
6013 static struct hda_verb alc885_mbp3_init_verbs[] = {
6014 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6022 /* Front Pin: output 0 (0x0c) */
6023 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6024 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6025 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6026 /* HP Pin: output 0 (0x0d) */
6027 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6028 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6029 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6030 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6031 /* Mic (rear) pin: input vref at 80% */
6032 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6033 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6034 /* Front Mic pin: input vref at 80% */
6035 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6036 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6037 /* Line In pin: use output 1 when in LineOut mode */
6038 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6039 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6040 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6042 /* FIXME: use matrix-type input source selection */
6043 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6044 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6050 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6051 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6052 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6055 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6059 /* ADC1: mute amp left and right */
6060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6061 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6062 /* ADC2: mute amp left and right */
6063 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6064 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6065 /* ADC3: mute amp left and right */
6066 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6067 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6072 /* iMac 24 mixer. */
6073 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6074 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6075 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6079 /* iMac 24 init verbs. */
6080 static struct hda_verb alc885_imac24_init_verbs[] = {
6081 /* Internal speakers: output 0 (0x0c) */
6082 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6083 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6084 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6085 /* Internal speakers: output 0 (0x0c) */
6086 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6087 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6088 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6089 /* Headphone: output 0 (0x0c) */
6090 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6091 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6092 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6093 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6094 /* Front Mic: input vref at 80% */
6095 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6096 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6100 /* Toggle speaker-output according to the hp-jack state */
6101 static void alc885_imac24_automute(struct hda_codec *codec)
6103 unsigned int present;
6105 present = snd_hda_codec_read(codec, 0x14, 0,
6106 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6107 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6108 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6109 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6110 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6113 /* Processes unsolicited events. */
6114 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6117 /* Headphone insertion or removal. */
6118 if ((res >> 26) == ALC880_HP_EVENT)
6119 alc885_imac24_automute(codec);
6122 static void alc885_mbp3_automute(struct hda_codec *codec)
6124 unsigned int present;
6126 present = snd_hda_codec_read(codec, 0x15, 0,
6127 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6128 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6129 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6130 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6131 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6134 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6137 /* Headphone insertion or removal. */
6138 if ((res >> 26) == ALC880_HP_EVENT)
6139 alc885_mbp3_automute(codec);
6143 static struct hda_verb alc882_targa_verbs[] = {
6144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6147 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6148 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6150 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6151 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6152 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6154 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6155 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6156 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6157 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6161 /* toggle speaker-output according to the hp-jack state */
6162 static void alc882_targa_automute(struct hda_codec *codec)
6164 unsigned int present;
6166 present = snd_hda_codec_read(codec, 0x14, 0,
6167 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6168 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6169 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6170 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6174 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6176 /* Looks like the unsol event is incompatible with the standard
6177 * definition. 4bit tag is placed at 26 bit!
6179 if (((res >> 26) == ALC880_HP_EVENT)) {
6180 alc882_targa_automute(codec);
6184 static struct hda_verb alc882_asus_a7j_verbs[] = {
6185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6189 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6190 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6192 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6193 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6194 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6196 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6197 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6198 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6202 static struct hda_verb alc882_asus_a7m_verbs[] = {
6203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6208 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6210 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6212 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6214 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6215 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6216 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6220 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6222 unsigned int gpiostate, gpiomask, gpiodir;
6224 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6225 AC_VERB_GET_GPIO_DATA, 0);
6228 gpiostate |= (1 << pin);
6230 gpiostate &= ~(1 << pin);
6232 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6233 AC_VERB_GET_GPIO_MASK, 0);
6234 gpiomask |= (1 << pin);
6236 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6237 AC_VERB_GET_GPIO_DIRECTION, 0);
6238 gpiodir |= (1 << pin);
6241 snd_hda_codec_write(codec, codec->afg, 0,
6242 AC_VERB_SET_GPIO_MASK, gpiomask);
6243 snd_hda_codec_write(codec, codec->afg, 0,
6244 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6248 snd_hda_codec_write(codec, codec->afg, 0,
6249 AC_VERB_SET_GPIO_DATA, gpiostate);
6252 /* set up GPIO at initialization */
6253 static void alc885_macpro_init_hook(struct hda_codec *codec)
6255 alc882_gpio_mute(codec, 0, 0);
6256 alc882_gpio_mute(codec, 1, 0);
6259 /* set up GPIO and update auto-muting at initialization */
6260 static void alc885_imac24_init_hook(struct hda_codec *codec)
6262 alc885_macpro_init_hook(codec);
6263 alc885_imac24_automute(codec);
6267 * generic initialization of ADC, input mixers and output mixers
6269 static struct hda_verb alc882_auto_init_verbs[] = {
6271 * Unmute ADC0-2 and set the default input to mic-in
6273 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6275 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6276 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6277 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6278 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6280 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6282 * Note: PASD motherboards uses the Line In 2 as the input for
6283 * front panel mic (mic 2)
6285 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6293 * Set up output mixers (0x0c - 0x0f)
6295 /* set vol=0 to output mixers */
6296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6299 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6300 /* set up input amps for analog loopback */
6301 /* Amp Indices: DAC = 0, mixer = 1 */
6302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6304 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6306 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6308 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6309 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6310 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6311 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6313 /* FIXME: use matrix-type input source selection */
6314 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6315 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6321 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6322 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6326 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6327 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6334 /* capture mixer elements */
6335 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6336 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6337 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6338 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6339 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6341 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6342 /* The multiple "Capture Source" controls confuse alsamixer
6343 * So call somewhat different..
6345 /* .name = "Capture Source", */
6346 .name = "Input Source",
6348 .info = alc882_mux_enum_info,
6349 .get = alc882_mux_enum_get,
6350 .put = alc882_mux_enum_put,
6355 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6356 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6357 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6358 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6359 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6360 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6361 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6364 /* The multiple "Capture Source" controls confuse alsamixer
6365 * So call somewhat different..
6367 /* .name = "Capture Source", */
6368 .name = "Input Source",
6370 .info = alc882_mux_enum_info,
6371 .get = alc882_mux_enum_get,
6372 .put = alc882_mux_enum_put,
6377 #ifdef CONFIG_SND_HDA_POWER_SAVE
6378 #define alc882_loopbacks alc880_loopbacks
6381 /* pcm configuration: identiacal with ALC880 */
6382 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6383 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6384 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6385 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6388 * configuration and preset
6390 static const char *alc882_models[ALC882_MODEL_LAST] = {
6391 [ALC882_3ST_DIG] = "3stack-dig",
6392 [ALC882_6ST_DIG] = "6stack-dig",
6393 [ALC882_ARIMA] = "arima",
6394 [ALC882_W2JC] = "w2jc",
6395 [ALC882_TARGA] = "targa",
6396 [ALC882_ASUS_A7J] = "asus-a7j",
6397 [ALC882_ASUS_A7M] = "asus-a7m",
6398 [ALC885_MACPRO] = "macpro",
6399 [ALC885_MBP3] = "mbp3",
6400 [ALC885_IMAC24] = "imac24",
6401 [ALC882_AUTO] = "auto",
6404 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6405 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6406 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6407 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6408 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6409 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6410 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6411 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6412 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6413 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6414 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6415 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6416 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6420 static struct alc_config_preset alc882_presets[] = {
6421 [ALC882_3ST_DIG] = {
6422 .mixers = { alc882_base_mixer },
6423 .init_verbs = { alc882_init_verbs },
6424 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6425 .dac_nids = alc882_dac_nids,
6426 .dig_out_nid = ALC882_DIGOUT_NID,
6427 .dig_in_nid = ALC882_DIGIN_NID,
6428 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6429 .channel_mode = alc882_ch_modes,
6431 .input_mux = &alc882_capture_source,
6433 [ALC882_6ST_DIG] = {
6434 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6435 .init_verbs = { alc882_init_verbs },
6436 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6437 .dac_nids = alc882_dac_nids,
6438 .dig_out_nid = ALC882_DIGOUT_NID,
6439 .dig_in_nid = ALC882_DIGIN_NID,
6440 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6441 .channel_mode = alc882_sixstack_modes,
6442 .input_mux = &alc882_capture_source,
6445 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6446 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6447 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6448 .dac_nids = alc882_dac_nids,
6449 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6450 .channel_mode = alc882_sixstack_modes,
6451 .input_mux = &alc882_capture_source,
6454 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6455 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6456 alc880_gpio1_init_verbs },
6457 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6458 .dac_nids = alc882_dac_nids,
6459 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6460 .channel_mode = alc880_threestack_modes,
6462 .input_mux = &alc882_capture_source,
6463 .dig_out_nid = ALC882_DIGOUT_NID,
6466 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6467 .init_verbs = { alc885_mbp3_init_verbs,
6468 alc880_gpio1_init_verbs },
6469 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6470 .dac_nids = alc882_dac_nids,
6471 .channel_mode = alc885_mbp_6ch_modes,
6472 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6473 .input_mux = &alc882_capture_source,
6474 .dig_out_nid = ALC882_DIGOUT_NID,
6475 .dig_in_nid = ALC882_DIGIN_NID,
6476 .unsol_event = alc885_mbp3_unsol_event,
6477 .init_hook = alc885_mbp3_automute,
6480 .mixers = { alc882_macpro_mixer },
6481 .init_verbs = { alc882_macpro_init_verbs },
6482 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6483 .dac_nids = alc882_dac_nids,
6484 .dig_out_nid = ALC882_DIGOUT_NID,
6485 .dig_in_nid = ALC882_DIGIN_NID,
6486 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6487 .channel_mode = alc882_ch_modes,
6488 .input_mux = &alc882_capture_source,
6489 .init_hook = alc885_macpro_init_hook,
6492 .mixers = { alc885_imac24_mixer },
6493 .init_verbs = { alc885_imac24_init_verbs },
6494 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6495 .dac_nids = alc882_dac_nids,
6496 .dig_out_nid = ALC882_DIGOUT_NID,
6497 .dig_in_nid = ALC882_DIGIN_NID,
6498 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6499 .channel_mode = alc882_ch_modes,
6500 .input_mux = &alc882_capture_source,
6501 .unsol_event = alc885_imac24_unsol_event,
6502 .init_hook = alc885_imac24_init_hook,
6505 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6506 alc882_capture_mixer },
6507 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6508 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6509 .dac_nids = alc882_dac_nids,
6510 .dig_out_nid = ALC882_DIGOUT_NID,
6511 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6512 .adc_nids = alc882_adc_nids,
6513 .capsrc_nids = alc882_capsrc_nids,
6514 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6515 .channel_mode = alc882_3ST_6ch_modes,
6517 .input_mux = &alc882_capture_source,
6518 .unsol_event = alc882_targa_unsol_event,
6519 .init_hook = alc882_targa_automute,
6521 [ALC882_ASUS_A7J] = {
6522 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6523 alc882_capture_mixer },
6524 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6525 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6526 .dac_nids = alc882_dac_nids,
6527 .dig_out_nid = ALC882_DIGOUT_NID,
6528 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6529 .adc_nids = alc882_adc_nids,
6530 .capsrc_nids = alc882_capsrc_nids,
6531 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6532 .channel_mode = alc882_3ST_6ch_modes,
6534 .input_mux = &alc882_capture_source,
6536 [ALC882_ASUS_A7M] = {
6537 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6538 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6539 alc880_gpio1_init_verbs,
6540 alc882_asus_a7m_verbs },
6541 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6542 .dac_nids = alc882_dac_nids,
6543 .dig_out_nid = ALC882_DIGOUT_NID,
6544 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6545 .channel_mode = alc880_threestack_modes,
6547 .input_mux = &alc882_capture_source,
6556 PINFIX_ABIT_AW9D_MAX
6559 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6560 { 0x15, 0x01080104 }, /* side */
6561 { 0x16, 0x01011012 }, /* rear */
6562 { 0x17, 0x01016011 }, /* clfe */
6566 static const struct alc_pincfg *alc882_pin_fixes[] = {
6567 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6570 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6571 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6576 * BIOS auto configuration
6578 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6579 hda_nid_t nid, int pin_type,
6583 struct alc_spec *spec = codec->spec;
6586 alc_set_pin_output(codec, nid, pin_type);
6587 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6590 idx = spec->multiout.dac_nids[dac_idx] - 2;
6591 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6595 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6597 struct alc_spec *spec = codec->spec;
6600 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6601 for (i = 0; i <= HDA_SIDE; i++) {
6602 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6603 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6605 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6610 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6612 struct alc_spec *spec = codec->spec;
6615 pin = spec->autocfg.hp_pins[0];
6616 if (pin) /* connect to front */
6618 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6619 pin = spec->autocfg.speaker_pins[0];
6621 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6624 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6625 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6627 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6629 struct alc_spec *spec = codec->spec;
6632 for (i = 0; i < AUTO_PIN_LAST; i++) {
6633 hda_nid_t nid = spec->autocfg.input_pins[i];
6638 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6639 unsigned int pincap;
6640 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6641 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6645 snd_hda_codec_write(codec, nid, 0,
6646 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6647 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6648 snd_hda_codec_write(codec, nid, 0,
6649 AC_VERB_SET_AMP_GAIN_MUTE,
6654 static void alc882_auto_init_input_src(struct hda_codec *codec)
6656 struct alc_spec *spec = codec->spec;
6657 const struct hda_input_mux *imux = spec->input_mux;
6660 for (c = 0; c < spec->num_adc_nids; c++) {
6661 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6662 hda_nid_t nid = spec->capsrc_nids[c];
6663 int conns, mute, idx, item;
6665 conns = snd_hda_get_connections(codec, nid, conn_list,
6666 ARRAY_SIZE(conn_list));
6669 for (idx = 0; idx < conns; idx++) {
6670 /* if the current connection is the selected one,
6671 * unmute it as default - otherwise mute it
6673 mute = AMP_IN_MUTE(idx);
6674 for (item = 0; item < imux->num_items; item++) {
6675 if (imux->items[item].index == idx) {
6676 if (spec->cur_mux[c] == item)
6677 mute = AMP_IN_UNMUTE(idx);
6681 snd_hda_codec_write(codec, nid, 0,
6682 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6687 /* add mic boosts if needed */
6688 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6690 struct alc_spec *spec = codec->spec;
6694 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6695 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6696 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6698 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6702 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6703 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6704 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6706 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6713 /* almost identical with ALC880 parser... */
6714 static int alc882_parse_auto_config(struct hda_codec *codec)
6716 struct alc_spec *spec = codec->spec;
6717 int err = alc880_parse_auto_config(codec);
6722 return 0; /* no config found */
6724 err = alc_auto_add_mic_boost(codec);
6728 /* hack - override the init verbs */
6729 spec->init_verbs[0] = alc882_auto_init_verbs;
6731 return 1; /* config found */
6734 /* additional initialization for auto-configuration model */
6735 static void alc882_auto_init(struct hda_codec *codec)
6737 struct alc_spec *spec = codec->spec;
6738 alc882_auto_init_multi_out(codec);
6739 alc882_auto_init_hp_out(codec);
6740 alc882_auto_init_analog_input(codec);
6741 alc882_auto_init_input_src(codec);
6742 if (spec->unsol_event)
6743 alc_inithook(codec);
6746 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6748 static int patch_alc882(struct hda_codec *codec)
6750 struct alc_spec *spec;
6751 int err, board_config;
6753 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6759 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6763 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6764 /* Pick up systems that don't supply PCI SSID */
6765 switch (codec->subsystem_id) {
6766 case 0x106b0c00: /* Mac Pro */
6767 board_config = ALC885_MACPRO;
6769 case 0x106b1000: /* iMac 24 */
6770 case 0x106b2800: /* AppleTV */
6771 board_config = ALC885_IMAC24;
6773 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6774 case 0x106b00a4: /* MacbookPro4,1 */
6775 case 0x106b2c00: /* Macbook Pro rev3 */
6776 case 0x106b3600: /* Macbook 3.1 */
6777 board_config = ALC885_MBP3;
6780 /* ALC889A is handled better as ALC888-compatible */
6781 if (codec->revision_id == 0x100101 ||
6782 codec->revision_id == 0x100103) {
6784 return patch_alc883(codec);
6786 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6787 "trying auto-probe from BIOS...\n");
6788 board_config = ALC882_AUTO;
6792 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6794 if (board_config == ALC882_AUTO) {
6795 /* automatic parse from the BIOS config */
6796 err = alc882_parse_auto_config(codec);
6802 "hda_codec: Cannot set up configuration "
6803 "from BIOS. Using base mode...\n");
6804 board_config = ALC882_3ST_DIG;
6808 if (board_config != ALC882_AUTO)
6809 setup_preset(spec, &alc882_presets[board_config]);
6811 if (codec->vendor_id == 0x10ec0885) {
6812 spec->stream_name_analog = "ALC885 Analog";
6813 spec->stream_name_digital = "ALC885 Digital";
6815 spec->stream_name_analog = "ALC882 Analog";
6816 spec->stream_name_digital = "ALC882 Digital";
6819 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6820 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6821 /* FIXME: setup DAC5 */
6822 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6823 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6825 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6826 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6828 if (!spec->adc_nids && spec->input_mux) {
6829 /* check whether NID 0x07 is valid */
6830 unsigned int wcap = get_wcaps(codec, 0x07);
6832 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6833 if (wcap != AC_WID_AUD_IN) {
6834 spec->adc_nids = alc882_adc_nids_alt;
6835 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6836 spec->capsrc_nids = alc882_capsrc_nids_alt;
6837 spec->mixers[spec->num_mixers] =
6838 alc882_capture_alt_mixer;
6841 spec->adc_nids = alc882_adc_nids;
6842 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6843 spec->capsrc_nids = alc882_capsrc_nids;
6844 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6849 spec->vmaster_nid = 0x0c;
6851 codec->patch_ops = alc_patch_ops;
6852 if (board_config == ALC882_AUTO)
6853 spec->init_hook = alc882_auto_init;
6854 #ifdef CONFIG_SND_HDA_POWER_SAVE
6855 if (!spec->loopback.amplist)
6856 spec->loopback.amplist = alc882_loopbacks;
6865 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6866 * configuration. Each pin widget can choose any input DACs and a mixer.
6867 * Each ADC is connected from a mixer of all inputs. This makes possible
6868 * 6-channel independent captures.
6870 * In addition, an independent DAC for the multi-playback (not used in this
6873 #define ALC883_DIGOUT_NID 0x06
6874 #define ALC883_DIGIN_NID 0x0a
6876 static hda_nid_t alc883_dac_nids[4] = {
6877 /* front, rear, clfe, rear_surr */
6878 0x02, 0x03, 0x04, 0x05
6881 static hda_nid_t alc883_adc_nids[2] = {
6886 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6889 /* FIXME: should be a matrix-type input source selection */
6891 static struct hda_input_mux alc883_capture_source = {
6895 { "Front Mic", 0x1 },
6901 static struct hda_input_mux alc883_3stack_6ch_intel = {
6905 { "Front Mic", 0x0 },
6911 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6919 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6929 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6937 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6941 { "Front Mic", 0x1 },
6946 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6954 #define alc883_mux_enum_info alc_mux_enum_info
6955 #define alc883_mux_enum_get alc_mux_enum_get
6956 /* ALC883 has the ALC882-type input selection */
6957 #define alc883_mux_enum_put alc882_mux_enum_put
6962 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6969 static struct hda_verb alc883_3ST_ch2_init[] = {
6970 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6971 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6972 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6973 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6980 static struct hda_verb alc883_3ST_ch4_init[] = {
6981 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6982 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6983 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6984 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6985 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6992 static struct hda_verb alc883_3ST_ch6_init[] = {
6993 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6994 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6995 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6996 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6997 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6998 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7002 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7003 { 2, alc883_3ST_ch2_init },
7004 { 4, alc883_3ST_ch4_init },
7005 { 6, alc883_3ST_ch6_init },
7011 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7012 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7013 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7014 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7015 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7022 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7023 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7024 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7025 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7026 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7027 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7034 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7035 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7036 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7037 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7038 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7039 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7040 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7044 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7045 { 2, alc883_3ST_ch2_intel_init },
7046 { 4, alc883_3ST_ch4_intel_init },
7047 { 6, alc883_3ST_ch6_intel_init },
7053 static struct hda_verb alc883_sixstack_ch6_init[] = {
7054 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7055 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7056 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7057 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7064 static struct hda_verb alc883_sixstack_ch8_init[] = {
7065 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7066 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7067 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7068 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7072 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7073 { 6, alc883_sixstack_ch6_init },
7074 { 8, alc883_sixstack_ch8_init },
7077 static struct hda_verb alc883_medion_eapd_verbs[] = {
7078 /* eanable EAPD on medion laptop */
7079 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7080 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7084 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7085 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7088 static struct snd_kcontrol_new alc883_base_mixer[] = {
7089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7090 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7091 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7092 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7093 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7094 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7095 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7096 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7098 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7100 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7101 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7102 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7103 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7105 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7107 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7108 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7109 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7110 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7111 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7112 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7113 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7114 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7115 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7118 /* .name = "Capture Source", */
7119 .name = "Input Source",
7121 .info = alc883_mux_enum_info,
7122 .get = alc883_mux_enum_get,
7123 .put = alc883_mux_enum_put,
7128 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7129 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7130 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7131 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7132 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7133 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7134 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7135 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7139 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7140 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7141 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7142 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7143 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7144 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7145 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7147 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7148 /* .name = "Capture Source", */
7149 .name = "Input Source",
7151 .info = alc883_mux_enum_info,
7152 .get = alc883_mux_enum_get,
7153 .put = alc883_mux_enum_put,
7158 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7159 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7160 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7161 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7162 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7167 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7168 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7169 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7170 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7171 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7172 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7174 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7175 /* .name = "Capture Source", */
7176 .name = "Input Source",
7178 .info = alc883_mux_enum_info,
7179 .get = alc883_mux_enum_get,
7180 .put = alc883_mux_enum_put,
7185 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7186 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7187 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7188 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7189 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7191 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7192 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7193 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7194 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7195 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7196 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7197 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7198 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7199 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7201 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7202 /* .name = "Capture Source", */
7203 .name = "Input Source",
7205 .info = alc883_mux_enum_info,
7206 .get = alc883_mux_enum_get,
7207 .put = alc883_mux_enum_put,
7212 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7213 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7214 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7215 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7221 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7223 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7224 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7225 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7226 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7227 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7228 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7229 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7230 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7231 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7234 /* .name = "Capture Source", */
7235 .name = "Input Source",
7237 .info = alc883_mux_enum_info,
7238 .get = alc883_mux_enum_get,
7239 .put = alc883_mux_enum_put,
7244 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7246 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7247 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7248 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7249 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7250 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7251 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7252 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7253 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7254 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7255 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7257 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7259 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7260 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7261 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7262 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7263 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7264 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7265 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7266 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7267 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7269 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7270 /* .name = "Capture Source", */
7271 .name = "Input Source",
7273 .info = alc883_mux_enum_info,
7274 .get = alc883_mux_enum_get,
7275 .put = alc883_mux_enum_put,
7280 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7281 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7282 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7283 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7284 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7285 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7287 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7288 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7289 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7291 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7292 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7293 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7294 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7296 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7298 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7299 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7300 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7301 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7302 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7303 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7304 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7305 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7306 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7308 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7309 /* .name = "Capture Source", */
7310 .name = "Input Source",
7312 .info = alc883_mux_enum_info,
7313 .get = alc883_mux_enum_get,
7314 .put = alc883_mux_enum_put,
7319 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7320 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7321 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7322 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7323 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7324 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7325 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7326 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7327 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7330 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7331 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7332 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7333 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7334 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7336 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7337 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7338 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7339 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7340 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7341 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7342 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7345 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7346 /* .name = "Capture Source", */
7347 .name = "Input Source",
7349 .info = alc883_mux_enum_info,
7350 .get = alc883_mux_enum_get,
7351 .put = alc883_mux_enum_put,
7356 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7357 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7358 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7359 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7360 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7361 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7362 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7363 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7364 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7365 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7366 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7367 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7368 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7369 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7371 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7372 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7373 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7374 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7375 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7376 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7378 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7379 /* .name = "Capture Source", */
7380 .name = "Input Source",
7382 .info = alc883_mux_enum_info,
7383 .get = alc883_mux_enum_get,
7384 .put = alc883_mux_enum_put,
7389 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7390 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7391 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7392 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7393 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7394 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7396 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7397 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7398 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7399 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7400 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7401 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7402 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7403 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7404 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7407 /* .name = "Capture Source", */
7408 .name = "Input Source",
7410 .info = alc883_mux_enum_info,
7411 .get = alc883_mux_enum_get,
7412 .put = alc883_mux_enum_put,
7417 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7418 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7419 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7421 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7422 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7426 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7427 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7429 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7430 /* .name = "Capture Source", */
7431 .name = "Input Source",
7433 .info = alc883_mux_enum_info,
7434 .get = alc883_mux_enum_get,
7435 .put = alc883_mux_enum_put,
7440 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7441 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7442 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7443 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7444 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7445 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7446 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7447 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7448 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7449 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7450 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7451 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7452 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7453 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7455 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7456 /* .name = "Capture Source", */
7457 .name = "Input Source",
7459 .info = alc883_mux_enum_info,
7460 .get = alc883_mux_enum_get,
7461 .put = alc883_mux_enum_put,
7466 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7467 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7469 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7470 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7471 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7475 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7477 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7478 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7479 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7481 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7482 /* .name = "Capture Source", */
7483 .name = "Input Source",
7485 .info = alc883_mux_enum_info,
7486 .get = alc883_mux_enum_get,
7487 .put = alc883_mux_enum_put,
7492 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7493 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7494 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7495 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7496 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7497 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7499 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7500 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7501 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7502 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7503 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7504 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7506 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7507 /* .name = "Capture Source", */
7508 .name = "Input Source",
7510 .info = alc883_mux_enum_info,
7511 .get = alc883_mux_enum_get,
7512 .put = alc883_mux_enum_put,
7517 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7518 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7519 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7520 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7521 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7522 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7523 0x0d, 1, 0x0, HDA_OUTPUT),
7524 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7525 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7526 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7527 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7528 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7529 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7530 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7531 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7532 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7533 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7534 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7535 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7538 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7539 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7540 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7541 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7542 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7543 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7544 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7546 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7547 /* .name = "Capture Source", */
7548 .name = "Input Source",
7550 .info = alc883_mux_enum_info,
7551 .get = alc883_mux_enum_get,
7552 .put = alc883_mux_enum_put,
7557 static struct hda_bind_ctls alc883_bind_cap_vol = {
7558 .ops = &snd_hda_bind_vol,
7560 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7561 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7566 static struct hda_bind_ctls alc883_bind_cap_switch = {
7567 .ops = &snd_hda_bind_sw,
7569 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7570 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7575 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7579 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7580 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7581 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7582 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7584 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7585 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7587 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7588 /* .name = "Capture Source", */
7589 .name = "Input Source",
7591 .info = alc883_mux_enum_info,
7592 .get = alc883_mux_enum_get,
7593 .put = alc883_mux_enum_put,
7598 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7600 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7601 .name = "Channel Mode",
7602 .info = alc_ch_mode_info,
7603 .get = alc_ch_mode_get,
7604 .put = alc_ch_mode_put,
7609 static struct hda_verb alc883_init_verbs[] = {
7610 /* ADC1: mute amp left and right */
7611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7612 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7613 /* ADC2: mute amp left and right */
7614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7615 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7616 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7627 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7631 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7633 /* mute analog input loopbacks */
7634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7635 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7636 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7637 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7638 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7640 /* Front Pin: output 0 (0x0c) */
7641 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7642 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7643 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7644 /* Rear Pin: output 1 (0x0d) */
7645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7647 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7648 /* CLFE Pin: output 2 (0x0e) */
7649 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7650 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7651 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7652 /* Side Pin: output 3 (0x0f) */
7653 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7654 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7655 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7656 /* Mic (rear) pin: input vref at 80% */
7657 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7658 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7659 /* Front Mic pin: input vref at 80% */
7660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7661 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7662 /* Line In pin: input */
7663 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7664 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7665 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7666 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7667 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7668 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7669 /* CD pin widget for input */
7670 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7672 /* FIXME: use matrix-type input source selection */
7673 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7675 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7676 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7687 /* toggle speaker-output according to the hp-jack state */
7688 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7690 unsigned int present;
7692 present = snd_hda_codec_read(codec, 0x15, 0,
7693 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7694 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7695 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7696 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7697 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7700 /* auto-toggle front mic */
7702 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7704 unsigned int present;
7707 present = snd_hda_codec_read(codec, 0x18, 0,
7708 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7709 bits = present ? HDA_AMP_MUTE : 0;
7710 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7714 static void alc883_mitac_automute(struct hda_codec *codec)
7716 alc883_mitac_hp_automute(codec);
7717 /* alc883_mitac_mic_automute(codec); */
7720 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7723 switch (res >> 26) {
7724 case ALC880_HP_EVENT:
7725 alc883_mitac_hp_automute(codec);
7727 case ALC880_MIC_EVENT:
7728 /* alc883_mitac_mic_automute(codec); */
7733 static struct hda_verb alc883_mitac_verbs[] = {
7735 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7738 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7739 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7741 /* enable unsolicited event */
7742 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7743 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7748 static struct hda_verb alc883_clevo_m720_verbs[] = {
7750 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7753 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7754 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7756 /* enable unsolicited event */
7757 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7758 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7763 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7765 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7768 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7771 /* enable unsolicited event */
7772 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7777 static struct hda_verb alc883_tagra_verbs[] = {
7778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7782 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7784 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7785 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7786 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7788 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7789 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7790 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7791 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7796 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7797 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7798 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7799 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7803 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7804 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7805 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7806 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7811 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7814 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7815 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7816 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7820 static struct hda_verb alc883_haier_w66_verbs[] = {
7821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7824 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7826 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7827 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7828 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7833 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7835 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7836 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7837 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7838 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7839 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7840 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7841 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7845 static struct hda_verb alc888_3st_hp_verbs[] = {
7846 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7847 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7848 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7852 static struct hda_verb alc888_6st_dell_verbs[] = {
7853 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7857 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7858 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7859 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7860 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7861 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7865 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7866 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7867 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7868 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7869 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7873 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7874 { 2, alc888_3st_hp_2ch_init },
7875 { 6, alc888_3st_hp_6ch_init },
7878 /* toggle front-jack and RCA according to the hp-jack state */
7879 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7881 unsigned int present;
7883 present = snd_hda_codec_read(codec, 0x1b, 0,
7884 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7885 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7886 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7887 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7888 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7891 /* toggle RCA according to the front-jack state */
7892 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7894 unsigned int present;
7896 present = snd_hda_codec_read(codec, 0x14, 0,
7897 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7898 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7899 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7902 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7905 if ((res >> 26) == ALC880_HP_EVENT)
7906 alc888_lenovo_ms7195_front_automute(codec);
7907 if ((res >> 26) == ALC880_FRONT_EVENT)
7908 alc888_lenovo_ms7195_rca_automute(codec);
7911 static struct hda_verb alc883_medion_md2_verbs[] = {
7912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7917 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7921 /* toggle speaker-output according to the hp-jack state */
7922 static void alc883_medion_md2_automute(struct hda_codec *codec)
7924 unsigned int present;
7926 present = snd_hda_codec_read(codec, 0x14, 0,
7927 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7928 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7929 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7932 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7935 if ((res >> 26) == ALC880_HP_EVENT)
7936 alc883_medion_md2_automute(codec);
7939 /* toggle speaker-output according to the hp-jack state */
7940 static void alc883_tagra_automute(struct hda_codec *codec)
7942 unsigned int present;
7945 present = snd_hda_codec_read(codec, 0x14, 0,
7946 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7947 bits = present ? HDA_AMP_MUTE : 0;
7948 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7949 HDA_AMP_MUTE, bits);
7950 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7954 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7956 if ((res >> 26) == ALC880_HP_EVENT)
7957 alc883_tagra_automute(codec);
7960 /* toggle speaker-output according to the hp-jack state */
7961 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7963 unsigned int present;
7966 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7967 & AC_PINSENSE_PRESENCE;
7968 bits = present ? HDA_AMP_MUTE : 0;
7969 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7970 HDA_AMP_MUTE, bits);
7973 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7975 unsigned int present;
7977 present = snd_hda_codec_read(codec, 0x18, 0,
7978 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7979 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7980 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7983 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7985 alc883_clevo_m720_hp_automute(codec);
7986 alc883_clevo_m720_mic_automute(codec);
7989 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7992 switch (res >> 26) {
7993 case ALC880_HP_EVENT:
7994 alc883_clevo_m720_hp_automute(codec);
7996 case ALC880_MIC_EVENT:
7997 alc883_clevo_m720_mic_automute(codec);
8002 /* toggle speaker-output according to the hp-jack state */
8003 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8005 unsigned int present;
8008 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8009 & AC_PINSENSE_PRESENCE;
8010 bits = present ? HDA_AMP_MUTE : 0;
8011 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8012 HDA_AMP_MUTE, bits);
8015 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8018 if ((res >> 26) == ALC880_HP_EVENT)
8019 alc883_2ch_fujitsu_pi2515_automute(codec);
8022 static void alc883_haier_w66_automute(struct hda_codec *codec)
8024 unsigned int present;
8027 present = snd_hda_codec_read(codec, 0x1b, 0,
8028 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8029 bits = present ? 0x80 : 0;
8030 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8034 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8037 if ((res >> 26) == ALC880_HP_EVENT)
8038 alc883_haier_w66_automute(codec);
8041 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8043 unsigned int present;
8046 present = snd_hda_codec_read(codec, 0x14, 0,
8047 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8048 bits = present ? HDA_AMP_MUTE : 0;
8049 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8050 HDA_AMP_MUTE, bits);
8053 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8055 unsigned int present;
8058 present = snd_hda_codec_read(codec, 0x1b, 0,
8059 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8060 bits = present ? HDA_AMP_MUTE : 0;
8061 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8062 HDA_AMP_MUTE, bits);
8063 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8064 HDA_AMP_MUTE, bits);
8067 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8070 if ((res >> 26) == ALC880_HP_EVENT)
8071 alc883_lenovo_101e_all_automute(codec);
8072 if ((res >> 26) == ALC880_FRONT_EVENT)
8073 alc883_lenovo_101e_ispeaker_automute(codec);
8076 /* toggle speaker-output according to the hp-jack state */
8077 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8079 unsigned int present;
8081 present = snd_hda_codec_read(codec, 0x14, 0,
8082 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8083 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8084 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8085 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8086 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8089 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8092 if ((res >> 26) == ALC880_HP_EVENT)
8093 alc883_acer_aspire_automute(codec);
8096 static struct hda_verb alc883_acer_eapd_verbs[] = {
8097 /* HP Pin: output 0 (0x0c) */
8098 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8099 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8100 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8101 /* Front Pin: output 0 (0x0c) */
8102 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8103 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8104 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8105 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8106 /* eanable EAPD on medion laptop */
8107 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8108 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8109 /* enable unsolicited event */
8110 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8114 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8116 unsigned int present;
8118 present = snd_hda_codec_read(codec, 0x1b, 0,
8119 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8120 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8121 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8122 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8123 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8124 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8125 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8126 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8127 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8130 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8133 switch (res >> 26) {
8134 case ALC880_HP_EVENT:
8135 printk("hp_event\n");
8136 alc888_6st_dell_front_automute(codec);
8141 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8144 unsigned int present;
8146 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8147 present = snd_hda_codec_read(codec, 0x1b, 0,
8148 AC_VERB_GET_PIN_SENSE, 0);
8149 present = (present & 0x80000000) != 0;
8151 /* mute internal speaker */
8152 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8153 HDA_AMP_MUTE, HDA_AMP_MUTE);
8154 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8155 HDA_AMP_MUTE, HDA_AMP_MUTE);
8156 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8157 HDA_AMP_MUTE, HDA_AMP_MUTE);
8158 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8159 HDA_AMP_MUTE, HDA_AMP_MUTE);
8160 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8161 HDA_AMP_MUTE, HDA_AMP_MUTE);
8163 /* unmute internal speaker if necessary */
8164 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8165 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8166 HDA_AMP_MUTE, mute);
8167 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8168 HDA_AMP_MUTE, mute);
8169 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8170 HDA_AMP_MUTE, mute);
8171 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8172 HDA_AMP_MUTE, mute);
8173 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8174 HDA_AMP_MUTE, mute);
8178 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8181 if ((res >> 26) == ALC880_HP_EVENT)
8182 alc888_lenovo_sky_front_automute(codec);
8186 * generic initialization of ADC, input mixers and output mixers
8188 static struct hda_verb alc883_auto_init_verbs[] = {
8190 * Unmute ADC0-2 and set the default input to mic-in
8192 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8193 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8194 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8195 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8197 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8199 * Note: PASD motherboards uses the Line In 2 as the input for
8200 * front panel mic (mic 2)
8202 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8205 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8206 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8207 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8210 * Set up output mixers (0x0c - 0x0f)
8212 /* set vol=0 to output mixers */
8213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8214 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8215 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8217 /* set up input amps for analog loopback */
8218 /* Amp Indices: DAC = 0, mixer = 1 */
8219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8220 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8221 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8222 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8223 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8224 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8225 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8226 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8227 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8228 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8230 /* FIXME: use matrix-type input source selection */
8231 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8233 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8235 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8236 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8237 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8239 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8240 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8241 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8242 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8243 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8248 /* capture mixer elements */
8249 static struct snd_kcontrol_new alc883_capture_mixer[] = {
8250 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8251 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8252 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
8253 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
8255 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8256 /* The multiple "Capture Source" controls confuse alsamixer
8257 * So call somewhat different..
8259 /* .name = "Capture Source", */
8260 .name = "Input Source",
8262 .info = alc882_mux_enum_info,
8263 .get = alc882_mux_enum_get,
8264 .put = alc882_mux_enum_put,
8269 static struct hda_verb alc888_asus_m90v_verbs[] = {
8270 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8273 /* enable unsolicited event */
8274 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8275 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8279 static void alc883_nb_mic_automute(struct hda_codec *codec)
8281 unsigned int present;
8283 present = snd_hda_codec_read(codec, 0x18, 0,
8284 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8285 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8286 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8287 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8288 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8291 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8293 unsigned int present;
8296 present = snd_hda_codec_read(codec, 0x1b, 0,
8297 AC_VERB_GET_PIN_SENSE, 0)
8298 & AC_PINSENSE_PRESENCE;
8299 bits = present ? 0 : PIN_OUT;
8300 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8302 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8304 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8308 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8311 switch (res >> 26) {
8312 case ALC880_HP_EVENT:
8313 alc883_M90V_speaker_automute(codec);
8315 case ALC880_MIC_EVENT:
8316 alc883_nb_mic_automute(codec);
8321 static void alc883_mode2_inithook(struct hda_codec *codec)
8323 alc883_M90V_speaker_automute(codec);
8324 alc883_nb_mic_automute(codec);
8327 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8329 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8333 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8334 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8335 /* enable unsolicited event */
8336 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8340 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8342 unsigned int present;
8345 present = snd_hda_codec_read(codec, 0x14, 0,
8346 AC_VERB_GET_PIN_SENSE, 0)
8347 & AC_PINSENSE_PRESENCE;
8348 bits = present ? 0 : PIN_OUT;
8349 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8353 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8356 switch (res >> 26) {
8357 case ALC880_HP_EVENT:
8358 alc883_eee1601_speaker_automute(codec);
8363 static void alc883_eee1601_inithook(struct hda_codec *codec)
8365 alc883_eee1601_speaker_automute(codec);
8368 #ifdef CONFIG_SND_HDA_POWER_SAVE
8369 #define alc883_loopbacks alc880_loopbacks
8372 /* pcm configuration: identiacal with ALC880 */
8373 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8374 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8375 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8376 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8377 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8380 * configuration and preset
8382 static const char *alc883_models[ALC883_MODEL_LAST] = {
8383 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8384 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8385 [ALC883_3ST_6ch] = "3stack-6ch",
8386 [ALC883_6ST_DIG] = "6stack-dig",
8387 [ALC883_TARGA_DIG] = "targa-dig",
8388 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8389 [ALC883_ACER] = "acer",
8390 [ALC883_ACER_ASPIRE] = "acer-aspire",
8391 [ALC883_MEDION] = "medion",
8392 [ALC883_MEDION_MD2] = "medion-md2",
8393 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8394 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8395 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8396 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8397 [ALC888_LENOVO_SKY] = "lenovo-sky",
8398 [ALC883_HAIER_W66] = "haier-w66",
8399 [ALC888_3ST_HP] = "3stack-hp",
8400 [ALC888_6ST_DELL] = "6stack-dell",
8401 [ALC883_MITAC] = "mitac",
8402 [ALC883_CLEVO_M720] = "clevo-m720",
8403 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8404 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8405 [ALC883_AUTO] = "auto",
8408 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8409 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8410 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8411 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8412 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8413 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8414 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8415 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8416 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8417 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8418 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8419 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8420 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8421 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8422 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8423 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8424 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8425 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8426 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8427 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8428 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8429 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8430 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8431 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8432 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8433 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8434 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8435 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8436 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8437 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8438 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8439 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8440 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8441 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8442 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8443 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8444 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8445 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8446 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8447 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8448 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8449 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8450 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8451 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8452 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8453 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8454 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8455 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8456 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8457 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8458 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8459 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8460 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8461 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8462 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8463 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8464 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8465 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8466 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8467 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8468 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8469 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8473 static struct alc_config_preset alc883_presets[] = {
8474 [ALC883_3ST_2ch_DIG] = {
8475 .mixers = { alc883_3ST_2ch_mixer },
8476 .init_verbs = { alc883_init_verbs },
8477 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8478 .dac_nids = alc883_dac_nids,
8479 .dig_out_nid = ALC883_DIGOUT_NID,
8480 .dig_in_nid = ALC883_DIGIN_NID,
8481 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8482 .channel_mode = alc883_3ST_2ch_modes,
8483 .input_mux = &alc883_capture_source,
8485 [ALC883_3ST_6ch_DIG] = {
8486 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8487 .init_verbs = { alc883_init_verbs },
8488 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8489 .dac_nids = alc883_dac_nids,
8490 .dig_out_nid = ALC883_DIGOUT_NID,
8491 .dig_in_nid = ALC883_DIGIN_NID,
8492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8493 .channel_mode = alc883_3ST_6ch_modes,
8495 .input_mux = &alc883_capture_source,
8497 [ALC883_3ST_6ch] = {
8498 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8499 .init_verbs = { alc883_init_verbs },
8500 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8501 .dac_nids = alc883_dac_nids,
8502 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8503 .channel_mode = alc883_3ST_6ch_modes,
8505 .input_mux = &alc883_capture_source,
8507 [ALC883_3ST_6ch_INTEL] = {
8508 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8509 .init_verbs = { alc883_init_verbs },
8510 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8511 .dac_nids = alc883_dac_nids,
8512 .dig_out_nid = ALC883_DIGOUT_NID,
8513 .dig_in_nid = ALC883_DIGIN_NID,
8514 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8515 .channel_mode = alc883_3ST_6ch_intel_modes,
8517 .input_mux = &alc883_3stack_6ch_intel,
8519 [ALC883_6ST_DIG] = {
8520 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8521 .init_verbs = { alc883_init_verbs },
8522 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8523 .dac_nids = alc883_dac_nids,
8524 .dig_out_nid = ALC883_DIGOUT_NID,
8525 .dig_in_nid = ALC883_DIGIN_NID,
8526 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8527 .channel_mode = alc883_sixstack_modes,
8528 .input_mux = &alc883_capture_source,
8530 [ALC883_TARGA_DIG] = {
8531 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8532 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8533 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8534 .dac_nids = alc883_dac_nids,
8535 .dig_out_nid = ALC883_DIGOUT_NID,
8536 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8537 .channel_mode = alc883_3ST_6ch_modes,
8539 .input_mux = &alc883_capture_source,
8540 .unsol_event = alc883_tagra_unsol_event,
8541 .init_hook = alc883_tagra_automute,
8543 [ALC883_TARGA_2ch_DIG] = {
8544 .mixers = { alc883_tagra_2ch_mixer},
8545 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8546 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8547 .dac_nids = alc883_dac_nids,
8548 .dig_out_nid = ALC883_DIGOUT_NID,
8549 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8550 .channel_mode = alc883_3ST_2ch_modes,
8551 .input_mux = &alc883_capture_source,
8552 .unsol_event = alc883_tagra_unsol_event,
8553 .init_hook = alc883_tagra_automute,
8556 .mixers = { alc883_base_mixer },
8557 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8558 * and the headphone jack. Turn this on and rely on the
8559 * standard mute methods whenever the user wants to turn
8560 * these outputs off.
8562 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8563 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8564 .dac_nids = alc883_dac_nids,
8565 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8566 .channel_mode = alc883_3ST_2ch_modes,
8567 .input_mux = &alc883_capture_source,
8569 [ALC883_ACER_ASPIRE] = {
8570 .mixers = { alc883_acer_aspire_mixer },
8571 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8572 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8573 .dac_nids = alc883_dac_nids,
8574 .dig_out_nid = ALC883_DIGOUT_NID,
8575 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8576 .channel_mode = alc883_3ST_2ch_modes,
8577 .input_mux = &alc883_capture_source,
8578 .unsol_event = alc883_acer_aspire_unsol_event,
8579 .init_hook = alc883_acer_aspire_automute,
8582 .mixers = { alc883_fivestack_mixer,
8583 alc883_chmode_mixer },
8584 .init_verbs = { alc883_init_verbs,
8585 alc883_medion_eapd_verbs },
8586 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8587 .dac_nids = alc883_dac_nids,
8588 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8589 .channel_mode = alc883_sixstack_modes,
8590 .input_mux = &alc883_capture_source,
8592 [ALC883_MEDION_MD2] = {
8593 .mixers = { alc883_medion_md2_mixer},
8594 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8595 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8596 .dac_nids = alc883_dac_nids,
8597 .dig_out_nid = ALC883_DIGOUT_NID,
8598 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8599 .channel_mode = alc883_3ST_2ch_modes,
8600 .input_mux = &alc883_capture_source,
8601 .unsol_event = alc883_medion_md2_unsol_event,
8602 .init_hook = alc883_medion_md2_automute,
8604 [ALC883_LAPTOP_EAPD] = {
8605 .mixers = { alc883_base_mixer },
8606 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8607 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8608 .dac_nids = alc883_dac_nids,
8609 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8610 .channel_mode = alc883_3ST_2ch_modes,
8611 .input_mux = &alc883_capture_source,
8613 [ALC883_CLEVO_M720] = {
8614 .mixers = { alc883_clevo_m720_mixer },
8615 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8616 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8617 .dac_nids = alc883_dac_nids,
8618 .dig_out_nid = ALC883_DIGOUT_NID,
8619 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8620 .channel_mode = alc883_3ST_2ch_modes,
8621 .input_mux = &alc883_capture_source,
8622 .unsol_event = alc883_clevo_m720_unsol_event,
8623 .init_hook = alc883_clevo_m720_automute,
8625 [ALC883_LENOVO_101E_2ch] = {
8626 .mixers = { alc883_lenovo_101e_2ch_mixer},
8627 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8628 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8629 .dac_nids = alc883_dac_nids,
8630 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8631 .channel_mode = alc883_3ST_2ch_modes,
8632 .input_mux = &alc883_lenovo_101e_capture_source,
8633 .unsol_event = alc883_lenovo_101e_unsol_event,
8634 .init_hook = alc883_lenovo_101e_all_automute,
8636 [ALC883_LENOVO_NB0763] = {
8637 .mixers = { alc883_lenovo_nb0763_mixer },
8638 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8639 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8640 .dac_nids = alc883_dac_nids,
8641 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8642 .channel_mode = alc883_3ST_2ch_modes,
8644 .input_mux = &alc883_lenovo_nb0763_capture_source,
8645 .unsol_event = alc883_medion_md2_unsol_event,
8646 .init_hook = alc883_medion_md2_automute,
8648 [ALC888_LENOVO_MS7195_DIG] = {
8649 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8650 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8651 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8652 .dac_nids = alc883_dac_nids,
8653 .dig_out_nid = ALC883_DIGOUT_NID,
8654 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8655 .channel_mode = alc883_3ST_6ch_modes,
8657 .input_mux = &alc883_capture_source,
8658 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8659 .init_hook = alc888_lenovo_ms7195_front_automute,
8661 [ALC883_HAIER_W66] = {
8662 .mixers = { alc883_tagra_2ch_mixer},
8663 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8664 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8665 .dac_nids = alc883_dac_nids,
8666 .dig_out_nid = ALC883_DIGOUT_NID,
8667 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8668 .channel_mode = alc883_3ST_2ch_modes,
8669 .input_mux = &alc883_capture_source,
8670 .unsol_event = alc883_haier_w66_unsol_event,
8671 .init_hook = alc883_haier_w66_automute,
8674 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8675 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8676 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8677 .dac_nids = alc883_dac_nids,
8678 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8679 .channel_mode = alc888_3st_hp_modes,
8681 .input_mux = &alc883_capture_source,
8683 [ALC888_6ST_DELL] = {
8684 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8685 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8686 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8687 .dac_nids = alc883_dac_nids,
8688 .dig_out_nid = ALC883_DIGOUT_NID,
8689 .dig_in_nid = ALC883_DIGIN_NID,
8690 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8691 .channel_mode = alc883_sixstack_modes,
8692 .input_mux = &alc883_capture_source,
8693 .unsol_event = alc888_6st_dell_unsol_event,
8694 .init_hook = alc888_6st_dell_front_automute,
8697 .mixers = { alc883_mitac_mixer },
8698 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8699 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8700 .dac_nids = alc883_dac_nids,
8701 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8702 .channel_mode = alc883_3ST_2ch_modes,
8703 .input_mux = &alc883_capture_source,
8704 .unsol_event = alc883_mitac_unsol_event,
8705 .init_hook = alc883_mitac_automute,
8707 [ALC883_FUJITSU_PI2515] = {
8708 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8709 .init_verbs = { alc883_init_verbs,
8710 alc883_2ch_fujitsu_pi2515_verbs},
8711 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8712 .dac_nids = alc883_dac_nids,
8713 .dig_out_nid = ALC883_DIGOUT_NID,
8714 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8715 .channel_mode = alc883_3ST_2ch_modes,
8716 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8717 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8718 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8720 [ALC888_LENOVO_SKY] = {
8721 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8722 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8723 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8724 .dac_nids = alc883_dac_nids,
8725 .dig_out_nid = ALC883_DIGOUT_NID,
8726 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
8727 .adc_nids = alc883_adc_nids,
8728 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8729 .channel_mode = alc883_sixstack_modes,
8731 .input_mux = &alc883_lenovo_sky_capture_source,
8732 .unsol_event = alc883_lenovo_sky_unsol_event,
8733 .init_hook = alc888_lenovo_sky_front_automute,
8735 [ALC888_ASUS_M90V] = {
8736 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8737 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8738 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8739 .dac_nids = alc883_dac_nids,
8740 .dig_out_nid = ALC883_DIGOUT_NID,
8741 .dig_in_nid = ALC883_DIGIN_NID,
8742 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8743 .channel_mode = alc883_3ST_6ch_modes,
8745 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8746 .unsol_event = alc883_mode2_unsol_event,
8747 .init_hook = alc883_mode2_inithook,
8749 [ALC888_ASUS_EEE1601] = {
8750 .mixers = { alc883_asus_eee1601_mixer },
8751 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8752 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8753 .dac_nids = alc883_dac_nids,
8754 .dig_out_nid = ALC883_DIGOUT_NID,
8755 .dig_in_nid = ALC883_DIGIN_NID,
8756 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8757 .channel_mode = alc883_3ST_2ch_modes,
8759 .input_mux = &alc883_asus_eee1601_capture_source,
8760 .unsol_event = alc883_eee1601_unsol_event,
8761 .init_hook = alc883_eee1601_inithook,
8767 * BIOS auto configuration
8769 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8770 hda_nid_t nid, int pin_type,
8774 struct alc_spec *spec = codec->spec;
8777 alc_set_pin_output(codec, nid, pin_type);
8778 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8781 idx = spec->multiout.dac_nids[dac_idx] - 2;
8782 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8786 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8788 struct alc_spec *spec = codec->spec;
8791 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8792 for (i = 0; i <= HDA_SIDE; i++) {
8793 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8794 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8796 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8801 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8803 struct alc_spec *spec = codec->spec;
8806 pin = spec->autocfg.hp_pins[0];
8807 if (pin) /* connect to front */
8809 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8810 pin = spec->autocfg.speaker_pins[0];
8812 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8815 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8816 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8818 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8820 struct alc_spec *spec = codec->spec;
8823 for (i = 0; i < AUTO_PIN_LAST; i++) {
8824 hda_nid_t nid = spec->autocfg.input_pins[i];
8825 if (alc883_is_input_pin(nid)) {
8826 snd_hda_codec_write(codec, nid, 0,
8827 AC_VERB_SET_PIN_WIDGET_CONTROL,
8828 (i <= AUTO_PIN_FRONT_MIC ?
8829 PIN_VREF80 : PIN_IN));
8830 if (nid != ALC883_PIN_CD_NID)
8831 snd_hda_codec_write(codec, nid, 0,
8832 AC_VERB_SET_AMP_GAIN_MUTE,
8838 #define alc883_auto_init_input_src alc882_auto_init_input_src
8840 /* almost identical with ALC880 parser... */
8841 static int alc883_parse_auto_config(struct hda_codec *codec)
8843 struct alc_spec *spec = codec->spec;
8844 int err = alc880_parse_auto_config(codec);
8849 return 0; /* no config found */
8851 err = alc_auto_add_mic_boost(codec);
8855 /* hack - override the init verbs */
8856 spec->init_verbs[0] = alc883_auto_init_verbs;
8857 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8860 return 1; /* config found */
8863 /* additional initialization for auto-configuration model */
8864 static void alc883_auto_init(struct hda_codec *codec)
8866 struct alc_spec *spec = codec->spec;
8867 alc883_auto_init_multi_out(codec);
8868 alc883_auto_init_hp_out(codec);
8869 alc883_auto_init_analog_input(codec);
8870 alc883_auto_init_input_src(codec);
8871 if (spec->unsol_event)
8872 alc_inithook(codec);
8875 static int patch_alc883(struct hda_codec *codec)
8877 struct alc_spec *spec;
8878 int err, board_config;
8880 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8886 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8888 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8891 if (board_config < 0) {
8892 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8893 "trying auto-probe from BIOS...\n");
8894 board_config = ALC883_AUTO;
8897 if (board_config == ALC883_AUTO) {
8898 /* automatic parse from the BIOS config */
8899 err = alc883_parse_auto_config(codec);
8905 "hda_codec: Cannot set up configuration "
8906 "from BIOS. Using base mode...\n");
8907 board_config = ALC883_3ST_2ch_DIG;
8911 if (board_config != ALC883_AUTO)
8912 setup_preset(spec, &alc883_presets[board_config]);
8914 switch (codec->vendor_id) {
8916 if (codec->revision_id == 0x100101) {
8917 spec->stream_name_analog = "ALC1200 Analog";
8918 spec->stream_name_digital = "ALC1200 Digital";
8920 spec->stream_name_analog = "ALC888 Analog";
8921 spec->stream_name_digital = "ALC888 Digital";
8925 spec->stream_name_analog = "ALC889 Analog";
8926 spec->stream_name_digital = "ALC889 Digital";
8929 spec->stream_name_analog = "ALC883 Analog";
8930 spec->stream_name_digital = "ALC883 Digital";
8934 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8935 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8936 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8938 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8939 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8941 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8942 spec->adc_nids = alc883_adc_nids;
8943 spec->capsrc_nids = alc883_capsrc_nids;
8945 spec->vmaster_nid = 0x0c;
8947 codec->patch_ops = alc_patch_ops;
8948 if (board_config == ALC883_AUTO)
8949 spec->init_hook = alc883_auto_init;
8951 #ifdef CONFIG_SND_HDA_POWER_SAVE
8952 if (!spec->loopback.amplist)
8953 spec->loopback.amplist = alc883_loopbacks;
8963 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8964 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8966 #define alc262_dac_nids alc260_dac_nids
8967 #define alc262_adc_nids alc882_adc_nids
8968 #define alc262_adc_nids_alt alc882_adc_nids_alt
8969 #define alc262_capsrc_nids alc882_capsrc_nids
8970 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8972 #define alc262_modes alc260_modes
8973 #define alc262_capture_source alc882_capture_source
8975 static hda_nid_t alc262_dmic_adc_nids[1] = {
8980 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8982 static struct snd_kcontrol_new alc262_base_mixer[] = {
8983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8984 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8985 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8986 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8991 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8992 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8993 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8994 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8995 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8996 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8997 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8998 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8999 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9000 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9004 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9005 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9006 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9007 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9008 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9009 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9010 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9013 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9014 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9015 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9016 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9017 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9018 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9019 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9020 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9024 /* update HP, line and mono-out pins according to the master switch */
9025 static void alc262_hp_master_update(struct hda_codec *codec)
9027 struct alc_spec *spec = codec->spec;
9028 int val = spec->master_sw;
9031 snd_hda_codec_write_cache(codec, 0x1b, 0,
9032 AC_VERB_SET_PIN_WIDGET_CONTROL,
9034 snd_hda_codec_write_cache(codec, 0x15, 0,
9035 AC_VERB_SET_PIN_WIDGET_CONTROL,
9037 /* mono (speaker) depending on the HP jack sense */
9038 val = val && !spec->jack_present;
9039 snd_hda_codec_write_cache(codec, 0x16, 0,
9040 AC_VERB_SET_PIN_WIDGET_CONTROL,
9044 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9046 struct alc_spec *spec = codec->spec;
9047 unsigned int presence;
9048 presence = snd_hda_codec_read(codec, 0x1b, 0,
9049 AC_VERB_GET_PIN_SENSE, 0);
9050 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9051 alc262_hp_master_update(codec);
9054 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9056 if ((res >> 26) != ALC880_HP_EVENT)
9058 alc262_hp_bpc_automute(codec);
9061 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9063 struct alc_spec *spec = codec->spec;
9064 unsigned int presence;
9065 presence = snd_hda_codec_read(codec, 0x15, 0,
9066 AC_VERB_GET_PIN_SENSE, 0);
9067 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9068 alc262_hp_master_update(codec);
9071 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9074 if ((res >> 26) != ALC880_HP_EVENT)
9076 alc262_hp_wildwest_automute(codec);
9079 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9080 struct snd_ctl_elem_value *ucontrol)
9082 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9083 struct alc_spec *spec = codec->spec;
9084 *ucontrol->value.integer.value = spec->master_sw;
9088 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9089 struct snd_ctl_elem_value *ucontrol)
9091 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9092 struct alc_spec *spec = codec->spec;
9093 int val = !!*ucontrol->value.integer.value;
9095 if (val == spec->master_sw)
9097 spec->master_sw = val;
9098 alc262_hp_master_update(codec);
9102 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9105 .name = "Master Playback Switch",
9106 .info = snd_ctl_boolean_mono_info,
9107 .get = alc262_hp_master_sw_get,
9108 .put = alc262_hp_master_sw_put,
9110 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9111 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9113 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9115 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9120 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9121 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9122 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9123 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9124 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9127 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9128 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9129 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9130 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9134 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9137 .name = "Master Playback Switch",
9138 .info = snd_ctl_boolean_mono_info,
9139 .get = alc262_hp_master_sw_get,
9140 .put = alc262_hp_master_sw_put,
9142 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9143 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9145 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9146 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9148 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9150 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9151 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9152 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9155 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9156 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9157 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9158 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9162 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9163 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9164 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9165 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9169 /* mute/unmute internal speaker according to the hp jack and mute state */
9170 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9172 struct alc_spec *spec = codec->spec;
9174 if (force || !spec->sense_updated) {
9175 unsigned int present;
9176 present = snd_hda_codec_read(codec, 0x15, 0,
9177 AC_VERB_GET_PIN_SENSE, 0);
9178 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9179 spec->sense_updated = 1;
9181 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9182 spec->jack_present ? HDA_AMP_MUTE : 0);
9185 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9188 if ((res >> 26) != ALC880_HP_EVENT)
9190 alc262_hp_t5735_automute(codec, 1);
9193 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9195 alc262_hp_t5735_automute(codec, 1);
9198 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9199 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9200 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9201 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9205 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9209 static struct hda_verb alc262_hp_t5735_verbs[] = {
9210 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9213 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9217 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9218 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9219 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9220 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9221 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9222 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9223 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9227 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9228 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9229 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9230 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9231 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9232 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9233 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9236 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9241 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9248 /* bind hp and internal speaker mute (with plug check) */
9249 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9250 struct snd_ctl_elem_value *ucontrol)
9252 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9253 long *valp = ucontrol->value.integer.value;
9256 /* change hp mute */
9257 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9259 valp[0] ? 0 : HDA_AMP_MUTE);
9260 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9262 valp[1] ? 0 : HDA_AMP_MUTE);
9264 /* change speaker according to HP jack state */
9265 struct alc_spec *spec = codec->spec;
9267 if (spec->jack_present)
9268 mute = HDA_AMP_MUTE;
9270 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9272 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9273 HDA_AMP_MUTE, mute);
9278 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9279 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9281 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9282 .name = "Master Playback Switch",
9283 .info = snd_hda_mixer_amp_switch_info,
9284 .get = snd_hda_mixer_amp_switch_get,
9285 .put = alc262_sony_master_sw_put,
9286 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9290 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9291 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9295 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9296 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9297 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9300 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9301 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9302 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9306 #define alc262_capture_mixer alc882_capture_mixer
9307 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9310 * generic initialization of ADC, input mixers and output mixers
9312 static struct hda_verb alc262_init_verbs[] = {
9314 * Unmute ADC0-2 and set the default input to mic-in
9316 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9318 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9319 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9320 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9321 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9323 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9325 * Note: PASD motherboards uses the Line In 2 as the input for
9326 * front panel mic (mic 2)
9328 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9332 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9333 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9336 * Set up output mixers (0x0c - 0x0e)
9338 /* set vol=0 to output mixers */
9339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9342 /* set up input amps for analog loopback */
9343 /* Amp Indices: DAC = 0, mixer = 1 */
9344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9349 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9353 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9355 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9356 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9358 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9359 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9360 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9361 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9362 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9364 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9365 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9367 /* FIXME: use matrix-type input source selection */
9368 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9369 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9388 static struct hda_verb alc262_eapd_verbs[] = {
9389 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9390 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9394 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9395 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9400 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9401 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9402 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9403 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9405 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9406 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9410 static struct hda_verb alc262_sony_unsol_verbs[] = {
9411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9412 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9413 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9415 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9416 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9420 static struct hda_input_mux alc262_dmic_capture_source = {
9423 { "Int DMic", 0x9 },
9428 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9429 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9430 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9434 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9435 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9437 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9438 /* The multiple "Capture Source" controls confuse alsamixer
9439 * So call somewhat different..
9441 /* .name = "Capture Source", */
9442 .name = "Input Source",
9444 .info = alc_mux_enum_info,
9445 .get = alc_mux_enum_get,
9446 .put = alc_mux_enum_put,
9451 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9452 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9453 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9455 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9456 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9457 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9458 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9459 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9463 static void alc262_dmic_automute(struct hda_codec *codec)
9465 unsigned int present;
9467 present = snd_hda_codec_read(codec, 0x18, 0,
9468 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9469 snd_hda_codec_write(codec, 0x22, 0,
9470 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9473 /* toggle speaker-output according to the hp-jack state */
9474 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9476 unsigned int present;
9479 present = snd_hda_codec_read(codec, 0x15, 0,
9480 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9481 bits = present ? 0 : PIN_OUT;
9482 snd_hda_codec_write(codec, 0x14, 0,
9483 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9488 /* unsolicited event for HP jack sensing */
9489 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9492 if ((res >> 26) == ALC880_HP_EVENT)
9493 alc262_toshiba_s06_speaker_automute(codec);
9494 if ((res >> 26) == ALC880_MIC_EVENT)
9495 alc262_dmic_automute(codec);
9499 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9501 alc262_toshiba_s06_speaker_automute(codec);
9502 alc262_dmic_automute(codec);
9505 /* mute/unmute internal speaker according to the hp jack and mute state */
9506 static void alc262_hippo_automute(struct hda_codec *codec)
9508 struct alc_spec *spec = codec->spec;
9510 unsigned int present;
9512 /* need to execute and sync at first */
9513 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9514 present = snd_hda_codec_read(codec, 0x15, 0,
9515 AC_VERB_GET_PIN_SENSE, 0);
9516 spec->jack_present = (present & 0x80000000) != 0;
9517 if (spec->jack_present) {
9518 /* mute internal speaker */
9519 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9520 HDA_AMP_MUTE, HDA_AMP_MUTE);
9522 /* unmute internal speaker if necessary */
9523 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9524 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9525 HDA_AMP_MUTE, mute);
9529 /* unsolicited event for HP jack sensing */
9530 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9533 if ((res >> 26) != ALC880_HP_EVENT)
9535 alc262_hippo_automute(codec);
9538 static void alc262_hippo1_automute(struct hda_codec *codec)
9541 unsigned int present;
9543 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9544 present = snd_hda_codec_read(codec, 0x1b, 0,
9545 AC_VERB_GET_PIN_SENSE, 0);
9546 present = (present & 0x80000000) != 0;
9548 /* mute internal speaker */
9549 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9550 HDA_AMP_MUTE, HDA_AMP_MUTE);
9552 /* unmute internal speaker if necessary */
9553 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9554 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9555 HDA_AMP_MUTE, mute);
9559 /* unsolicited event for HP jack sensing */
9560 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9563 if ((res >> 26) != ALC880_HP_EVENT)
9565 alc262_hippo1_automute(codec);
9571 * 0x16 = internal speaker
9572 * 0x18 = external mic
9575 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9576 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9577 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9581 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9583 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9588 static struct hda_verb alc262_nec_verbs[] = {
9589 /* Unmute Speaker */
9590 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9596 /* External mic to headphone */
9597 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9598 /* External mic to speaker */
9599 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9605 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9606 * 0x1b = port replicator headphone out
9609 #define ALC_HP_EVENT 0x37
9611 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9612 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9613 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9614 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9615 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9619 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
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_input_mux alc262_fujitsu_capture_source = {
9634 static struct hda_input_mux alc262_HP_capture_source = {
9638 { "Front Mic", 0x1 },
9645 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9649 { "Front Mic", 0x2 },
9655 /* mute/unmute internal speaker according to the hp jacks and mute state */
9656 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9658 struct alc_spec *spec = codec->spec;
9661 if (force || !spec->sense_updated) {
9662 unsigned int present;
9663 /* need to execute and sync at first */
9664 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9665 /* check laptop HP jack */
9666 present = snd_hda_codec_read(codec, 0x14, 0,
9667 AC_VERB_GET_PIN_SENSE, 0);
9668 /* need to execute and sync at first */
9669 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9670 /* check docking HP jack */
9671 present |= snd_hda_codec_read(codec, 0x1b, 0,
9672 AC_VERB_GET_PIN_SENSE, 0);
9673 if (present & AC_PINSENSE_PRESENCE)
9674 spec->jack_present = 1;
9676 spec->jack_present = 0;
9677 spec->sense_updated = 1;
9679 /* unmute internal speaker only if both HPs are unplugged and
9680 * master switch is on
9682 if (spec->jack_present)
9683 mute = HDA_AMP_MUTE;
9685 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9686 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9687 HDA_AMP_MUTE, mute);
9690 /* unsolicited event for HP jack sensing */
9691 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9694 if ((res >> 26) != ALC_HP_EVENT)
9696 alc262_fujitsu_automute(codec, 1);
9699 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9701 alc262_fujitsu_automute(codec, 1);
9704 /* bind volumes of both NID 0x0c and 0x0d */
9705 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9706 .ops = &snd_hda_bind_vol,
9708 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9709 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9714 /* mute/unmute internal speaker according to the hp jack and mute state */
9715 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9717 struct alc_spec *spec = codec->spec;
9720 if (force || !spec->sense_updated) {
9721 unsigned int present_int_hp;
9722 /* need to execute and sync at first */
9723 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9724 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9725 AC_VERB_GET_PIN_SENSE, 0);
9726 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9727 spec->sense_updated = 1;
9729 if (spec->jack_present) {
9730 /* mute internal speaker */
9731 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9732 HDA_AMP_MUTE, HDA_AMP_MUTE);
9733 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9734 HDA_AMP_MUTE, HDA_AMP_MUTE);
9736 /* unmute internal speaker if necessary */
9737 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9738 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9739 HDA_AMP_MUTE, mute);
9740 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9741 HDA_AMP_MUTE, mute);
9745 /* unsolicited event for HP jack sensing */
9746 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9749 if ((res >> 26) != ALC_HP_EVENT)
9751 alc262_lenovo_3000_automute(codec, 1);
9754 /* bind hp and internal speaker mute (with plug check) */
9755 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9756 struct snd_ctl_elem_value *ucontrol)
9758 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9759 long *valp = ucontrol->value.integer.value;
9762 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9764 valp ? 0 : HDA_AMP_MUTE);
9765 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9767 valp ? 0 : HDA_AMP_MUTE);
9770 alc262_fujitsu_automute(codec, 0);
9774 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9775 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9778 .name = "Master Playback Switch",
9779 .info = snd_hda_mixer_amp_switch_info,
9780 .get = snd_hda_mixer_amp_switch_get,
9781 .put = alc262_fujitsu_master_sw_put,
9782 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9784 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9785 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9786 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9787 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9788 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9789 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9791 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9792 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9793 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9797 /* bind hp and internal speaker mute (with plug check) */
9798 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9799 struct snd_ctl_elem_value *ucontrol)
9801 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9802 long *valp = ucontrol->value.integer.value;
9805 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9807 valp ? 0 : HDA_AMP_MUTE);
9810 alc262_lenovo_3000_automute(codec, 0);
9814 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9815 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9817 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9818 .name = "Master Playback Switch",
9819 .info = snd_hda_mixer_amp_switch_info,
9820 .get = snd_hda_mixer_amp_switch_get,
9821 .put = alc262_lenovo_3000_master_sw_put,
9822 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9824 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9825 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9826 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9829 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9830 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9831 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9835 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9836 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9839 .name = "Master Playback Switch",
9840 .info = snd_hda_mixer_amp_switch_info,
9841 .get = snd_hda_mixer_amp_switch_get,
9842 .put = alc262_sony_master_sw_put,
9843 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9847 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9848 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9849 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9850 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9854 /* additional init verbs for Benq laptops */
9855 static struct hda_verb alc262_EAPD_verbs[] = {
9856 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9857 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9861 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9862 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9863 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9865 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9866 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9870 /* Samsung Q1 Ultra Vista model setup */
9871 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9872 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9873 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9876 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9877 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9881 static struct hda_verb alc262_ultra_verbs[] = {
9883 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9888 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9889 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9890 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9893 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9894 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9895 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9896 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9898 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9900 /* ADC, choose mic */
9901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9902 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9903 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9908 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9909 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9910 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9914 /* mute/unmute internal speaker according to the hp jack and mute state */
9915 static void alc262_ultra_automute(struct hda_codec *codec)
9917 struct alc_spec *spec = codec->spec;
9921 /* auto-mute only when HP is used as HP */
9922 if (!spec->cur_mux[0]) {
9923 unsigned int present;
9924 /* need to execute and sync at first */
9925 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9926 present = snd_hda_codec_read(codec, 0x15, 0,
9927 AC_VERB_GET_PIN_SENSE, 0);
9928 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9929 if (spec->jack_present)
9930 mute = HDA_AMP_MUTE;
9932 /* mute/unmute internal speaker */
9933 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9934 HDA_AMP_MUTE, mute);
9935 /* mute/unmute HP */
9936 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9937 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9940 /* unsolicited event for HP jack sensing */
9941 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9944 if ((res >> 26) != ALC880_HP_EVENT)
9946 alc262_ultra_automute(codec);
9949 static struct hda_input_mux alc262_ultra_capture_source = {
9953 { "Headphone", 0x7 },
9957 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9958 struct snd_ctl_elem_value *ucontrol)
9960 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9961 struct alc_spec *spec = codec->spec;
9964 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9967 /* reprogram the HP pin as mic or HP according to the input source */
9968 snd_hda_codec_write_cache(codec, 0x15, 0,
9969 AC_VERB_SET_PIN_WIDGET_CONTROL,
9970 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9971 alc262_ultra_automute(codec); /* mute/unmute HP */
9975 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9976 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9977 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9979 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9980 .name = "Capture Source",
9981 .info = alc882_mux_enum_info,
9982 .get = alc882_mux_enum_get,
9983 .put = alc262_ultra_mux_enum_put,
9988 /* add playback controls from the parsed DAC table */
9989 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9990 const struct auto_pin_cfg *cfg)
9995 spec->multiout.num_dacs = 1; /* only use one dac */
9996 spec->multiout.dac_nids = spec->private_dac_nids;
9997 spec->multiout.dac_nids[0] = 2;
9999 nid = cfg->line_out_pins[0];
10001 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10002 "Front Playback Volume",
10003 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10006 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10007 "Front Playback Switch",
10008 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10013 nid = cfg->speaker_pins[0];
10016 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10017 "Speaker Playback Volume",
10018 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10022 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10023 "Speaker Playback Switch",
10024 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10029 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10030 "Speaker Playback Switch",
10031 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10037 nid = cfg->hp_pins[0];
10039 /* spec->multiout.hp_nid = 2; */
10041 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10042 "Headphone Playback Volume",
10043 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10047 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10048 "Headphone Playback Switch",
10049 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10054 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10055 "Headphone Playback Switch",
10056 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10065 /* identical with ALC880 */
10066 #define alc262_auto_create_analog_input_ctls \
10067 alc880_auto_create_analog_input_ctls
10070 * generic initialization of ADC, input mixers and output mixers
10072 static struct hda_verb alc262_volume_init_verbs[] = {
10074 * Unmute ADC0-2 and set the default input to mic-in
10076 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10077 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10078 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10079 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10080 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10081 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10083 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10085 * Note: PASD motherboards uses the Line In 2 as the input for
10086 * front panel mic (mic 2)
10088 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10092 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10093 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10096 * Set up output mixers (0x0c - 0x0f)
10098 /* set vol=0 to output mixers */
10099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10103 /* set up input amps for analog loopback */
10104 /* Amp Indices: DAC = 0, mixer = 1 */
10105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10106 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10107 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10108 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10109 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10112 /* FIXME: use matrix-type input source selection */
10113 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10114 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10115 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10116 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10117 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10118 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10120 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10121 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10122 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10123 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10125 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10126 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10127 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10133 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10135 * Unmute ADC0-2 and set the default input to mic-in
10137 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10138 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10139 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10141 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10142 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10144 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10146 * Note: PASD motherboards uses the Line In 2 as the input for
10147 * front panel mic (mic 2)
10149 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10150 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10151 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10159 * Set up output mixers (0x0c - 0x0e)
10161 /* set vol=0 to output mixers */
10162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10163 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10166 /* set up input amps for analog loopback */
10167 /* Amp Indices: DAC = 0, mixer = 1 */
10168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10169 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10170 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10171 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10173 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10175 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10176 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10177 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10179 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10180 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10182 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10183 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10186 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10187 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10188 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10189 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10191 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10192 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10193 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10195 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10196 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10199 /* FIXME: use matrix-type input source selection */
10200 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10201 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10202 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10203 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10204 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10207 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10208 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10212 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10213 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10217 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10222 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10224 * Unmute ADC0-2 and set the default input to mic-in
10226 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10227 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10228 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10229 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10230 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10231 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10233 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10235 * Note: PASD motherboards uses the Line In 2 as the input for front
10236 * panel mic (mic 2)
10238 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10239 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10240 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10241 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10242 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10243 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10248 * Set up output mixers (0x0c - 0x0e)
10250 /* set vol=0 to output mixers */
10251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10255 /* set up input amps for analog loopback */
10256 /* Amp Indices: DAC = 0, mixer = 1 */
10257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10259 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10261 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10265 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10266 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10267 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10268 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10269 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10270 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10271 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10273 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10274 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10276 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10277 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10279 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10280 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10281 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10282 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10283 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10284 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10286 /* FIXME: use matrix-type input source selection */
10287 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10288 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10294 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10301 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10302 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10310 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10313 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10318 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10321 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10322 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10324 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10325 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10326 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10327 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10330 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10331 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10336 #ifdef CONFIG_SND_HDA_POWER_SAVE
10337 #define alc262_loopbacks alc880_loopbacks
10340 /* pcm configuration: identiacal with ALC880 */
10341 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10342 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10343 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10344 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10347 * BIOS auto configuration
10349 static int alc262_parse_auto_config(struct hda_codec *codec)
10351 struct alc_spec *spec = codec->spec;
10353 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10355 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10359 if (!spec->autocfg.line_outs)
10360 return 0; /* can't find valid BIOS pin config */
10361 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10364 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10368 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10370 if (spec->autocfg.dig_out_pin)
10371 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10372 if (spec->autocfg.dig_in_pin)
10373 spec->dig_in_nid = ALC262_DIGIN_NID;
10375 if (spec->kctl_alloc)
10376 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10378 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
10379 spec->num_mux_defs = 1;
10380 spec->input_mux = &spec->private_imux;
10382 err = alc_auto_add_mic_boost(codec);
10386 store_pin_configs(codec);
10390 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10391 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10392 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10393 #define alc262_auto_init_input_src alc882_auto_init_input_src
10396 /* init callback for auto-configuration model -- overriding the default init */
10397 static void alc262_auto_init(struct hda_codec *codec)
10399 struct alc_spec *spec = codec->spec;
10400 alc262_auto_init_multi_out(codec);
10401 alc262_auto_init_hp_out(codec);
10402 alc262_auto_init_analog_input(codec);
10403 alc262_auto_init_input_src(codec);
10404 if (spec->unsol_event)
10405 alc_inithook(codec);
10409 * configuration and preset
10411 static const char *alc262_models[ALC262_MODEL_LAST] = {
10412 [ALC262_BASIC] = "basic",
10413 [ALC262_HIPPO] = "hippo",
10414 [ALC262_HIPPO_1] = "hippo_1",
10415 [ALC262_FUJITSU] = "fujitsu",
10416 [ALC262_HP_BPC] = "hp-bpc",
10417 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10418 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10419 [ALC262_HP_RP5700] = "hp-rp5700",
10420 [ALC262_BENQ_ED8] = "benq",
10421 [ALC262_BENQ_T31] = "benq-t31",
10422 [ALC262_SONY_ASSAMD] = "sony-assamd",
10423 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10424 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10425 [ALC262_ULTRA] = "ultra",
10426 [ALC262_LENOVO_3000] = "lenovo-3000",
10427 [ALC262_NEC] = "nec",
10428 [ALC262_AUTO] = "auto",
10431 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10432 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10433 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10434 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10435 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10436 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10437 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10438 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10439 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10440 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10441 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10442 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10443 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10444 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10445 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10446 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10447 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10448 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10449 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10450 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10451 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10452 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10453 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10454 ALC262_HP_TC_T5735),
10455 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10456 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10457 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10458 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10459 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10460 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10461 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10462 ALC262_TOSHIBA_RX1),
10463 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10464 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10465 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10466 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10467 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10468 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10469 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10470 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10471 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10475 static struct alc_config_preset alc262_presets[] = {
10477 .mixers = { alc262_base_mixer },
10478 .init_verbs = { alc262_init_verbs },
10479 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10480 .dac_nids = alc262_dac_nids,
10482 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10483 .channel_mode = alc262_modes,
10484 .input_mux = &alc262_capture_source,
10487 .mixers = { alc262_base_mixer },
10488 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10489 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10490 .dac_nids = alc262_dac_nids,
10492 .dig_out_nid = ALC262_DIGOUT_NID,
10493 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10494 .channel_mode = alc262_modes,
10495 .input_mux = &alc262_capture_source,
10496 .unsol_event = alc262_hippo_unsol_event,
10497 .init_hook = alc262_hippo_automute,
10499 [ALC262_HIPPO_1] = {
10500 .mixers = { alc262_hippo1_mixer },
10501 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10502 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10503 .dac_nids = alc262_dac_nids,
10505 .dig_out_nid = ALC262_DIGOUT_NID,
10506 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10507 .channel_mode = alc262_modes,
10508 .input_mux = &alc262_capture_source,
10509 .unsol_event = alc262_hippo1_unsol_event,
10510 .init_hook = alc262_hippo1_automute,
10512 [ALC262_FUJITSU] = {
10513 .mixers = { alc262_fujitsu_mixer },
10514 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10515 alc262_fujitsu_unsol_verbs },
10516 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10517 .dac_nids = alc262_dac_nids,
10519 .dig_out_nid = ALC262_DIGOUT_NID,
10520 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10521 .channel_mode = alc262_modes,
10522 .input_mux = &alc262_fujitsu_capture_source,
10523 .unsol_event = alc262_fujitsu_unsol_event,
10524 .init_hook = alc262_fujitsu_init_hook,
10526 [ALC262_HP_BPC] = {
10527 .mixers = { alc262_HP_BPC_mixer },
10528 .init_verbs = { alc262_HP_BPC_init_verbs },
10529 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10530 .dac_nids = alc262_dac_nids,
10532 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10533 .channel_mode = alc262_modes,
10534 .input_mux = &alc262_HP_capture_source,
10535 .unsol_event = alc262_hp_bpc_unsol_event,
10536 .init_hook = alc262_hp_bpc_automute,
10538 [ALC262_HP_BPC_D7000_WF] = {
10539 .mixers = { alc262_HP_BPC_WildWest_mixer },
10540 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10541 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10542 .dac_nids = alc262_dac_nids,
10544 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10545 .channel_mode = alc262_modes,
10546 .input_mux = &alc262_HP_D7000_capture_source,
10547 .unsol_event = alc262_hp_wildwest_unsol_event,
10548 .init_hook = alc262_hp_wildwest_automute,
10550 [ALC262_HP_BPC_D7000_WL] = {
10551 .mixers = { alc262_HP_BPC_WildWest_mixer,
10552 alc262_HP_BPC_WildWest_option_mixer },
10553 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10554 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10555 .dac_nids = alc262_dac_nids,
10557 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10558 .channel_mode = alc262_modes,
10559 .input_mux = &alc262_HP_D7000_capture_source,
10560 .unsol_event = alc262_hp_wildwest_unsol_event,
10561 .init_hook = alc262_hp_wildwest_automute,
10563 [ALC262_HP_TC_T5735] = {
10564 .mixers = { alc262_hp_t5735_mixer },
10565 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10566 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10567 .dac_nids = alc262_dac_nids,
10569 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10570 .channel_mode = alc262_modes,
10571 .input_mux = &alc262_capture_source,
10572 .unsol_event = alc262_hp_t5735_unsol_event,
10573 .init_hook = alc262_hp_t5735_init_hook,
10575 [ALC262_HP_RP5700] = {
10576 .mixers = { alc262_hp_rp5700_mixer },
10577 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10578 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10579 .dac_nids = alc262_dac_nids,
10580 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10581 .channel_mode = alc262_modes,
10582 .input_mux = &alc262_hp_rp5700_capture_source,
10584 [ALC262_BENQ_ED8] = {
10585 .mixers = { alc262_base_mixer },
10586 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10587 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10588 .dac_nids = alc262_dac_nids,
10590 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10591 .channel_mode = alc262_modes,
10592 .input_mux = &alc262_capture_source,
10594 [ALC262_SONY_ASSAMD] = {
10595 .mixers = { alc262_sony_mixer },
10596 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10597 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10598 .dac_nids = alc262_dac_nids,
10600 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10601 .channel_mode = alc262_modes,
10602 .input_mux = &alc262_capture_source,
10603 .unsol_event = alc262_hippo_unsol_event,
10604 .init_hook = alc262_hippo_automute,
10606 [ALC262_BENQ_T31] = {
10607 .mixers = { alc262_benq_t31_mixer },
10608 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10609 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10610 .dac_nids = alc262_dac_nids,
10612 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10613 .channel_mode = alc262_modes,
10614 .input_mux = &alc262_capture_source,
10615 .unsol_event = alc262_hippo_unsol_event,
10616 .init_hook = alc262_hippo_automute,
10619 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
10620 .init_verbs = { alc262_ultra_verbs },
10621 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10622 .dac_nids = alc262_dac_nids,
10623 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10624 .channel_mode = alc262_modes,
10625 .input_mux = &alc262_ultra_capture_source,
10626 .adc_nids = alc262_adc_nids, /* ADC0 */
10627 .capsrc_nids = alc262_capsrc_nids,
10628 .num_adc_nids = 1, /* single ADC */
10629 .unsol_event = alc262_ultra_unsol_event,
10630 .init_hook = alc262_ultra_automute,
10632 [ALC262_LENOVO_3000] = {
10633 .mixers = { alc262_lenovo_3000_mixer },
10634 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10635 alc262_lenovo_3000_unsol_verbs },
10636 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10637 .dac_nids = alc262_dac_nids,
10639 .dig_out_nid = ALC262_DIGOUT_NID,
10640 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10641 .channel_mode = alc262_modes,
10642 .input_mux = &alc262_fujitsu_capture_source,
10643 .unsol_event = alc262_lenovo_3000_unsol_event,
10646 .mixers = { alc262_nec_mixer },
10647 .init_verbs = { alc262_nec_verbs },
10648 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10649 .dac_nids = alc262_dac_nids,
10651 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10652 .channel_mode = alc262_modes,
10653 .input_mux = &alc262_capture_source,
10655 [ALC262_TOSHIBA_S06] = {
10656 .mixers = { alc262_toshiba_s06_mixer },
10657 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10658 alc262_eapd_verbs },
10659 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10660 .capsrc_nids = alc262_dmic_capsrc_nids,
10661 .dac_nids = alc262_dac_nids,
10662 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10663 .dig_out_nid = ALC262_DIGOUT_NID,
10664 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10665 .channel_mode = alc262_modes,
10666 .input_mux = &alc262_dmic_capture_source,
10667 .unsol_event = alc262_toshiba_s06_unsol_event,
10668 .init_hook = alc262_toshiba_s06_init_hook,
10670 [ALC262_TOSHIBA_RX1] = {
10671 .mixers = { alc262_toshiba_rx1_mixer },
10672 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10673 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10674 .dac_nids = alc262_dac_nids,
10676 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10677 .channel_mode = alc262_modes,
10678 .input_mux = &alc262_capture_source,
10679 .unsol_event = alc262_hippo_unsol_event,
10680 .init_hook = alc262_hippo_automute,
10684 static int patch_alc262(struct hda_codec *codec)
10686 struct alc_spec *spec;
10690 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10694 codec->spec = spec;
10696 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10701 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10702 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10703 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10704 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10708 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10710 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10714 if (board_config < 0) {
10715 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10716 "trying auto-probe from BIOS...\n");
10717 board_config = ALC262_AUTO;
10720 if (board_config == ALC262_AUTO) {
10721 /* automatic parse from the BIOS config */
10722 err = alc262_parse_auto_config(codec);
10728 "hda_codec: Cannot set up configuration "
10729 "from BIOS. Using base mode...\n");
10730 board_config = ALC262_BASIC;
10734 if (board_config != ALC262_AUTO)
10735 setup_preset(spec, &alc262_presets[board_config]);
10737 spec->stream_name_analog = "ALC262 Analog";
10738 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10739 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10741 spec->stream_name_digital = "ALC262 Digital";
10742 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10743 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10745 if (!spec->adc_nids && spec->input_mux) {
10746 /* check whether NID 0x07 is valid */
10747 unsigned int wcap = get_wcaps(codec, 0x07);
10750 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10751 if (wcap != AC_WID_AUD_IN) {
10752 spec->adc_nids = alc262_adc_nids_alt;
10753 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10754 spec->capsrc_nids = alc262_capsrc_nids_alt;
10755 spec->mixers[spec->num_mixers] =
10756 alc262_capture_alt_mixer;
10757 spec->num_mixers++;
10759 spec->adc_nids = alc262_adc_nids;
10760 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10761 spec->capsrc_nids = alc262_capsrc_nids;
10762 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
10763 spec->num_mixers++;
10767 spec->vmaster_nid = 0x0c;
10769 codec->patch_ops = alc_patch_ops;
10770 if (board_config == ALC262_AUTO)
10771 spec->init_hook = alc262_auto_init;
10772 #ifdef CONFIG_SND_HDA_POWER_SAVE
10773 if (!spec->loopback.amplist)
10774 spec->loopback.amplist = alc262_loopbacks;
10781 * ALC268 channel source setting (2 channel)
10783 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10784 #define alc268_modes alc260_modes
10786 static hda_nid_t alc268_dac_nids[2] = {
10791 static hda_nid_t alc268_adc_nids[2] = {
10796 static hda_nid_t alc268_adc_nids_alt[1] = {
10801 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10803 static struct snd_kcontrol_new alc268_base_mixer[] = {
10804 /* output mixer control */
10805 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10806 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10807 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10808 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10809 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10810 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10811 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10815 /* bind Beep switches of both NID 0x0f and 0x10 */
10816 static struct hda_bind_ctls alc268_bind_beep_sw = {
10817 .ops = &snd_hda_bind_sw,
10819 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10820 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10825 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10826 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10827 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10831 static struct hda_verb alc268_eapd_verbs[] = {
10832 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10833 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10837 /* Toshiba specific */
10838 #define alc268_toshiba_automute alc262_hippo_automute
10840 static struct hda_verb alc268_toshiba_verbs[] = {
10841 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10845 static struct hda_input_mux alc268_acer_lc_capture_source = {
10853 /* Acer specific */
10854 /* bind volumes of both NID 0x02 and 0x03 */
10855 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10856 .ops = &snd_hda_bind_vol,
10858 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10859 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10864 /* mute/unmute internal speaker according to the hp jack and mute state */
10865 static void alc268_acer_automute(struct hda_codec *codec, int force)
10867 struct alc_spec *spec = codec->spec;
10870 if (force || !spec->sense_updated) {
10871 unsigned int present;
10872 present = snd_hda_codec_read(codec, 0x14, 0,
10873 AC_VERB_GET_PIN_SENSE, 0);
10874 spec->jack_present = (present & 0x80000000) != 0;
10875 spec->sense_updated = 1;
10877 if (spec->jack_present)
10878 mute = HDA_AMP_MUTE; /* mute internal speaker */
10879 else /* unmute internal speaker if necessary */
10880 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10881 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10882 HDA_AMP_MUTE, mute);
10886 /* bind hp and internal speaker mute (with plug check) */
10887 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10888 struct snd_ctl_elem_value *ucontrol)
10890 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10891 long *valp = ucontrol->value.integer.value;
10894 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10896 valp[0] ? 0 : HDA_AMP_MUTE);
10897 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10899 valp[1] ? 0 : HDA_AMP_MUTE);
10901 alc268_acer_automute(codec, 0);
10905 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10906 /* output mixer control */
10907 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10909 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10910 .name = "Master Playback Switch",
10911 .info = snd_hda_mixer_amp_switch_info,
10912 .get = snd_hda_mixer_amp_switch_get,
10913 .put = alc268_acer_master_sw_put,
10914 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10916 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10920 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10921 /* output mixer control */
10922 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10924 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10925 .name = "Master Playback Switch",
10926 .info = snd_hda_mixer_amp_switch_info,
10927 .get = snd_hda_mixer_amp_switch_get,
10928 .put = alc268_acer_master_sw_put,
10929 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10931 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10932 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10933 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10937 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10938 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10940 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10941 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10942 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10943 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10947 static struct hda_verb alc268_acer_verbs[] = {
10948 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10949 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10950 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10951 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10952 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10954 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10958 /* unsolicited event for HP jack sensing */
10959 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10962 if ((res >> 26) != ALC880_HP_EVENT)
10964 alc268_toshiba_automute(codec);
10967 static void alc268_acer_unsol_event(struct hda_codec *codec,
10970 if ((res >> 26) != ALC880_HP_EVENT)
10972 alc268_acer_automute(codec, 1);
10975 static void alc268_acer_init_hook(struct hda_codec *codec)
10977 alc268_acer_automute(codec, 1);
10980 /* toggle speaker-output according to the hp-jack state */
10981 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10983 unsigned int present;
10984 unsigned char bits;
10986 present = snd_hda_codec_read(codec, 0x15, 0,
10987 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10988 bits = present ? AMP_IN_MUTE(0) : 0;
10989 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10990 AMP_IN_MUTE(0), bits);
10991 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10992 AMP_IN_MUTE(0), bits);
10996 static void alc268_acer_mic_automute(struct hda_codec *codec)
10998 unsigned int present;
11000 present = snd_hda_codec_read(codec, 0x18, 0,
11001 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11002 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11003 present ? 0x0 : 0x6);
11006 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11009 if ((res >> 26) == ALC880_HP_EVENT)
11010 alc268_aspire_one_speaker_automute(codec);
11011 if ((res >> 26) == ALC880_MIC_EVENT)
11012 alc268_acer_mic_automute(codec);
11015 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11017 alc268_aspire_one_speaker_automute(codec);
11018 alc268_acer_mic_automute(codec);
11021 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11022 /* output mixer control */
11023 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11024 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11025 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11026 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11028 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11032 static struct hda_verb alc268_dell_verbs[] = {
11033 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11034 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11035 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11039 /* mute/unmute internal speaker according to the hp jack and mute state */
11040 static void alc268_dell_automute(struct hda_codec *codec)
11042 unsigned int present;
11045 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11046 if (present & 0x80000000)
11047 mute = HDA_AMP_MUTE;
11049 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11050 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11051 HDA_AMP_MUTE, mute);
11054 static void alc268_dell_unsol_event(struct hda_codec *codec,
11057 if ((res >> 26) != ALC880_HP_EVENT)
11059 alc268_dell_automute(codec);
11062 #define alc268_dell_init_hook alc268_dell_automute
11064 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11065 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11066 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11067 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11068 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11069 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11070 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11071 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11072 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11076 static struct hda_verb alc267_quanta_il1_verbs[] = {
11077 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11078 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11082 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11084 unsigned int present;
11086 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11087 & AC_PINSENSE_PRESENCE;
11088 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11089 present ? 0 : PIN_OUT);
11092 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11094 unsigned int present;
11096 present = snd_hda_codec_read(codec, 0x18, 0,
11097 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11098 snd_hda_codec_write(codec, 0x23, 0,
11099 AC_VERB_SET_CONNECT_SEL,
11100 present ? 0x00 : 0x01);
11103 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11105 alc267_quanta_il1_hp_automute(codec);
11106 alc267_quanta_il1_mic_automute(codec);
11109 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11112 switch (res >> 26) {
11113 case ALC880_HP_EVENT:
11114 alc267_quanta_il1_hp_automute(codec);
11116 case ALC880_MIC_EVENT:
11117 alc267_quanta_il1_mic_automute(codec);
11123 * generic initialization of ADC, input mixers and output mixers
11125 static struct hda_verb alc268_base_init_verbs[] = {
11126 /* Unmute DAC0-1 and set vol = 0 */
11127 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11128 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11129 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11130 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11131 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11132 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11135 * Set up output mixers (0x0c - 0x0e)
11137 /* set vol=0 to output mixers */
11138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11141 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11143 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11144 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11146 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11147 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11148 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11149 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11150 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11151 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11152 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11153 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11157 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11158 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11159 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11160 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11161 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11163 /* set PCBEEP vol = 0, mute connections */
11164 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11165 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11166 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11168 /* Unmute Selector 23h,24h and set the default input to mic-in */
11170 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11171 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11172 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11173 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11179 * generic initialization of ADC, input mixers and output mixers
11181 static struct hda_verb alc268_volume_init_verbs[] = {
11182 /* set output DAC */
11183 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11184 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11185 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11186 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11188 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11189 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11190 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11191 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11192 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11194 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11195 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11196 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11197 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11198 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11201 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11202 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11203 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11205 /* set PCBEEP vol = 0, mute connections */
11206 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11207 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11208 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11213 #define alc268_mux_enum_info alc_mux_enum_info
11214 #define alc268_mux_enum_get alc_mux_enum_get
11215 #define alc268_mux_enum_put alc_mux_enum_put
11217 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11218 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11219 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11222 /* The multiple "Capture Source" controls confuse alsamixer
11223 * So call somewhat different..
11225 /* .name = "Capture Source", */
11226 .name = "Input Source",
11228 .info = alc268_mux_enum_info,
11229 .get = alc268_mux_enum_get,
11230 .put = alc268_mux_enum_put,
11235 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11236 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11237 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11238 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11239 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11242 /* The multiple "Capture Source" controls confuse alsamixer
11243 * So call somewhat different..
11245 /* .name = "Capture Source", */
11246 .name = "Input Source",
11248 .info = alc268_mux_enum_info,
11249 .get = alc268_mux_enum_get,
11250 .put = alc268_mux_enum_put,
11255 static struct hda_input_mux alc268_capture_source = {
11259 { "Front Mic", 0x1 },
11265 static struct hda_input_mux alc268_acer_capture_source = {
11269 { "Internal Mic", 0x6 },
11274 #ifdef CONFIG_SND_DEBUG
11275 static struct snd_kcontrol_new alc268_test_mixer[] = {
11276 /* Volume widgets */
11277 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11278 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11279 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11280 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11281 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11282 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11283 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11284 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11285 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11286 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11287 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11288 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11289 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11290 /* The below appears problematic on some hardwares */
11291 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11292 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11293 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11294 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11295 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11297 /* Modes for retasking pin widgets */
11298 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11299 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11300 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11301 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11303 /* Controls for GPIO pins, assuming they are configured as outputs */
11304 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11305 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11306 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11307 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11309 /* Switches to allow the digital SPDIF output pin to be enabled.
11310 * The ALC268 does not have an SPDIF input.
11312 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11314 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11315 * this output to turn on an external amplifier.
11317 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11318 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11324 /* create input playback/capture controls for the given pin */
11325 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11326 const char *ctlname, int idx)
11331 sprintf(name, "%s Playback Volume", ctlname);
11333 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11334 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11338 } else if (nid == 0x15) {
11339 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11340 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11346 sprintf(name, "%s Playback Switch", ctlname);
11347 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11348 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11354 /* add playback controls from the parsed DAC table */
11355 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11356 const struct auto_pin_cfg *cfg)
11361 spec->multiout.num_dacs = 2; /* only use one dac */
11362 spec->multiout.dac_nids = spec->private_dac_nids;
11363 spec->multiout.dac_nids[0] = 2;
11364 spec->multiout.dac_nids[1] = 3;
11366 nid = cfg->line_out_pins[0];
11368 alc268_new_analog_output(spec, nid, "Front", 0);
11370 nid = cfg->speaker_pins[0];
11372 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11373 "Speaker Playback Volume",
11374 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11378 nid = cfg->hp_pins[0];
11380 alc268_new_analog_output(spec, nid, "Headphone", 0);
11382 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11384 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11385 "Mono Playback Switch",
11386 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11393 /* create playback/capture controls for input pins */
11394 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11395 const struct auto_pin_cfg *cfg)
11397 struct hda_input_mux *imux = &spec->private_imux;
11400 for (i = 0; i < AUTO_PIN_LAST; i++) {
11401 switch(cfg->input_pins[i]) {
11403 idx1 = 0; /* Mic 1 */
11406 idx1 = 1; /* Mic 2 */
11409 idx1 = 2; /* Line In */
11416 idx1 = 6; /* digital mics */
11421 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11422 imux->items[imux->num_items].index = idx1;
11428 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11430 struct alc_spec *spec = codec->spec;
11431 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11432 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11433 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11434 unsigned int dac_vol1, dac_vol2;
11437 snd_hda_codec_write(codec, speaker_nid, 0,
11438 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11439 snd_hda_codec_write(codec, 0x0f, 0,
11440 AC_VERB_SET_AMP_GAIN_MUTE,
11442 snd_hda_codec_write(codec, 0x10, 0,
11443 AC_VERB_SET_AMP_GAIN_MUTE,
11446 snd_hda_codec_write(codec, 0x0f, 0,
11447 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11448 snd_hda_codec_write(codec, 0x10, 0,
11449 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11452 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11453 if (line_nid == 0x14)
11454 dac_vol2 = AMP_OUT_ZERO;
11455 else if (line_nid == 0x15)
11456 dac_vol1 = AMP_OUT_ZERO;
11457 if (hp_nid == 0x14)
11458 dac_vol2 = AMP_OUT_ZERO;
11459 else if (hp_nid == 0x15)
11460 dac_vol1 = AMP_OUT_ZERO;
11461 if (line_nid != 0x16 || hp_nid != 0x16 ||
11462 spec->autocfg.line_out_pins[1] != 0x16 ||
11463 spec->autocfg.line_out_pins[2] != 0x16)
11464 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11466 snd_hda_codec_write(codec, 0x02, 0,
11467 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11468 snd_hda_codec_write(codec, 0x03, 0,
11469 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11472 /* pcm configuration: identiacal with ALC880 */
11473 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11474 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11475 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11476 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11479 * BIOS auto configuration
11481 static int alc268_parse_auto_config(struct hda_codec *codec)
11483 struct alc_spec *spec = codec->spec;
11485 static hda_nid_t alc268_ignore[] = { 0 };
11487 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11491 if (!spec->autocfg.line_outs)
11492 return 0; /* can't find valid BIOS pin config */
11494 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11497 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11501 spec->multiout.max_channels = 2;
11503 /* digital only support output */
11504 if (spec->autocfg.dig_out_pin)
11505 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11507 if (spec->kctl_alloc)
11508 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11510 if (spec->autocfg.speaker_pins[0] != 0x1d)
11511 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
11513 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
11514 spec->num_mux_defs = 1;
11515 spec->input_mux = &spec->private_imux;
11517 err = alc_auto_add_mic_boost(codec);
11521 store_pin_configs(codec);
11525 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11526 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11527 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11529 /* init callback for auto-configuration model -- overriding the default init */
11530 static void alc268_auto_init(struct hda_codec *codec)
11532 struct alc_spec *spec = codec->spec;
11533 alc268_auto_init_multi_out(codec);
11534 alc268_auto_init_hp_out(codec);
11535 alc268_auto_init_mono_speaker_out(codec);
11536 alc268_auto_init_analog_input(codec);
11537 if (spec->unsol_event)
11538 alc_inithook(codec);
11542 * configuration and preset
11544 static const char *alc268_models[ALC268_MODEL_LAST] = {
11545 [ALC267_QUANTA_IL1] = "quanta-il1",
11546 [ALC268_3ST] = "3stack",
11547 [ALC268_TOSHIBA] = "toshiba",
11548 [ALC268_ACER] = "acer",
11549 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11550 [ALC268_DELL] = "dell",
11551 [ALC268_ZEPTO] = "zepto",
11552 #ifdef CONFIG_SND_DEBUG
11553 [ALC268_TEST] = "test",
11555 [ALC268_AUTO] = "auto",
11558 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11559 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11560 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11561 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11562 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11563 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11564 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11565 ALC268_ACER_ASPIRE_ONE),
11566 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11567 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11568 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11569 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11570 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11571 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11572 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11573 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11574 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11575 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11579 static struct alc_config_preset alc268_presets[] = {
11580 [ALC267_QUANTA_IL1] = {
11581 .mixers = { alc267_quanta_il1_mixer },
11582 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11583 alc267_quanta_il1_verbs },
11584 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11585 .dac_nids = alc268_dac_nids,
11586 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11587 .adc_nids = alc268_adc_nids_alt,
11589 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11590 .channel_mode = alc268_modes,
11591 .input_mux = &alc268_capture_source,
11592 .unsol_event = alc267_quanta_il1_unsol_event,
11593 .init_hook = alc267_quanta_il1_automute,
11596 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11597 alc268_beep_mixer },
11598 .init_verbs = { alc268_base_init_verbs },
11599 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11600 .dac_nids = alc268_dac_nids,
11601 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11602 .adc_nids = alc268_adc_nids_alt,
11603 .capsrc_nids = alc268_capsrc_nids,
11605 .dig_out_nid = ALC268_DIGOUT_NID,
11606 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11607 .channel_mode = alc268_modes,
11608 .input_mux = &alc268_capture_source,
11610 [ALC268_TOSHIBA] = {
11611 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11612 alc268_beep_mixer },
11613 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11614 alc268_toshiba_verbs },
11615 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11616 .dac_nids = alc268_dac_nids,
11617 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11618 .adc_nids = alc268_adc_nids_alt,
11619 .capsrc_nids = alc268_capsrc_nids,
11621 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11622 .channel_mode = alc268_modes,
11623 .input_mux = &alc268_capture_source,
11624 .unsol_event = alc268_toshiba_unsol_event,
11625 .init_hook = alc268_toshiba_automute,
11628 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11629 alc268_beep_mixer },
11630 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11631 alc268_acer_verbs },
11632 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11633 .dac_nids = alc268_dac_nids,
11634 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11635 .adc_nids = alc268_adc_nids_alt,
11636 .capsrc_nids = alc268_capsrc_nids,
11638 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11639 .channel_mode = alc268_modes,
11640 .input_mux = &alc268_acer_capture_source,
11641 .unsol_event = alc268_acer_unsol_event,
11642 .init_hook = alc268_acer_init_hook,
11644 [ALC268_ACER_ASPIRE_ONE] = {
11645 .mixers = { alc268_acer_aspire_one_mixer,
11646 alc268_capture_alt_mixer },
11647 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11648 alc268_acer_aspire_one_verbs },
11649 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11650 .dac_nids = alc268_dac_nids,
11651 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11652 .adc_nids = alc268_adc_nids_alt,
11653 .capsrc_nids = alc268_capsrc_nids,
11655 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11656 .channel_mode = alc268_modes,
11657 .input_mux = &alc268_acer_lc_capture_source,
11658 .unsol_event = alc268_acer_lc_unsol_event,
11659 .init_hook = alc268_acer_lc_init_hook,
11662 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11663 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11664 alc268_dell_verbs },
11665 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11666 .dac_nids = alc268_dac_nids,
11668 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11669 .channel_mode = alc268_modes,
11670 .unsol_event = alc268_dell_unsol_event,
11671 .init_hook = alc268_dell_init_hook,
11672 .input_mux = &alc268_capture_source,
11675 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11676 alc268_beep_mixer },
11677 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11678 alc268_toshiba_verbs },
11679 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11680 .dac_nids = alc268_dac_nids,
11681 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11682 .adc_nids = alc268_adc_nids_alt,
11683 .capsrc_nids = alc268_capsrc_nids,
11685 .dig_out_nid = ALC268_DIGOUT_NID,
11686 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11687 .channel_mode = alc268_modes,
11688 .input_mux = &alc268_capture_source,
11689 .unsol_event = alc268_toshiba_unsol_event,
11690 .init_hook = alc268_toshiba_automute
11692 #ifdef CONFIG_SND_DEBUG
11694 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11695 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11696 alc268_volume_init_verbs },
11697 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11698 .dac_nids = alc268_dac_nids,
11699 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11700 .adc_nids = alc268_adc_nids_alt,
11701 .capsrc_nids = alc268_capsrc_nids,
11703 .dig_out_nid = ALC268_DIGOUT_NID,
11704 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11705 .channel_mode = alc268_modes,
11706 .input_mux = &alc268_capture_source,
11711 static int patch_alc268(struct hda_codec *codec)
11713 struct alc_spec *spec;
11717 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11721 codec->spec = spec;
11723 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11727 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11728 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11729 "trying auto-probe from BIOS...\n");
11730 board_config = ALC268_AUTO;
11733 if (board_config == ALC268_AUTO) {
11734 /* automatic parse from the BIOS config */
11735 err = alc268_parse_auto_config(codec);
11741 "hda_codec: Cannot set up configuration "
11742 "from BIOS. Using base mode...\n");
11743 board_config = ALC268_3ST;
11747 if (board_config != ALC268_AUTO)
11748 setup_preset(spec, &alc268_presets[board_config]);
11750 if (codec->vendor_id == 0x10ec0267) {
11751 spec->stream_name_analog = "ALC267 Analog";
11752 spec->stream_name_digital = "ALC267 Digital";
11754 spec->stream_name_analog = "ALC268 Analog";
11755 spec->stream_name_digital = "ALC268 Digital";
11758 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11759 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11760 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11762 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11764 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11765 /* override the amp caps for beep generator */
11766 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11767 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11768 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11769 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11770 (0 << AC_AMPCAP_MUTE_SHIFT));
11772 if (!spec->adc_nids && spec->input_mux) {
11773 /* check whether NID 0x07 is valid */
11774 unsigned int wcap = get_wcaps(codec, 0x07);
11778 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11779 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11780 spec->adc_nids = alc268_adc_nids_alt;
11781 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11782 spec->mixers[spec->num_mixers] =
11783 alc268_capture_alt_mixer;
11784 spec->num_mixers++;
11786 spec->adc_nids = alc268_adc_nids;
11787 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11788 spec->mixers[spec->num_mixers] =
11789 alc268_capture_mixer;
11790 spec->num_mixers++;
11792 spec->capsrc_nids = alc268_capsrc_nids;
11793 /* set default input source */
11794 for (i = 0; i < spec->num_adc_nids; i++)
11795 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11796 0, AC_VERB_SET_CONNECT_SEL,
11797 spec->input_mux->items[0].index);
11800 spec->vmaster_nid = 0x02;
11802 codec->patch_ops = alc_patch_ops;
11803 if (board_config == ALC268_AUTO)
11804 spec->init_hook = alc268_auto_init;
11810 * ALC269 channel source setting (2 channel)
11812 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11814 #define alc269_dac_nids alc260_dac_nids
11816 static hda_nid_t alc269_adc_nids[1] = {
11821 static hda_nid_t alc269_capsrc_nids[1] = {
11825 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11829 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11837 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11845 #define alc269_modes alc260_modes
11846 #define alc269_capture_source alc880_lg_lw_capture_source
11848 static struct snd_kcontrol_new alc269_base_mixer[] = {
11849 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11850 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11851 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11852 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11853 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11855 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11856 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11857 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11858 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11859 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11860 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11862 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11866 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11867 /* output mixer control */
11868 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11870 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11871 .name = "Master Playback Switch",
11872 .info = snd_hda_mixer_amp_switch_info,
11873 .get = snd_hda_mixer_amp_switch_get,
11874 .put = alc268_acer_master_sw_put,
11875 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11879 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11880 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11881 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11882 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11883 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11884 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11888 /* bind volumes of both NID 0x0c and 0x0d */
11889 static struct hda_bind_ctls alc269_epc_bind_vol = {
11890 .ops = &snd_hda_bind_vol,
11892 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11893 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11898 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11899 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11900 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11901 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11905 /* capture mixer elements */
11906 static struct snd_kcontrol_new alc269_capture_mixer[] = {
11907 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11908 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11910 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11911 /* The multiple "Capture Source" controls confuse alsamixer
11912 * So call somewhat different..
11914 /* .name = "Capture Source", */
11915 .name = "Input Source",
11917 .info = alc_mux_enum_info,
11918 .get = alc_mux_enum_get,
11919 .put = alc_mux_enum_put,
11924 /* capture mixer elements */
11925 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11926 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11927 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11932 static struct snd_kcontrol_new alc269_beep_mixer[] = {
11933 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11934 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11938 static struct hda_verb alc269_quanta_fl1_verbs[] = {
11939 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11940 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11943 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11944 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11948 /* toggle speaker-output according to the hp-jack state */
11949 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11951 unsigned int present;
11952 unsigned char bits;
11954 present = snd_hda_codec_read(codec, 0x15, 0,
11955 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11956 bits = present ? AMP_IN_MUTE(0) : 0;
11957 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11958 AMP_IN_MUTE(0), bits);
11959 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11960 AMP_IN_MUTE(0), bits);
11962 snd_hda_codec_write(codec, 0x20, 0,
11963 AC_VERB_SET_COEF_INDEX, 0x0c);
11964 snd_hda_codec_write(codec, 0x20, 0,
11965 AC_VERB_SET_PROC_COEF, 0x680);
11967 snd_hda_codec_write(codec, 0x20, 0,
11968 AC_VERB_SET_COEF_INDEX, 0x0c);
11969 snd_hda_codec_write(codec, 0x20, 0,
11970 AC_VERB_SET_PROC_COEF, 0x480);
11973 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11975 unsigned int present;
11977 present = snd_hda_codec_read(codec, 0x18, 0,
11978 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11979 snd_hda_codec_write(codec, 0x23, 0,
11980 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11983 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11986 if ((res >> 26) == ALC880_HP_EVENT)
11987 alc269_quanta_fl1_speaker_automute(codec);
11988 if ((res >> 26) == ALC880_MIC_EVENT)
11989 alc269_quanta_fl1_mic_automute(codec);
11992 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
11994 alc269_quanta_fl1_speaker_automute(codec);
11995 alc269_quanta_fl1_mic_automute(codec);
11998 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11999 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12000 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12001 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12002 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12003 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12004 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12005 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12009 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12010 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12011 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12012 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12013 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12014 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12015 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12019 /* toggle speaker-output according to the hp-jack state */
12020 static void alc269_speaker_automute(struct hda_codec *codec)
12022 unsigned int present;
12023 unsigned char bits;
12025 present = snd_hda_codec_read(codec, 0x15, 0,
12026 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12027 bits = present ? AMP_IN_MUTE(0) : 0;
12028 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12029 AMP_IN_MUTE(0), bits);
12030 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12031 AMP_IN_MUTE(0), bits);
12034 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12036 unsigned int present;
12038 present = snd_hda_codec_read(codec, 0x18, 0,
12039 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12040 snd_hda_codec_write(codec, 0x23, 0,
12041 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12044 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12046 unsigned int present;
12048 present = snd_hda_codec_read(codec, 0x18, 0,
12049 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12050 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12051 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12052 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12053 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12056 /* unsolicited event for HP jack sensing */
12057 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12060 if ((res >> 26) == ALC880_HP_EVENT)
12061 alc269_speaker_automute(codec);
12063 if ((res >> 26) == ALC880_MIC_EVENT)
12064 alc269_eeepc_dmic_automute(codec);
12067 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12069 alc269_speaker_automute(codec);
12070 alc269_eeepc_dmic_automute(codec);
12073 /* unsolicited event for HP jack sensing */
12074 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12077 if ((res >> 26) == ALC880_HP_EVENT)
12078 alc269_speaker_automute(codec);
12080 if ((res >> 26) == ALC880_MIC_EVENT)
12081 alc269_eeepc_amic_automute(codec);
12084 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12086 alc269_speaker_automute(codec);
12087 alc269_eeepc_amic_automute(codec);
12091 * generic initialization of ADC, input mixers and output mixers
12093 static struct hda_verb alc269_init_verbs[] = {
12095 * Unmute ADC0 and set the default input to mic-in
12097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12099 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12100 * analog-loopback mixer widget
12101 * Note: PASD motherboards uses the Line In 2 as the input for
12102 * front panel mic (mic 2)
12104 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12112 * Set up output mixers (0x0c - 0x0e)
12114 /* set vol=0 to output mixers */
12115 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12116 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12118 /* set up input amps for analog loopback */
12119 /* Amp Indices: DAC = 0, mixer = 1 */
12120 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12121 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12122 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12123 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12124 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12125 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12127 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12128 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12129 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12130 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12131 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12132 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12133 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12135 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12136 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12137 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12138 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12139 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12140 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12141 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12143 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12144 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12146 /* FIXME: use matrix-type input source selection */
12147 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12148 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12149 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12150 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12151 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12152 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12155 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12156 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12160 /* add playback controls from the parsed DAC table */
12161 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12162 const struct auto_pin_cfg *cfg)
12167 spec->multiout.num_dacs = 1; /* only use one dac */
12168 spec->multiout.dac_nids = spec->private_dac_nids;
12169 spec->multiout.dac_nids[0] = 2;
12171 nid = cfg->line_out_pins[0];
12173 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12174 "Front Playback Volume",
12175 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12178 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12179 "Front Playback Switch",
12180 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12185 nid = cfg->speaker_pins[0];
12187 if (!cfg->line_out_pins[0]) {
12188 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12189 "Speaker Playback Volume",
12190 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12196 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12197 "Speaker Playback Switch",
12198 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12203 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12204 "Speaker Playback Switch",
12205 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12211 nid = cfg->hp_pins[0];
12213 /* spec->multiout.hp_nid = 2; */
12214 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12215 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12216 "Headphone Playback Volume",
12217 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12223 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12224 "Headphone Playback Switch",
12225 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12230 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12231 "Headphone Playback Switch",
12232 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12241 #define alc269_auto_create_analog_input_ctls \
12242 alc880_auto_create_analog_input_ctls
12244 #ifdef CONFIG_SND_HDA_POWER_SAVE
12245 #define alc269_loopbacks alc880_loopbacks
12248 /* pcm configuration: identiacal with ALC880 */
12249 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12250 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12251 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12252 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12255 * BIOS auto configuration
12257 static int alc269_parse_auto_config(struct hda_codec *codec)
12259 struct alc_spec *spec = codec->spec;
12261 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12263 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12268 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12271 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12275 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12277 if (spec->autocfg.dig_out_pin)
12278 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12280 if (spec->kctl_alloc)
12281 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12283 /* create a beep mixer control if the pin 0x1d isn't assigned */
12284 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12285 if (spec->autocfg.input_pins[i] == 0x1d)
12287 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12288 spec->mixers[spec->num_mixers++] = alc269_beep_mixer;
12290 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
12291 spec->num_mux_defs = 1;
12292 spec->input_mux = &spec->private_imux;
12293 /* set default input source */
12294 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12295 0, AC_VERB_SET_CONNECT_SEL,
12296 spec->input_mux->items[0].index);
12298 err = alc_auto_add_mic_boost(codec);
12302 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
12303 spec->num_mixers++;
12305 store_pin_configs(codec);
12309 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12310 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12311 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12314 /* init callback for auto-configuration model -- overriding the default init */
12315 static void alc269_auto_init(struct hda_codec *codec)
12317 struct alc_spec *spec = codec->spec;
12318 alc269_auto_init_multi_out(codec);
12319 alc269_auto_init_hp_out(codec);
12320 alc269_auto_init_analog_input(codec);
12321 if (spec->unsol_event)
12322 alc_inithook(codec);
12326 * configuration and preset
12328 static const char *alc269_models[ALC269_MODEL_LAST] = {
12329 [ALC269_BASIC] = "basic",
12330 [ALC269_QUANTA_FL1] = "quanta",
12331 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12332 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901"
12335 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12336 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12337 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12338 ALC269_ASUS_EEEPC_P703),
12339 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12340 ALC269_ASUS_EEEPC_P901),
12341 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12342 ALC269_ASUS_EEEPC_P901),
12346 static struct alc_config_preset alc269_presets[] = {
12348 .mixers = { alc269_base_mixer, alc269_capture_mixer },
12349 .init_verbs = { alc269_init_verbs },
12350 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12351 .dac_nids = alc269_dac_nids,
12353 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12354 .channel_mode = alc269_modes,
12355 .input_mux = &alc269_capture_source,
12357 [ALC269_QUANTA_FL1] = {
12358 .mixers = { alc269_quanta_fl1_mixer },
12359 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12360 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12361 .dac_nids = alc269_dac_nids,
12363 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12364 .channel_mode = alc269_modes,
12365 .input_mux = &alc269_capture_source,
12366 .unsol_event = alc269_quanta_fl1_unsol_event,
12367 .init_hook = alc269_quanta_fl1_init_hook,
12369 [ALC269_ASUS_EEEPC_P703] = {
12370 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer },
12371 .init_verbs = { alc269_init_verbs,
12372 alc269_eeepc_amic_init_verbs },
12373 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12374 .dac_nids = alc269_dac_nids,
12376 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12377 .channel_mode = alc269_modes,
12378 .input_mux = &alc269_eeepc_amic_capture_source,
12379 .unsol_event = alc269_eeepc_amic_unsol_event,
12380 .init_hook = alc269_eeepc_amic_inithook,
12382 [ALC269_ASUS_EEEPC_P901] = {
12383 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer},
12384 .init_verbs = { alc269_init_verbs,
12385 alc269_eeepc_dmic_init_verbs },
12386 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12387 .dac_nids = alc269_dac_nids,
12389 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12390 .channel_mode = alc269_modes,
12391 .input_mux = &alc269_eeepc_dmic_capture_source,
12392 .unsol_event = alc269_eeepc_dmic_unsol_event,
12393 .init_hook = alc269_eeepc_dmic_inithook,
12397 static int patch_alc269(struct hda_codec *codec)
12399 struct alc_spec *spec;
12403 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12407 codec->spec = spec;
12409 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12411 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12415 if (board_config < 0) {
12416 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12417 "trying auto-probe from BIOS...\n");
12418 board_config = ALC269_AUTO;
12421 if (board_config == ALC269_AUTO) {
12422 /* automatic parse from the BIOS config */
12423 err = alc269_parse_auto_config(codec);
12429 "hda_codec: Cannot set up configuration "
12430 "from BIOS. Using base mode...\n");
12431 board_config = ALC269_BASIC;
12435 if (board_config != ALC269_AUTO)
12436 setup_preset(spec, &alc269_presets[board_config]);
12438 spec->stream_name_analog = "ALC269 Analog";
12439 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12440 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12442 spec->stream_name_digital = "ALC269 Digital";
12443 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12444 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12446 spec->adc_nids = alc269_adc_nids;
12447 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12448 spec->capsrc_nids = alc269_capsrc_nids;
12450 codec->patch_ops = alc_patch_ops;
12451 if (board_config == ALC269_AUTO)
12452 spec->init_hook = alc269_auto_init;
12453 #ifdef CONFIG_SND_HDA_POWER_SAVE
12454 if (!spec->loopback.amplist)
12455 spec->loopback.amplist = alc269_loopbacks;
12462 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12466 * set the path ways for 2 channel output
12467 * need to set the codec line out and mic 1 pin widgets to inputs
12469 static struct hda_verb alc861_threestack_ch2_init[] = {
12470 /* set pin widget 1Ah (line in) for input */
12471 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12472 /* set pin widget 18h (mic1/2) for input, for mic also enable
12475 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12477 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12479 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12480 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12486 * need to set the codec line out and mic 1 pin widgets to outputs
12488 static struct hda_verb alc861_threestack_ch6_init[] = {
12489 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12490 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12491 /* set pin widget 18h (mic1) for output (CLFE)*/
12492 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12494 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12495 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12497 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12499 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12500 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12505 static struct hda_channel_mode alc861_threestack_modes[2] = {
12506 { 2, alc861_threestack_ch2_init },
12507 { 6, alc861_threestack_ch6_init },
12509 /* Set mic1 as input and unmute the mixer */
12510 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12511 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12512 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12515 /* Set mic1 as output and mute mixer */
12516 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12517 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12518 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12522 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12523 { 2, alc861_uniwill_m31_ch2_init },
12524 { 4, alc861_uniwill_m31_ch4_init },
12527 /* Set mic1 and line-in as input and unmute the mixer */
12528 static struct hda_verb alc861_asus_ch2_init[] = {
12529 /* set pin widget 1Ah (line in) for input */
12530 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12531 /* set pin widget 18h (mic1/2) for input, for mic also enable
12534 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12536 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12538 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12539 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12543 /* Set mic1 nad line-in as output and mute mixer */
12544 static struct hda_verb alc861_asus_ch6_init[] = {
12545 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12546 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12547 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12548 /* set pin widget 18h (mic1) for output (CLFE)*/
12549 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12550 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12551 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12552 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12554 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12556 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12557 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12562 static struct hda_channel_mode alc861_asus_modes[2] = {
12563 { 2, alc861_asus_ch2_init },
12564 { 6, alc861_asus_ch6_init },
12569 static struct snd_kcontrol_new alc861_base_mixer[] = {
12570 /* output mixer control */
12571 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12572 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12573 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12574 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12575 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12577 /*Input mixer control */
12578 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12579 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12580 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12581 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12582 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12583 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12584 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12585 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12586 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12587 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12589 /* Capture mixer control */
12590 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12591 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12593 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12594 .name = "Capture Source",
12596 .info = alc_mux_enum_info,
12597 .get = alc_mux_enum_get,
12598 .put = alc_mux_enum_put,
12603 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12604 /* output mixer control */
12605 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12606 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12607 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12608 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12609 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12611 /* Input mixer control */
12612 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12613 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12614 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12615 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12616 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12617 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12619 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12620 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12623 /* Capture mixer control */
12624 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12625 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12627 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12628 .name = "Capture Source",
12630 .info = alc_mux_enum_info,
12631 .get = alc_mux_enum_get,
12632 .put = alc_mux_enum_put,
12635 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12636 .name = "Channel Mode",
12637 .info = alc_ch_mode_info,
12638 .get = alc_ch_mode_get,
12639 .put = alc_ch_mode_put,
12640 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12645 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12646 /* output mixer control */
12647 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12649 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12651 /*Capture mixer control */
12652 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12653 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12655 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12656 .name = "Capture Source",
12658 .info = alc_mux_enum_info,
12659 .get = alc_mux_enum_get,
12660 .put = alc_mux_enum_put,
12666 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12667 /* output mixer control */
12668 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12669 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12670 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12671 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12672 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12674 /* Input mixer control */
12675 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12676 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12677 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12678 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12679 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12680 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12682 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12683 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12686 /* Capture mixer control */
12687 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12688 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12690 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12691 .name = "Capture Source",
12693 .info = alc_mux_enum_info,
12694 .get = alc_mux_enum_get,
12695 .put = alc_mux_enum_put,
12698 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12699 .name = "Channel Mode",
12700 .info = alc_ch_mode_info,
12701 .get = alc_ch_mode_get,
12702 .put = alc_ch_mode_put,
12703 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12708 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12709 /* output mixer control */
12710 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12711 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12712 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12713 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12714 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12716 /* Input mixer control */
12717 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12718 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12719 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12720 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12721 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12722 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12724 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12725 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12726 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12728 /* Capture mixer control */
12729 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12730 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12732 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12733 .name = "Capture Source",
12735 .info = alc_mux_enum_info,
12736 .get = alc_mux_enum_get,
12737 .put = alc_mux_enum_put,
12740 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12741 .name = "Channel Mode",
12742 .info = alc_ch_mode_info,
12743 .get = alc_ch_mode_get,
12744 .put = alc_ch_mode_put,
12745 .private_value = ARRAY_SIZE(alc861_asus_modes),
12750 /* additional mixer */
12751 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12752 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12753 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12754 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12755 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12760 * generic initialization of ADC, input mixers and output mixers
12762 static struct hda_verb alc861_base_init_verbs[] = {
12764 * Unmute ADC0 and set the default input to mic-in
12766 /* port-A for surround (rear panel) */
12767 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12768 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
12769 /* port-B for mic-in (rear panel) with vref */
12770 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12771 /* port-C for line-in (rear panel) */
12772 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12773 /* port-D for Front */
12774 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12775 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12776 /* port-E for HP out (front panel) */
12777 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12778 /* route front PCM to HP */
12779 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12780 /* port-F for mic-in (front panel) with vref */
12781 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12782 /* port-G for CLFE (rear panel) */
12783 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12784 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12785 /* port-H for side (rear panel) */
12786 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12787 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
12789 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12790 /* route front mic to ADC1*/
12791 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12792 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12794 /* Unmute DAC0~3 & spdif out*/
12795 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12796 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12797 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12798 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12801 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12802 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12803 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12804 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12805 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12807 /* Unmute Stereo Mixer 15 */
12808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12809 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12813 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12814 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12815 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12816 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12817 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12818 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12820 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12821 /* hp used DAC 3 (Front) */
12822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12823 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12828 static struct hda_verb alc861_threestack_init_verbs[] = {
12830 * Unmute ADC0 and set the default input to mic-in
12832 /* port-A for surround (rear panel) */
12833 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12834 /* port-B for mic-in (rear panel) with vref */
12835 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12836 /* port-C for line-in (rear panel) */
12837 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12838 /* port-D for Front */
12839 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12840 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12841 /* port-E for HP out (front panel) */
12842 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12843 /* route front PCM to HP */
12844 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12845 /* port-F for mic-in (front panel) with vref */
12846 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12847 /* port-G for CLFE (rear panel) */
12848 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12849 /* port-H for side (rear panel) */
12850 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12852 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12853 /* route front mic to ADC1*/
12854 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12856 /* Unmute DAC0~3 & spdif out*/
12857 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12858 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12859 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12860 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12863 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12864 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12865 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12866 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12867 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12869 /* Unmute Stereo Mixer 15 */
12870 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12875 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12876 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12877 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12878 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12879 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12880 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12881 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12882 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12883 /* hp used DAC 3 (Front) */
12884 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12885 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12889 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
12891 * Unmute ADC0 and set the default input to mic-in
12893 /* port-A for surround (rear panel) */
12894 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12895 /* port-B for mic-in (rear panel) with vref */
12896 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12897 /* port-C for line-in (rear panel) */
12898 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12899 /* port-D for Front */
12900 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12901 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12902 /* port-E for HP out (front panel) */
12903 /* this has to be set to VREF80 */
12904 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12905 /* route front PCM to HP */
12906 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12907 /* port-F for mic-in (front panel) with vref */
12908 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12909 /* port-G for CLFE (rear panel) */
12910 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12911 /* port-H for side (rear panel) */
12912 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12914 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12915 /* route front mic to ADC1*/
12916 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12918 /* Unmute DAC0~3 & spdif out*/
12919 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12920 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12921 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12922 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12923 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12925 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12926 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12927 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12928 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12929 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12931 /* Unmute Stereo Mixer 15 */
12932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12934 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12937 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12938 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12939 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12940 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12941 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12942 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12943 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12944 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12945 /* hp used DAC 3 (Front) */
12946 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12947 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12951 static struct hda_verb alc861_asus_init_verbs[] = {
12953 * Unmute ADC0 and set the default input to mic-in
12955 /* port-A for surround (rear panel)
12956 * according to codec#0 this is the HP jack
12958 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12959 /* route front PCM to HP */
12960 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12961 /* port-B for mic-in (rear panel) with vref */
12962 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12963 /* port-C for line-in (rear panel) */
12964 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12965 /* port-D for Front */
12966 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12967 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12968 /* port-E for HP out (front panel) */
12969 /* this has to be set to VREF80 */
12970 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12971 /* route front PCM to HP */
12972 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12973 /* port-F for mic-in (front panel) with vref */
12974 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12975 /* port-G for CLFE (rear panel) */
12976 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12977 /* port-H for side (rear panel) */
12978 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12980 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12981 /* route front mic to ADC1*/
12982 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12984 /* Unmute DAC0~3 & spdif out*/
12985 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12986 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12987 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12988 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12990 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12991 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12992 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12993 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12994 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12996 /* Unmute Stereo Mixer 15 */
12997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13002 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13003 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13004 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13005 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13006 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13007 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13008 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13009 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13010 /* hp used DAC 3 (Front) */
13011 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13016 /* additional init verbs for ASUS laptops */
13017 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13018 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13019 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13024 * generic initialization of ADC, input mixers and output mixers
13026 static struct hda_verb alc861_auto_init_verbs[] = {
13028 * Unmute ADC0 and set the default input to mic-in
13030 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13031 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13033 /* Unmute DAC0~3 & spdif out*/
13034 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13035 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13036 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13037 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13038 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13040 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13041 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13042 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13043 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13044 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13046 /* Unmute Stereo Mixer 15 */
13047 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13048 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13049 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13052 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13053 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13054 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13055 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13056 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13057 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13058 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13059 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13061 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13062 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13063 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13064 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13065 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13066 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13067 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13068 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13070 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13075 static struct hda_verb alc861_toshiba_init_verbs[] = {
13076 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13081 /* toggle speaker-output according to the hp-jack state */
13082 static void alc861_toshiba_automute(struct hda_codec *codec)
13084 unsigned int present;
13086 present = snd_hda_codec_read(codec, 0x0f, 0,
13087 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13088 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13089 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13090 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13091 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13094 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13097 if ((res >> 26) == ALC880_HP_EVENT)
13098 alc861_toshiba_automute(codec);
13101 /* pcm configuration: identiacal with ALC880 */
13102 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13103 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13104 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13105 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13108 #define ALC861_DIGOUT_NID 0x07
13110 static struct hda_channel_mode alc861_8ch_modes[1] = {
13114 static hda_nid_t alc861_dac_nids[4] = {
13115 /* front, surround, clfe, side */
13116 0x03, 0x06, 0x05, 0x04
13119 static hda_nid_t alc660_dac_nids[3] = {
13120 /* front, clfe, surround */
13124 static hda_nid_t alc861_adc_nids[1] = {
13129 static struct hda_input_mux alc861_capture_source = {
13133 { "Front Mic", 0x3 },
13140 /* fill in the dac_nids table from the parsed pin configuration */
13141 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13142 const struct auto_pin_cfg *cfg)
13147 spec->multiout.dac_nids = spec->private_dac_nids;
13148 for (i = 0; i < cfg->line_outs; i++) {
13149 nid = cfg->line_out_pins[i];
13151 if (i >= ARRAY_SIZE(alc861_dac_nids))
13153 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13156 spec->multiout.num_dacs = cfg->line_outs;
13160 /* add playback controls from the parsed DAC table */
13161 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13162 const struct auto_pin_cfg *cfg)
13165 static const char *chname[4] = {
13166 "Front", "Surround", NULL /*CLFE*/, "Side"
13171 for (i = 0; i < cfg->line_outs; i++) {
13172 nid = spec->multiout.dac_nids[i];
13177 err = add_control(spec, ALC_CTL_BIND_MUTE,
13178 "Center Playback Switch",
13179 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13183 err = add_control(spec, ALC_CTL_BIND_MUTE,
13184 "LFE Playback Switch",
13185 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13190 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13192 if (nid == alc861_dac_nids[idx])
13194 sprintf(name, "%s Playback Switch", chname[idx]);
13195 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13196 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13205 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13213 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13215 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13216 "Headphone Playback Switch",
13217 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13220 spec->multiout.hp_nid = nid;
13225 /* create playback/capture controls for input pins */
13226 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13227 const struct auto_pin_cfg *cfg)
13229 struct hda_input_mux *imux = &spec->private_imux;
13230 int i, err, idx, idx1;
13232 for (i = 0; i < AUTO_PIN_LAST; i++) {
13233 switch (cfg->input_pins[i]) {
13236 idx = 2; /* Line In */
13240 idx = 2; /* Line In */
13244 idx = 1; /* Mic In */
13248 idx = 1; /* Mic In */
13258 err = new_analog_input(spec, cfg->input_pins[i],
13259 auto_pin_cfg_labels[i], idx, 0x15);
13263 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13264 imux->items[imux->num_items].index = idx1;
13270 static struct snd_kcontrol_new alc861_capture_mixer[] = {
13271 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13272 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13275 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13276 /* The multiple "Capture Source" controls confuse alsamixer
13277 * So call somewhat different..
13279 /* .name = "Capture Source", */
13280 .name = "Input Source",
13282 .info = alc_mux_enum_info,
13283 .get = alc_mux_enum_get,
13284 .put = alc_mux_enum_put,
13289 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13291 int pin_type, int dac_idx)
13293 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13295 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13299 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13301 struct alc_spec *spec = codec->spec;
13304 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13305 for (i = 0; i < spec->autocfg.line_outs; i++) {
13306 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13307 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13309 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13310 spec->multiout.dac_nids[i]);
13314 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13316 struct alc_spec *spec = codec->spec;
13319 pin = spec->autocfg.hp_pins[0];
13320 if (pin) /* connect to front */
13321 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13322 spec->multiout.dac_nids[0]);
13323 pin = spec->autocfg.speaker_pins[0];
13325 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13328 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13330 struct alc_spec *spec = codec->spec;
13333 for (i = 0; i < AUTO_PIN_LAST; i++) {
13334 hda_nid_t nid = spec->autocfg.input_pins[i];
13335 if (nid >= 0x0c && nid <= 0x11) {
13336 snd_hda_codec_write(codec, nid, 0,
13337 AC_VERB_SET_PIN_WIDGET_CONTROL,
13338 i <= AUTO_PIN_FRONT_MIC ?
13339 PIN_VREF80 : PIN_IN);
13344 /* parse the BIOS configuration and set up the alc_spec */
13345 /* return 1 if successful, 0 if the proper config is not found,
13346 * or a negative error code
13348 static int alc861_parse_auto_config(struct hda_codec *codec)
13350 struct alc_spec *spec = codec->spec;
13352 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13354 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13358 if (!spec->autocfg.line_outs)
13359 return 0; /* can't find valid BIOS pin config */
13361 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13364 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13367 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13370 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13374 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13376 if (spec->autocfg.dig_out_pin)
13377 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13379 if (spec->kctl_alloc)
13380 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13382 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
13384 spec->num_mux_defs = 1;
13385 spec->input_mux = &spec->private_imux;
13387 spec->adc_nids = alc861_adc_nids;
13388 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13389 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
13390 spec->num_mixers++;
13392 store_pin_configs(codec);
13396 /* additional initialization for auto-configuration model */
13397 static void alc861_auto_init(struct hda_codec *codec)
13399 struct alc_spec *spec = codec->spec;
13400 alc861_auto_init_multi_out(codec);
13401 alc861_auto_init_hp_out(codec);
13402 alc861_auto_init_analog_input(codec);
13403 if (spec->unsol_event)
13404 alc_inithook(codec);
13407 #ifdef CONFIG_SND_HDA_POWER_SAVE
13408 static struct hda_amp_list alc861_loopbacks[] = {
13409 { 0x15, HDA_INPUT, 0 },
13410 { 0x15, HDA_INPUT, 1 },
13411 { 0x15, HDA_INPUT, 2 },
13412 { 0x15, HDA_INPUT, 3 },
13419 * configuration and preset
13421 static const char *alc861_models[ALC861_MODEL_LAST] = {
13422 [ALC861_3ST] = "3stack",
13423 [ALC660_3ST] = "3stack-660",
13424 [ALC861_3ST_DIG] = "3stack-dig",
13425 [ALC861_6ST_DIG] = "6stack-dig",
13426 [ALC861_UNIWILL_M31] = "uniwill-m31",
13427 [ALC861_TOSHIBA] = "toshiba",
13428 [ALC861_ASUS] = "asus",
13429 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13430 [ALC861_AUTO] = "auto",
13433 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13434 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13435 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13436 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13437 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13438 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13439 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13440 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13441 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13442 * Any other models that need this preset?
13444 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13445 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13446 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13447 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13448 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13449 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13450 /* FIXME: the below seems conflict */
13451 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13452 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13453 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13457 static struct alc_config_preset alc861_presets[] = {
13459 .mixers = { alc861_3ST_mixer },
13460 .init_verbs = { alc861_threestack_init_verbs },
13461 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13462 .dac_nids = alc861_dac_nids,
13463 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13464 .channel_mode = alc861_threestack_modes,
13466 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13467 .adc_nids = alc861_adc_nids,
13468 .input_mux = &alc861_capture_source,
13470 [ALC861_3ST_DIG] = {
13471 .mixers = { alc861_base_mixer },
13472 .init_verbs = { alc861_threestack_init_verbs },
13473 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13474 .dac_nids = alc861_dac_nids,
13475 .dig_out_nid = ALC861_DIGOUT_NID,
13476 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13477 .channel_mode = alc861_threestack_modes,
13479 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13480 .adc_nids = alc861_adc_nids,
13481 .input_mux = &alc861_capture_source,
13483 [ALC861_6ST_DIG] = {
13484 .mixers = { alc861_base_mixer },
13485 .init_verbs = { alc861_base_init_verbs },
13486 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13487 .dac_nids = alc861_dac_nids,
13488 .dig_out_nid = ALC861_DIGOUT_NID,
13489 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13490 .channel_mode = alc861_8ch_modes,
13491 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13492 .adc_nids = alc861_adc_nids,
13493 .input_mux = &alc861_capture_source,
13496 .mixers = { alc861_3ST_mixer },
13497 .init_verbs = { alc861_threestack_init_verbs },
13498 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13499 .dac_nids = alc660_dac_nids,
13500 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13501 .channel_mode = alc861_threestack_modes,
13503 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13504 .adc_nids = alc861_adc_nids,
13505 .input_mux = &alc861_capture_source,
13507 [ALC861_UNIWILL_M31] = {
13508 .mixers = { alc861_uniwill_m31_mixer },
13509 .init_verbs = { alc861_uniwill_m31_init_verbs },
13510 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13511 .dac_nids = alc861_dac_nids,
13512 .dig_out_nid = ALC861_DIGOUT_NID,
13513 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13514 .channel_mode = alc861_uniwill_m31_modes,
13516 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13517 .adc_nids = alc861_adc_nids,
13518 .input_mux = &alc861_capture_source,
13520 [ALC861_TOSHIBA] = {
13521 .mixers = { alc861_toshiba_mixer },
13522 .init_verbs = { alc861_base_init_verbs,
13523 alc861_toshiba_init_verbs },
13524 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13525 .dac_nids = alc861_dac_nids,
13526 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13527 .channel_mode = alc883_3ST_2ch_modes,
13528 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13529 .adc_nids = alc861_adc_nids,
13530 .input_mux = &alc861_capture_source,
13531 .unsol_event = alc861_toshiba_unsol_event,
13532 .init_hook = alc861_toshiba_automute,
13535 .mixers = { alc861_asus_mixer },
13536 .init_verbs = { alc861_asus_init_verbs },
13537 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13538 .dac_nids = alc861_dac_nids,
13539 .dig_out_nid = ALC861_DIGOUT_NID,
13540 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13541 .channel_mode = alc861_asus_modes,
13544 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13545 .adc_nids = alc861_adc_nids,
13546 .input_mux = &alc861_capture_source,
13548 [ALC861_ASUS_LAPTOP] = {
13549 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13550 .init_verbs = { alc861_asus_init_verbs,
13551 alc861_asus_laptop_init_verbs },
13552 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13553 .dac_nids = alc861_dac_nids,
13554 .dig_out_nid = ALC861_DIGOUT_NID,
13555 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13556 .channel_mode = alc883_3ST_2ch_modes,
13558 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13559 .adc_nids = alc861_adc_nids,
13560 .input_mux = &alc861_capture_source,
13565 static int patch_alc861(struct hda_codec *codec)
13567 struct alc_spec *spec;
13571 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13575 codec->spec = spec;
13577 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13581 if (board_config < 0) {
13582 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13583 "trying auto-probe from BIOS...\n");
13584 board_config = ALC861_AUTO;
13587 if (board_config == ALC861_AUTO) {
13588 /* automatic parse from the BIOS config */
13589 err = alc861_parse_auto_config(codec);
13595 "hda_codec: Cannot set up configuration "
13596 "from BIOS. Using base mode...\n");
13597 board_config = ALC861_3ST_DIG;
13601 if (board_config != ALC861_AUTO)
13602 setup_preset(spec, &alc861_presets[board_config]);
13604 spec->stream_name_analog = "ALC861 Analog";
13605 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13606 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13608 spec->stream_name_digital = "ALC861 Digital";
13609 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13610 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13612 spec->vmaster_nid = 0x03;
13614 codec->patch_ops = alc_patch_ops;
13615 if (board_config == ALC861_AUTO)
13616 spec->init_hook = alc861_auto_init;
13617 #ifdef CONFIG_SND_HDA_POWER_SAVE
13618 if (!spec->loopback.amplist)
13619 spec->loopback.amplist = alc861_loopbacks;
13626 * ALC861-VD support
13630 * In addition, an independent DAC
13632 #define ALC861VD_DIGOUT_NID 0x06
13634 static hda_nid_t alc861vd_dac_nids[4] = {
13635 /* front, surr, clfe, side surr */
13636 0x02, 0x03, 0x04, 0x05
13639 /* dac_nids for ALC660vd are in a different order - according to
13640 * Realtek's driver.
13641 * This should probably tesult in a different mixer for 6stack models
13642 * of ALC660vd codecs, but for now there is only 3stack mixer
13643 * - and it is the same as in 861vd.
13644 * adc_nids in ALC660vd are (is) the same as in 861vd
13646 static hda_nid_t alc660vd_dac_nids[3] = {
13647 /* front, rear, clfe, rear_surr */
13651 static hda_nid_t alc861vd_adc_nids[1] = {
13656 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13659 /* FIXME: should be a matrix-type input source selection */
13660 static struct hda_input_mux alc861vd_capture_source = {
13664 { "Front Mic", 0x1 },
13670 static struct hda_input_mux alc861vd_dallas_capture_source = {
13673 { "Ext Mic", 0x0 },
13674 { "Int Mic", 0x1 },
13678 static struct hda_input_mux alc861vd_hp_capture_source = {
13681 { "Front Mic", 0x0 },
13682 { "ATAPI Mic", 0x1 },
13686 #define alc861vd_mux_enum_info alc_mux_enum_info
13687 #define alc861vd_mux_enum_get alc_mux_enum_get
13688 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
13689 #define alc861vd_mux_enum_put alc882_mux_enum_put
13694 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13701 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13702 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13703 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13704 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13705 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13712 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13713 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13714 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13715 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13716 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13720 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13721 { 6, alc861vd_6stack_ch6_init },
13722 { 8, alc861vd_6stack_ch8_init },
13725 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13727 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13728 .name = "Channel Mode",
13729 .info = alc_ch_mode_info,
13730 .get = alc_ch_mode_get,
13731 .put = alc_ch_mode_put,
13736 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
13737 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13738 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13742 /* The multiple "Capture Source" controls confuse alsamixer
13743 * So call somewhat different..
13745 /* .name = "Capture Source", */
13746 .name = "Input Source",
13748 .info = alc861vd_mux_enum_info,
13749 .get = alc861vd_mux_enum_get,
13750 .put = alc861vd_mux_enum_put,
13755 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13756 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13758 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13759 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13760 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13762 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13763 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13765 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13767 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13769 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13770 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13772 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13773 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13775 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13777 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13781 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13782 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13783 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13785 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13786 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13788 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13789 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13791 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13792 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13797 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13798 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13799 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13801 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13803 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13807 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13808 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13809 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13811 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13812 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13814 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13815 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13817 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13818 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13823 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
13824 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13825 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13826 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13830 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13834 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13835 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13836 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13838 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13839 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13844 /* Pin assignment: Speaker=0x14, HP = 0x15,
13845 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
13847 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
13848 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13849 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
13850 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13851 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13852 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13853 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13854 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13855 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13856 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13857 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13858 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
13859 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
13863 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
13864 * Front Mic=0x18, ATAPI Mic = 0x19,
13866 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
13867 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13868 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13869 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13870 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13871 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13872 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13873 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13874 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13880 * generic initialization of ADC, input mixers and output mixers
13882 static struct hda_verb alc861vd_volume_init_verbs[] = {
13884 * Unmute ADC0 and set the default input to mic-in
13886 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13887 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13889 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13890 * the analog-loopback mixer widget
13892 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13893 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13894 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13895 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13896 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13897 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13899 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13900 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13906 * Set up output mixers (0x02 - 0x05)
13908 /* set vol=0 to output mixers */
13909 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13910 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13911 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13912 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13914 /* set up input amps for analog loopback */
13915 /* Amp Indices: DAC = 0, mixer = 1 */
13916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13918 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13920 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13922 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13923 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13929 * 3-stack pin configuration:
13930 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13932 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13934 * Set pin mode and muting
13936 /* set front pin widgets 0x14 for output */
13937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13939 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13941 /* Mic (rear) pin: input vref at 80% */
13942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13943 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13944 /* Front Mic pin: input vref at 80% */
13945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13947 /* Line In pin: input */
13948 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13949 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13950 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13951 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13952 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13953 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13954 /* CD pin widget for input */
13955 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13961 * 6-stack pin configuration:
13963 static struct hda_verb alc861vd_6stack_init_verbs[] = {
13965 * Set pin mode and muting
13967 /* set front pin widgets 0x14 for output */
13968 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13969 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13970 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13972 /* Rear Pin: output 1 (0x0d) */
13973 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13976 /* CLFE Pin: output 2 (0x0e) */
13977 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13978 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13979 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13980 /* Side Pin: output 3 (0x0f) */
13981 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13982 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13983 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13985 /* Mic (rear) pin: input vref at 80% */
13986 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13987 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13988 /* Front Mic pin: input vref at 80% */
13989 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13990 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13991 /* Line In pin: input */
13992 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13993 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13994 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13995 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13996 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13997 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13998 /* CD pin widget for input */
13999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14004 static struct hda_verb alc861vd_eapd_verbs[] = {
14005 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14009 static struct hda_verb alc660vd_eapd_verbs[] = {
14010 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14011 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14015 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14018 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14019 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14020 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14024 /* toggle speaker-output according to the hp-jack state */
14025 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14027 unsigned int present;
14028 unsigned char bits;
14030 present = snd_hda_codec_read(codec, 0x1b, 0,
14031 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14032 bits = present ? HDA_AMP_MUTE : 0;
14033 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14034 HDA_AMP_MUTE, bits);
14037 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14039 unsigned int present;
14040 unsigned char bits;
14042 present = snd_hda_codec_read(codec, 0x18, 0,
14043 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14044 bits = present ? HDA_AMP_MUTE : 0;
14045 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14046 HDA_AMP_MUTE, bits);
14049 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14051 alc861vd_lenovo_hp_automute(codec);
14052 alc861vd_lenovo_mic_automute(codec);
14055 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14058 switch (res >> 26) {
14059 case ALC880_HP_EVENT:
14060 alc861vd_lenovo_hp_automute(codec);
14062 case ALC880_MIC_EVENT:
14063 alc861vd_lenovo_mic_automute(codec);
14068 static struct hda_verb alc861vd_dallas_verbs[] = {
14069 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14070 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14071 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14072 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14076 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14079 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14080 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14085 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14086 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14087 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14088 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14089 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14090 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14092 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14093 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14094 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14095 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14096 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14097 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14098 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14099 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14107 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14108 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14113 /* toggle speaker-output according to the hp-jack state */
14114 static void alc861vd_dallas_automute(struct hda_codec *codec)
14116 unsigned int present;
14118 present = snd_hda_codec_read(codec, 0x15, 0,
14119 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14120 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14121 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14124 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14126 if ((res >> 26) == ALC880_HP_EVENT)
14127 alc861vd_dallas_automute(codec);
14130 #ifdef CONFIG_SND_HDA_POWER_SAVE
14131 #define alc861vd_loopbacks alc880_loopbacks
14134 /* pcm configuration: identiacal with ALC880 */
14135 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14136 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14137 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14138 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14141 * configuration and preset
14143 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14144 [ALC660VD_3ST] = "3stack-660",
14145 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14146 [ALC861VD_3ST] = "3stack",
14147 [ALC861VD_3ST_DIG] = "3stack-digout",
14148 [ALC861VD_6ST_DIG] = "6stack-digout",
14149 [ALC861VD_LENOVO] = "lenovo",
14150 [ALC861VD_DALLAS] = "dallas",
14151 [ALC861VD_HP] = "hp",
14152 [ALC861VD_AUTO] = "auto",
14155 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14156 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14157 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14158 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14159 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14160 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO),
14161 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14162 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14163 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14164 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14165 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14166 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14167 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14168 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14169 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14170 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14171 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14172 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14176 static struct alc_config_preset alc861vd_presets[] = {
14178 .mixers = { alc861vd_3st_mixer },
14179 .init_verbs = { alc861vd_volume_init_verbs,
14180 alc861vd_3stack_init_verbs },
14181 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14182 .dac_nids = alc660vd_dac_nids,
14183 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14184 .channel_mode = alc861vd_3stack_2ch_modes,
14185 .input_mux = &alc861vd_capture_source,
14187 [ALC660VD_3ST_DIG] = {
14188 .mixers = { alc861vd_3st_mixer },
14189 .init_verbs = { alc861vd_volume_init_verbs,
14190 alc861vd_3stack_init_verbs },
14191 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14192 .dac_nids = alc660vd_dac_nids,
14193 .dig_out_nid = ALC861VD_DIGOUT_NID,
14194 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14195 .channel_mode = alc861vd_3stack_2ch_modes,
14196 .input_mux = &alc861vd_capture_source,
14199 .mixers = { alc861vd_3st_mixer },
14200 .init_verbs = { alc861vd_volume_init_verbs,
14201 alc861vd_3stack_init_verbs },
14202 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14203 .dac_nids = alc861vd_dac_nids,
14204 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14205 .channel_mode = alc861vd_3stack_2ch_modes,
14206 .input_mux = &alc861vd_capture_source,
14208 [ALC861VD_3ST_DIG] = {
14209 .mixers = { alc861vd_3st_mixer },
14210 .init_verbs = { alc861vd_volume_init_verbs,
14211 alc861vd_3stack_init_verbs },
14212 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14213 .dac_nids = alc861vd_dac_nids,
14214 .dig_out_nid = ALC861VD_DIGOUT_NID,
14215 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14216 .channel_mode = alc861vd_3stack_2ch_modes,
14217 .input_mux = &alc861vd_capture_source,
14219 [ALC861VD_6ST_DIG] = {
14220 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14221 .init_verbs = { alc861vd_volume_init_verbs,
14222 alc861vd_6stack_init_verbs },
14223 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14224 .dac_nids = alc861vd_dac_nids,
14225 .dig_out_nid = ALC861VD_DIGOUT_NID,
14226 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14227 .channel_mode = alc861vd_6stack_modes,
14228 .input_mux = &alc861vd_capture_source,
14230 [ALC861VD_LENOVO] = {
14231 .mixers = { alc861vd_lenovo_mixer },
14232 .init_verbs = { alc861vd_volume_init_verbs,
14233 alc861vd_3stack_init_verbs,
14234 alc861vd_eapd_verbs,
14235 alc861vd_lenovo_unsol_verbs },
14236 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14237 .dac_nids = alc660vd_dac_nids,
14238 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14239 .channel_mode = alc861vd_3stack_2ch_modes,
14240 .input_mux = &alc861vd_capture_source,
14241 .unsol_event = alc861vd_lenovo_unsol_event,
14242 .init_hook = alc861vd_lenovo_automute,
14244 [ALC861VD_DALLAS] = {
14245 .mixers = { alc861vd_dallas_mixer },
14246 .init_verbs = { alc861vd_dallas_verbs },
14247 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14248 .dac_nids = alc861vd_dac_nids,
14249 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14250 .channel_mode = alc861vd_3stack_2ch_modes,
14251 .input_mux = &alc861vd_dallas_capture_source,
14252 .unsol_event = alc861vd_dallas_unsol_event,
14253 .init_hook = alc861vd_dallas_automute,
14256 .mixers = { alc861vd_hp_mixer },
14257 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14258 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14259 .dac_nids = alc861vd_dac_nids,
14260 .dig_out_nid = ALC861VD_DIGOUT_NID,
14261 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14262 .channel_mode = alc861vd_3stack_2ch_modes,
14263 .input_mux = &alc861vd_hp_capture_source,
14264 .unsol_event = alc861vd_dallas_unsol_event,
14265 .init_hook = alc861vd_dallas_automute,
14270 * BIOS auto configuration
14272 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14273 hda_nid_t nid, int pin_type, int dac_idx)
14275 alc_set_pin_output(codec, nid, pin_type);
14278 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14280 struct alc_spec *spec = codec->spec;
14283 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14284 for (i = 0; i <= HDA_SIDE; i++) {
14285 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14286 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14288 alc861vd_auto_set_output_and_unmute(codec, nid,
14294 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14296 struct alc_spec *spec = codec->spec;
14299 pin = spec->autocfg.hp_pins[0];
14300 if (pin) /* connect to front and use dac 0 */
14301 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14302 pin = spec->autocfg.speaker_pins[0];
14304 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14307 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14308 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14310 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14312 struct alc_spec *spec = codec->spec;
14315 for (i = 0; i < AUTO_PIN_LAST; i++) {
14316 hda_nid_t nid = spec->autocfg.input_pins[i];
14317 if (alc861vd_is_input_pin(nid)) {
14318 snd_hda_codec_write(codec, nid, 0,
14319 AC_VERB_SET_PIN_WIDGET_CONTROL,
14320 i <= AUTO_PIN_FRONT_MIC ?
14321 PIN_VREF80 : PIN_IN);
14322 if (nid != ALC861VD_PIN_CD_NID)
14323 snd_hda_codec_write(codec, nid, 0,
14324 AC_VERB_SET_AMP_GAIN_MUTE,
14330 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14332 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14333 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14335 /* add playback controls from the parsed DAC table */
14336 /* Based on ALC880 version. But ALC861VD has separate,
14337 * different NIDs for mute/unmute switch and volume control */
14338 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14339 const struct auto_pin_cfg *cfg)
14342 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14343 hda_nid_t nid_v, nid_s;
14346 for (i = 0; i < cfg->line_outs; i++) {
14347 if (!spec->multiout.dac_nids[i])
14349 nid_v = alc861vd_idx_to_mixer_vol(
14351 spec->multiout.dac_nids[i]));
14352 nid_s = alc861vd_idx_to_mixer_switch(
14354 spec->multiout.dac_nids[i]));
14358 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14359 "Center Playback Volume",
14360 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14364 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14365 "LFE Playback Volume",
14366 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14370 err = add_control(spec, ALC_CTL_BIND_MUTE,
14371 "Center Playback Switch",
14372 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14376 err = add_control(spec, ALC_CTL_BIND_MUTE,
14377 "LFE Playback Switch",
14378 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14383 sprintf(name, "%s Playback Volume", chname[i]);
14384 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14385 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14389 sprintf(name, "%s Playback Switch", chname[i]);
14390 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14391 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14400 /* add playback controls for speaker and HP outputs */
14401 /* Based on ALC880 version. But ALC861VD has separate,
14402 * different NIDs for mute/unmute switch and volume control */
14403 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14404 hda_nid_t pin, const char *pfx)
14406 hda_nid_t nid_v, nid_s;
14413 if (alc880_is_fixed_pin(pin)) {
14414 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14415 /* specify the DAC as the extra output */
14416 if (!spec->multiout.hp_nid)
14417 spec->multiout.hp_nid = nid_v;
14419 spec->multiout.extra_out_nid[0] = nid_v;
14420 /* control HP volume/switch on the output mixer amp */
14421 nid_v = alc861vd_idx_to_mixer_vol(
14422 alc880_fixed_pin_idx(pin));
14423 nid_s = alc861vd_idx_to_mixer_switch(
14424 alc880_fixed_pin_idx(pin));
14426 sprintf(name, "%s Playback Volume", pfx);
14427 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14428 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14431 sprintf(name, "%s Playback Switch", pfx);
14432 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14433 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14436 } else if (alc880_is_multi_pin(pin)) {
14437 /* set manual connection */
14438 /* we have only a switch on HP-out PIN */
14439 sprintf(name, "%s Playback Switch", pfx);
14440 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14441 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14448 /* parse the BIOS configuration and set up the alc_spec
14449 * return 1 if successful, 0 if the proper config is not found,
14450 * or a negative error code
14451 * Based on ALC880 version - had to change it to override
14452 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14453 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14455 struct alc_spec *spec = codec->spec;
14457 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14459 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14463 if (!spec->autocfg.line_outs)
14464 return 0; /* can't find valid BIOS pin config */
14466 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14469 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14472 err = alc861vd_auto_create_extra_out(spec,
14473 spec->autocfg.speaker_pins[0],
14477 err = alc861vd_auto_create_extra_out(spec,
14478 spec->autocfg.hp_pins[0],
14482 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14486 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14488 if (spec->autocfg.dig_out_pin)
14489 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14491 if (spec->kctl_alloc)
14492 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14494 spec->init_verbs[spec->num_init_verbs++]
14495 = alc861vd_volume_init_verbs;
14497 spec->num_mux_defs = 1;
14498 spec->input_mux = &spec->private_imux;
14500 err = alc_auto_add_mic_boost(codec);
14504 store_pin_configs(codec);
14508 /* additional initialization for auto-configuration model */
14509 static void alc861vd_auto_init(struct hda_codec *codec)
14511 struct alc_spec *spec = codec->spec;
14512 alc861vd_auto_init_multi_out(codec);
14513 alc861vd_auto_init_hp_out(codec);
14514 alc861vd_auto_init_analog_input(codec);
14515 alc861vd_auto_init_input_src(codec);
14516 if (spec->unsol_event)
14517 alc_inithook(codec);
14520 static int patch_alc861vd(struct hda_codec *codec)
14522 struct alc_spec *spec;
14523 int err, board_config;
14525 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14529 codec->spec = spec;
14531 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14535 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14536 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14537 "ALC861VD, trying auto-probe from BIOS...\n");
14538 board_config = ALC861VD_AUTO;
14541 if (board_config == ALC861VD_AUTO) {
14542 /* automatic parse from the BIOS config */
14543 err = alc861vd_parse_auto_config(codec);
14549 "hda_codec: Cannot set up configuration "
14550 "from BIOS. Using base mode...\n");
14551 board_config = ALC861VD_3ST;
14555 if (board_config != ALC861VD_AUTO)
14556 setup_preset(spec, &alc861vd_presets[board_config]);
14558 if (codec->vendor_id == 0x10ec0660) {
14559 spec->stream_name_analog = "ALC660-VD Analog";
14560 spec->stream_name_digital = "ALC660-VD Digital";
14561 /* always turn on EAPD */
14562 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
14564 spec->stream_name_analog = "ALC861VD Analog";
14565 spec->stream_name_digital = "ALC861VD Digital";
14568 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14569 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14571 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14572 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14574 spec->adc_nids = alc861vd_adc_nids;
14575 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14576 spec->capsrc_nids = alc861vd_capsrc_nids;
14578 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
14579 spec->num_mixers++;
14581 spec->vmaster_nid = 0x02;
14583 codec->patch_ops = alc_patch_ops;
14585 if (board_config == ALC861VD_AUTO)
14586 spec->init_hook = alc861vd_auto_init;
14587 #ifdef CONFIG_SND_HDA_POWER_SAVE
14588 if (!spec->loopback.amplist)
14589 spec->loopback.amplist = alc861vd_loopbacks;
14598 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14599 * configuration. Each pin widget can choose any input DACs and a mixer.
14600 * Each ADC is connected from a mixer of all inputs. This makes possible
14601 * 6-channel independent captures.
14603 * In addition, an independent DAC for the multi-playback (not used in this
14606 #define ALC662_DIGOUT_NID 0x06
14607 #define ALC662_DIGIN_NID 0x0a
14609 static hda_nid_t alc662_dac_nids[4] = {
14610 /* front, rear, clfe, rear_surr */
14614 static hda_nid_t alc662_adc_nids[1] = {
14619 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14622 /* FIXME: should be a matrix-type input source selection */
14623 static struct hda_input_mux alc662_capture_source = {
14627 { "Front Mic", 0x1 },
14633 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14641 static struct hda_input_mux alc662_eeepc_capture_source = {
14649 static struct hda_input_mux alc663_capture_source = {
14653 { "Front Mic", 0x1 },
14658 static struct hda_input_mux alc663_m51va_capture_source = {
14661 { "Ext-Mic", 0x0 },
14666 #define alc662_mux_enum_info alc_mux_enum_info
14667 #define alc662_mux_enum_get alc_mux_enum_get
14668 #define alc662_mux_enum_put alc882_mux_enum_put
14673 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14680 static struct hda_verb alc662_3ST_ch2_init[] = {
14681 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14682 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14683 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14684 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14691 static struct hda_verb alc662_3ST_ch6_init[] = {
14692 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14693 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14694 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14695 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14696 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14697 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14701 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14702 { 2, alc662_3ST_ch2_init },
14703 { 6, alc662_3ST_ch6_init },
14709 static struct hda_verb alc662_sixstack_ch6_init[] = {
14710 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14711 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14712 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14719 static struct hda_verb alc662_sixstack_ch8_init[] = {
14720 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14721 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14722 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14726 static struct hda_channel_mode alc662_5stack_modes[2] = {
14727 { 2, alc662_sixstack_ch6_init },
14728 { 6, alc662_sixstack_ch8_init },
14731 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14732 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14735 static struct snd_kcontrol_new alc662_base_mixer[] = {
14736 /* output mixer control */
14737 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14738 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14739 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14740 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14741 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14742 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14743 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14744 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14747 /*Input mixer control */
14748 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14749 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14750 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14751 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14752 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14753 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14754 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14755 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14759 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14760 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14761 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14763 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14764 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14765 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14766 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14769 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14770 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14771 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14772 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14776 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14777 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14778 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14779 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14780 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14781 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14782 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14783 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14784 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14785 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14786 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14787 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14788 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14789 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14791 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14792 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14793 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14794 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14795 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14799 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
14800 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14801 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
14802 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14803 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
14804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14805 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14806 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14812 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
14813 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14815 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14816 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14818 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
14819 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14820 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14822 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
14823 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14824 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14828 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
14829 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14830 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14831 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14832 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
14833 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14834 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14835 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
14836 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
14837 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14838 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
14839 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14840 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14842 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14846 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14847 .ops = &snd_hda_bind_vol,
14849 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14850 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14855 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14856 .ops = &snd_hda_bind_sw,
14858 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14859 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14864 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14865 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14866 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14872 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14873 .ops = &snd_hda_bind_sw,
14875 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14876 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14877 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14882 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14883 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14884 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14887 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14888 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14893 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14894 .ops = &snd_hda_bind_sw,
14896 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14897 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14898 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14903 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14904 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14905 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14908 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14909 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14913 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
14914 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14915 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14916 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14919 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14920 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14924 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14925 .ops = &snd_hda_bind_vol,
14927 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14928 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14933 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14934 .ops = &snd_hda_bind_sw,
14936 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14937 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14942 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14943 HDA_BIND_VOL("Master Playback Volume",
14944 &alc663_asus_two_bind_master_vol),
14945 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14946 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14947 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14948 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14953 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14954 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14955 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14956 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14957 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14959 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14963 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
14964 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14965 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14966 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14967 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14968 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14970 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14972 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14973 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14977 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
14978 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14979 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14984 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14985 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14986 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14987 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14991 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
14993 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14994 .name = "Channel Mode",
14995 .info = alc_ch_mode_info,
14996 .get = alc_ch_mode_get,
14997 .put = alc_ch_mode_put,
15002 static struct hda_verb alc662_init_verbs[] = {
15003 /* ADC: mute amp left and right */
15004 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15005 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15006 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15008 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15009 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15010 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15016 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15017 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15018 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15021 /* Front Pin: output 0 (0x0c) */
15022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15025 /* Rear Pin: output 1 (0x0d) */
15026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15029 /* CLFE Pin: output 2 (0x0e) */
15030 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15031 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15033 /* Mic (rear) pin: input vref at 80% */
15034 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15035 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15036 /* Front Mic pin: input vref at 80% */
15037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15038 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15039 /* Line In pin: input */
15040 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15041 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15042 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15043 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15044 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15045 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15046 /* CD pin widget for input */
15047 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15049 /* FIXME: use matrix-type input source selection */
15050 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15054 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15055 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15058 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15059 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15062 /* always trun on EAPD */
15063 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15064 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15069 static struct hda_verb alc662_sue_init_verbs[] = {
15070 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15071 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15075 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15076 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15077 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15081 /* Set Unsolicited Event*/
15082 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15083 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15084 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15089 * generic initialization of ADC, input mixers and output mixers
15091 static struct hda_verb alc662_auto_init_verbs[] = {
15093 * Unmute ADC and set the default input to mic-in
15095 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15096 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15098 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15100 * Note: PASD motherboards uses the Line In 2 as the input for front
15101 * panel mic (mic 2)
15103 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15111 * Set up output mixers (0x0c - 0x0f)
15113 /* set vol=0 to output mixers */
15114 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15115 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15116 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15118 /* set up input amps for analog loopback */
15119 /* Amp Indices: DAC = 0, mixer = 1 */
15120 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15121 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15122 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15123 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15124 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15125 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15128 /* FIXME: use matrix-type input source selection */
15129 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15132 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15136 /* additional verbs for ALC663 */
15137 static struct hda_verb alc663_auto_init_verbs[] = {
15138 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15139 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15143 static struct hda_verb alc663_m51va_init_verbs[] = {
15144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15145 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15146 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15147 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15148 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15149 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15151 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15152 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15156 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15157 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15158 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15159 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15160 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15161 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15162 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15163 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15167 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15168 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15169 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15170 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15171 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15172 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15173 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15174 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15175 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15179 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15180 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15181 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15182 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15183 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15185 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15186 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15190 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15191 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15192 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15193 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15194 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15196 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15197 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15200 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15201 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15202 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15206 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15207 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15208 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15209 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15210 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15212 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15213 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15216 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15217 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15218 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15222 static struct hda_verb alc663_g71v_init_verbs[] = {
15223 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15224 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15225 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15227 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15228 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15229 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15231 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15232 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15233 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15237 static struct hda_verb alc663_g50v_init_verbs[] = {
15238 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15239 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15240 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15242 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15243 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15247 static struct hda_verb alc662_ecs_init_verbs[] = {
15248 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15250 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15251 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15255 /* capture mixer elements */
15256 static struct snd_kcontrol_new alc662_capture_mixer[] = {
15257 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15258 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15260 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15261 /* The multiple "Capture Source" controls confuse alsamixer
15262 * So call somewhat different..
15264 /* .name = "Capture Source", */
15265 .name = "Input Source",
15267 .info = alc662_mux_enum_info,
15268 .get = alc662_mux_enum_get,
15269 .put = alc662_mux_enum_put,
15274 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15275 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15276 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15280 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15282 unsigned int present;
15283 unsigned char bits;
15285 present = snd_hda_codec_read(codec, 0x14, 0,
15286 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15287 bits = present ? HDA_AMP_MUTE : 0;
15288 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15289 HDA_AMP_MUTE, bits);
15292 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15294 unsigned int present;
15295 unsigned char bits;
15297 present = snd_hda_codec_read(codec, 0x1b, 0,
15298 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15299 bits = present ? HDA_AMP_MUTE : 0;
15300 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15301 HDA_AMP_MUTE, bits);
15302 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15303 HDA_AMP_MUTE, bits);
15306 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15309 if ((res >> 26) == ALC880_HP_EVENT)
15310 alc662_lenovo_101e_all_automute(codec);
15311 if ((res >> 26) == ALC880_FRONT_EVENT)
15312 alc662_lenovo_101e_ispeaker_automute(codec);
15315 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15317 unsigned int present;
15319 present = snd_hda_codec_read(codec, 0x18, 0,
15320 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15321 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15322 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15323 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15324 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15325 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15326 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15327 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15328 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15331 /* unsolicited event for HP jack sensing */
15332 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15335 if ((res >> 26) == ALC880_HP_EVENT)
15336 alc262_hippo1_automute( codec );
15338 if ((res >> 26) == ALC880_MIC_EVENT)
15339 alc662_eeepc_mic_automute(codec);
15342 static void alc662_eeepc_inithook(struct hda_codec *codec)
15344 alc262_hippo1_automute( codec );
15345 alc662_eeepc_mic_automute(codec);
15348 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15351 unsigned int present;
15353 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15354 present = snd_hda_codec_read(codec, 0x14, 0,
15355 AC_VERB_GET_PIN_SENSE, 0);
15356 present = (present & 0x80000000) != 0;
15358 /* mute internal speaker */
15359 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15360 HDA_AMP_MUTE, HDA_AMP_MUTE);
15362 /* unmute internal speaker if necessary */
15363 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15364 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15365 HDA_AMP_MUTE, mute);
15369 /* unsolicited event for HP jack sensing */
15370 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15373 if ((res >> 26) == ALC880_HP_EVENT)
15374 alc662_eeepc_ep20_automute(codec);
15377 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15379 alc662_eeepc_ep20_automute(codec);
15382 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15384 unsigned int present;
15385 unsigned char bits;
15387 present = snd_hda_codec_read(codec, 0x21, 0,
15388 AC_VERB_GET_PIN_SENSE, 0)
15389 & AC_PINSENSE_PRESENCE;
15390 bits = present ? HDA_AMP_MUTE : 0;
15391 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15392 AMP_IN_MUTE(0), bits);
15393 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15394 AMP_IN_MUTE(0), bits);
15397 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15399 unsigned int present;
15400 unsigned char bits;
15402 present = snd_hda_codec_read(codec, 0x21, 0,
15403 AC_VERB_GET_PIN_SENSE, 0)
15404 & AC_PINSENSE_PRESENCE;
15405 bits = present ? HDA_AMP_MUTE : 0;
15406 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15407 AMP_IN_MUTE(0), bits);
15408 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15409 AMP_IN_MUTE(0), bits);
15410 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15411 AMP_IN_MUTE(0), bits);
15412 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15413 AMP_IN_MUTE(0), bits);
15416 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15418 unsigned int present;
15419 unsigned char bits;
15421 present = snd_hda_codec_read(codec, 0x15, 0,
15422 AC_VERB_GET_PIN_SENSE, 0)
15423 & AC_PINSENSE_PRESENCE;
15424 bits = present ? HDA_AMP_MUTE : 0;
15425 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15426 AMP_IN_MUTE(0), bits);
15427 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15428 AMP_IN_MUTE(0), bits);
15429 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15430 AMP_IN_MUTE(0), bits);
15431 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15432 AMP_IN_MUTE(0), bits);
15435 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15437 unsigned int present;
15438 unsigned char bits;
15440 present = snd_hda_codec_read(codec, 0x1b, 0,
15441 AC_VERB_GET_PIN_SENSE, 0)
15442 & AC_PINSENSE_PRESENCE;
15443 bits = present ? 0 : PIN_OUT;
15444 snd_hda_codec_write(codec, 0x14, 0,
15445 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15448 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15450 unsigned int present1, present2;
15452 present1 = snd_hda_codec_read(codec, 0x21, 0,
15453 AC_VERB_GET_PIN_SENSE, 0)
15454 & AC_PINSENSE_PRESENCE;
15455 present2 = snd_hda_codec_read(codec, 0x15, 0,
15456 AC_VERB_GET_PIN_SENSE, 0)
15457 & AC_PINSENSE_PRESENCE;
15459 if (present1 || present2) {
15460 snd_hda_codec_write_cache(codec, 0x14, 0,
15461 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15463 snd_hda_codec_write_cache(codec, 0x14, 0,
15464 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15468 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15470 unsigned int present1, present2;
15472 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15473 AC_VERB_GET_PIN_SENSE, 0)
15474 & AC_PINSENSE_PRESENCE;
15475 present2 = snd_hda_codec_read(codec, 0x15, 0,
15476 AC_VERB_GET_PIN_SENSE, 0)
15477 & AC_PINSENSE_PRESENCE;
15479 if (present1 || present2) {
15480 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15481 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15482 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15483 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15485 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15486 AMP_IN_MUTE(0), 0);
15487 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15488 AMP_IN_MUTE(0), 0);
15492 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15494 unsigned int present;
15496 present = snd_hda_codec_read(codec, 0x18, 0,
15497 AC_VERB_GET_PIN_SENSE, 0)
15498 & AC_PINSENSE_PRESENCE;
15499 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15500 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15501 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15502 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15503 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15504 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15505 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15506 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15509 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15512 switch (res >> 26) {
15513 case ALC880_HP_EVENT:
15514 alc663_m51va_speaker_automute(codec);
15516 case ALC880_MIC_EVENT:
15517 alc663_m51va_mic_automute(codec);
15522 static void alc663_m51va_inithook(struct hda_codec *codec)
15524 alc663_m51va_speaker_automute(codec);
15525 alc663_m51va_mic_automute(codec);
15528 /* ***************** Mode1 ******************************/
15529 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15532 switch (res >> 26) {
15533 case ALC880_HP_EVENT:
15534 alc663_m51va_speaker_automute(codec);
15536 case ALC880_MIC_EVENT:
15537 alc662_eeepc_mic_automute(codec);
15542 static void alc663_mode1_inithook(struct hda_codec *codec)
15544 alc663_m51va_speaker_automute(codec);
15545 alc662_eeepc_mic_automute(codec);
15547 /* ***************** Mode2 ******************************/
15548 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15551 switch (res >> 26) {
15552 case ALC880_HP_EVENT:
15553 alc662_f5z_speaker_automute(codec);
15555 case ALC880_MIC_EVENT:
15556 alc662_eeepc_mic_automute(codec);
15561 static void alc662_mode2_inithook(struct hda_codec *codec)
15563 alc662_f5z_speaker_automute(codec);
15564 alc662_eeepc_mic_automute(codec);
15566 /* ***************** Mode3 ******************************/
15567 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15570 switch (res >> 26) {
15571 case ALC880_HP_EVENT:
15572 alc663_two_hp_m1_speaker_automute(codec);
15574 case ALC880_MIC_EVENT:
15575 alc662_eeepc_mic_automute(codec);
15580 static void alc663_mode3_inithook(struct hda_codec *codec)
15582 alc663_two_hp_m1_speaker_automute(codec);
15583 alc662_eeepc_mic_automute(codec);
15585 /* ***************** Mode4 ******************************/
15586 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15589 switch (res >> 26) {
15590 case ALC880_HP_EVENT:
15591 alc663_21jd_two_speaker_automute(codec);
15593 case ALC880_MIC_EVENT:
15594 alc662_eeepc_mic_automute(codec);
15599 static void alc663_mode4_inithook(struct hda_codec *codec)
15601 alc663_21jd_two_speaker_automute(codec);
15602 alc662_eeepc_mic_automute(codec);
15604 /* ***************** Mode5 ******************************/
15605 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15608 switch (res >> 26) {
15609 case ALC880_HP_EVENT:
15610 alc663_15jd_two_speaker_automute(codec);
15612 case ALC880_MIC_EVENT:
15613 alc662_eeepc_mic_automute(codec);
15618 static void alc663_mode5_inithook(struct hda_codec *codec)
15620 alc663_15jd_two_speaker_automute(codec);
15621 alc662_eeepc_mic_automute(codec);
15623 /* ***************** Mode6 ******************************/
15624 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15627 switch (res >> 26) {
15628 case ALC880_HP_EVENT:
15629 alc663_two_hp_m2_speaker_automute(codec);
15631 case ALC880_MIC_EVENT:
15632 alc662_eeepc_mic_automute(codec);
15637 static void alc663_mode6_inithook(struct hda_codec *codec)
15639 alc663_two_hp_m2_speaker_automute(codec);
15640 alc662_eeepc_mic_automute(codec);
15643 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15645 unsigned int present;
15646 unsigned char bits;
15648 present = snd_hda_codec_read(codec, 0x21, 0,
15649 AC_VERB_GET_PIN_SENSE, 0)
15650 & AC_PINSENSE_PRESENCE;
15651 bits = present ? HDA_AMP_MUTE : 0;
15652 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15653 HDA_AMP_MUTE, bits);
15654 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15655 HDA_AMP_MUTE, bits);
15658 static void alc663_g71v_front_automute(struct hda_codec *codec)
15660 unsigned int present;
15661 unsigned char bits;
15663 present = snd_hda_codec_read(codec, 0x15, 0,
15664 AC_VERB_GET_PIN_SENSE, 0)
15665 & AC_PINSENSE_PRESENCE;
15666 bits = present ? HDA_AMP_MUTE : 0;
15667 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15668 HDA_AMP_MUTE, bits);
15671 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15674 switch (res >> 26) {
15675 case ALC880_HP_EVENT:
15676 alc663_g71v_hp_automute(codec);
15678 case ALC880_FRONT_EVENT:
15679 alc663_g71v_front_automute(codec);
15681 case ALC880_MIC_EVENT:
15682 alc662_eeepc_mic_automute(codec);
15687 static void alc663_g71v_inithook(struct hda_codec *codec)
15689 alc663_g71v_front_automute(codec);
15690 alc663_g71v_hp_automute(codec);
15691 alc662_eeepc_mic_automute(codec);
15694 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15697 switch (res >> 26) {
15698 case ALC880_HP_EVENT:
15699 alc663_m51va_speaker_automute(codec);
15701 case ALC880_MIC_EVENT:
15702 alc662_eeepc_mic_automute(codec);
15707 static void alc663_g50v_inithook(struct hda_codec *codec)
15709 alc663_m51va_speaker_automute(codec);
15710 alc662_eeepc_mic_automute(codec);
15713 /* bind hp and internal speaker mute (with plug check) */
15714 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15715 struct snd_ctl_elem_value *ucontrol)
15717 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15718 long *valp = ucontrol->value.integer.value;
15721 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15723 valp[0] ? 0 : HDA_AMP_MUTE);
15724 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15726 valp[1] ? 0 : HDA_AMP_MUTE);
15728 alc262_hippo1_automute(codec);
15732 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15733 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15736 .name = "Master Playback Switch",
15737 .info = snd_hda_mixer_amp_switch_info,
15738 .get = snd_hda_mixer_amp_switch_get,
15739 .put = alc662_ecs_master_sw_put,
15740 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15743 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15744 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15745 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15747 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15748 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15749 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15753 #ifdef CONFIG_SND_HDA_POWER_SAVE
15754 #define alc662_loopbacks alc880_loopbacks
15758 /* pcm configuration: identiacal with ALC880 */
15759 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15760 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15761 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15762 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15765 * configuration and preset
15767 static const char *alc662_models[ALC662_MODEL_LAST] = {
15768 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15769 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15770 [ALC662_3ST_6ch] = "3stack-6ch",
15771 [ALC662_5ST_DIG] = "6stack-dig",
15772 [ALC662_LENOVO_101E] = "lenovo-101e",
15773 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15774 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15775 [ALC662_ECS] = "ecs",
15776 [ALC663_ASUS_M51VA] = "m51va",
15777 [ALC663_ASUS_G71V] = "g71v",
15778 [ALC663_ASUS_H13] = "h13",
15779 [ALC663_ASUS_G50V] = "g50v",
15780 [ALC663_ASUS_MODE1] = "asus-mode1",
15781 [ALC662_ASUS_MODE2] = "asus-mode2",
15782 [ALC663_ASUS_MODE3] = "asus-mode3",
15783 [ALC663_ASUS_MODE4] = "asus-mode4",
15784 [ALC663_ASUS_MODE5] = "asus-mode5",
15785 [ALC663_ASUS_MODE6] = "asus-mode6",
15786 [ALC662_AUTO] = "auto",
15789 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15790 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15791 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15792 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15793 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15794 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15795 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15796 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15797 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15798 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15799 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15800 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15801 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15802 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15803 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15804 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15805 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15806 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15807 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15808 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15809 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15810 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15811 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15812 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15813 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15814 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15815 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15816 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15817 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15818 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15819 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15820 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15821 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15822 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15823 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15824 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15825 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15826 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15827 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15828 ALC662_3ST_6ch_DIG),
15829 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15830 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15831 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15832 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15833 ALC662_3ST_6ch_DIG),
15834 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15835 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15836 ALC662_3ST_6ch_DIG),
15837 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15838 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15839 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
15843 static struct alc_config_preset alc662_presets[] = {
15844 [ALC662_3ST_2ch_DIG] = {
15845 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
15846 .init_verbs = { alc662_init_verbs },
15847 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15848 .dac_nids = alc662_dac_nids,
15849 .dig_out_nid = ALC662_DIGOUT_NID,
15850 .dig_in_nid = ALC662_DIGIN_NID,
15851 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15852 .channel_mode = alc662_3ST_2ch_modes,
15853 .input_mux = &alc662_capture_source,
15855 [ALC662_3ST_6ch_DIG] = {
15856 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
15857 alc662_capture_mixer },
15858 .init_verbs = { alc662_init_verbs },
15859 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15860 .dac_nids = alc662_dac_nids,
15861 .dig_out_nid = ALC662_DIGOUT_NID,
15862 .dig_in_nid = ALC662_DIGIN_NID,
15863 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15864 .channel_mode = alc662_3ST_6ch_modes,
15866 .input_mux = &alc662_capture_source,
15868 [ALC662_3ST_6ch] = {
15869 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
15870 alc662_capture_mixer },
15871 .init_verbs = { alc662_init_verbs },
15872 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15873 .dac_nids = alc662_dac_nids,
15874 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15875 .channel_mode = alc662_3ST_6ch_modes,
15877 .input_mux = &alc662_capture_source,
15879 [ALC662_5ST_DIG] = {
15880 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
15881 alc662_capture_mixer },
15882 .init_verbs = { alc662_init_verbs },
15883 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15884 .dac_nids = alc662_dac_nids,
15885 .dig_out_nid = ALC662_DIGOUT_NID,
15886 .dig_in_nid = ALC662_DIGIN_NID,
15887 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
15888 .channel_mode = alc662_5stack_modes,
15889 .input_mux = &alc662_capture_source,
15891 [ALC662_LENOVO_101E] = {
15892 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
15893 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
15894 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15895 .dac_nids = alc662_dac_nids,
15896 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15897 .channel_mode = alc662_3ST_2ch_modes,
15898 .input_mux = &alc662_lenovo_101e_capture_source,
15899 .unsol_event = alc662_lenovo_101e_unsol_event,
15900 .init_hook = alc662_lenovo_101e_all_automute,
15902 [ALC662_ASUS_EEEPC_P701] = {
15903 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
15904 .init_verbs = { alc662_init_verbs,
15905 alc662_eeepc_sue_init_verbs },
15906 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15907 .dac_nids = alc662_dac_nids,
15908 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15909 .channel_mode = alc662_3ST_2ch_modes,
15910 .input_mux = &alc662_eeepc_capture_source,
15911 .unsol_event = alc662_eeepc_unsol_event,
15912 .init_hook = alc662_eeepc_inithook,
15914 [ALC662_ASUS_EEEPC_EP20] = {
15915 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
15916 alc662_chmode_mixer },
15917 .init_verbs = { alc662_init_verbs,
15918 alc662_eeepc_ep20_sue_init_verbs },
15919 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15920 .dac_nids = alc662_dac_nids,
15921 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15922 .channel_mode = alc662_3ST_6ch_modes,
15923 .input_mux = &alc662_lenovo_101e_capture_source,
15924 .unsol_event = alc662_eeepc_ep20_unsol_event,
15925 .init_hook = alc662_eeepc_ep20_inithook,
15928 .mixers = { alc662_ecs_mixer, alc662_capture_mixer },
15929 .init_verbs = { alc662_init_verbs,
15930 alc662_ecs_init_verbs },
15931 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15932 .dac_nids = alc662_dac_nids,
15933 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15934 .channel_mode = alc662_3ST_2ch_modes,
15935 .input_mux = &alc662_eeepc_capture_source,
15936 .unsol_event = alc662_eeepc_unsol_event,
15937 .init_hook = alc662_eeepc_inithook,
15939 [ALC663_ASUS_M51VA] = {
15940 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15941 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15942 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15943 .dac_nids = alc662_dac_nids,
15944 .dig_out_nid = ALC662_DIGOUT_NID,
15945 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15946 .channel_mode = alc662_3ST_2ch_modes,
15947 .input_mux = &alc663_m51va_capture_source,
15948 .unsol_event = alc663_m51va_unsol_event,
15949 .init_hook = alc663_m51va_inithook,
15951 [ALC663_ASUS_G71V] = {
15952 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
15953 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
15954 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15955 .dac_nids = alc662_dac_nids,
15956 .dig_out_nid = ALC662_DIGOUT_NID,
15957 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15958 .channel_mode = alc662_3ST_2ch_modes,
15959 .input_mux = &alc662_eeepc_capture_source,
15960 .unsol_event = alc663_g71v_unsol_event,
15961 .init_hook = alc663_g71v_inithook,
15963 [ALC663_ASUS_H13] = {
15964 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15965 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15966 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15967 .dac_nids = alc662_dac_nids,
15968 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15969 .channel_mode = alc662_3ST_2ch_modes,
15970 .input_mux = &alc663_m51va_capture_source,
15971 .unsol_event = alc663_m51va_unsol_event,
15972 .init_hook = alc663_m51va_inithook,
15974 [ALC663_ASUS_G50V] = {
15975 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
15976 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
15977 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15978 .dac_nids = alc662_dac_nids,
15979 .dig_out_nid = ALC662_DIGOUT_NID,
15980 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15981 .channel_mode = alc662_3ST_6ch_modes,
15982 .input_mux = &alc663_capture_source,
15983 .unsol_event = alc663_g50v_unsol_event,
15984 .init_hook = alc663_g50v_inithook,
15986 [ALC663_ASUS_MODE1] = {
15987 .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer },
15988 .init_verbs = { alc662_init_verbs,
15989 alc663_21jd_amic_init_verbs },
15990 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15992 .dac_nids = alc662_dac_nids,
15993 .dig_out_nid = ALC662_DIGOUT_NID,
15994 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15995 .channel_mode = alc662_3ST_2ch_modes,
15996 .input_mux = &alc662_eeepc_capture_source,
15997 .unsol_event = alc663_mode1_unsol_event,
15998 .init_hook = alc663_mode1_inithook,
16000 [ALC662_ASUS_MODE2] = {
16001 .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer },
16002 .init_verbs = { alc662_init_verbs,
16003 alc662_1bjd_amic_init_verbs },
16004 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16005 .dac_nids = alc662_dac_nids,
16006 .dig_out_nid = ALC662_DIGOUT_NID,
16007 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16008 .channel_mode = alc662_3ST_2ch_modes,
16009 .input_mux = &alc662_eeepc_capture_source,
16010 .unsol_event = alc662_mode2_unsol_event,
16011 .init_hook = alc662_mode2_inithook,
16013 [ALC663_ASUS_MODE3] = {
16014 .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer },
16015 .init_verbs = { alc662_init_verbs,
16016 alc663_two_hp_amic_m1_init_verbs },
16017 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16019 .dac_nids = alc662_dac_nids,
16020 .dig_out_nid = ALC662_DIGOUT_NID,
16021 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16022 .channel_mode = alc662_3ST_2ch_modes,
16023 .input_mux = &alc662_eeepc_capture_source,
16024 .unsol_event = alc663_mode3_unsol_event,
16025 .init_hook = alc663_mode3_inithook,
16027 [ALC663_ASUS_MODE4] = {
16028 .mixers = { alc663_asus_21jd_clfe_mixer,
16029 alc662_auto_capture_mixer},
16030 .init_verbs = { alc662_init_verbs,
16031 alc663_21jd_amic_init_verbs},
16032 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16034 .dac_nids = alc662_dac_nids,
16035 .dig_out_nid = ALC662_DIGOUT_NID,
16036 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16037 .channel_mode = alc662_3ST_2ch_modes,
16038 .input_mux = &alc662_eeepc_capture_source,
16039 .unsol_event = alc663_mode4_unsol_event,
16040 .init_hook = alc663_mode4_inithook,
16042 [ALC663_ASUS_MODE5] = {
16043 .mixers = { alc663_asus_15jd_clfe_mixer,
16044 alc662_auto_capture_mixer },
16045 .init_verbs = { alc662_init_verbs,
16046 alc663_15jd_amic_init_verbs },
16047 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16049 .dac_nids = alc662_dac_nids,
16050 .dig_out_nid = ALC662_DIGOUT_NID,
16051 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16052 .channel_mode = alc662_3ST_2ch_modes,
16053 .input_mux = &alc662_eeepc_capture_source,
16054 .unsol_event = alc663_mode5_unsol_event,
16055 .init_hook = alc663_mode5_inithook,
16057 [ALC663_ASUS_MODE6] = {
16058 .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer },
16059 .init_verbs = { alc662_init_verbs,
16060 alc663_two_hp_amic_m2_init_verbs },
16061 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16063 .dac_nids = alc662_dac_nids,
16064 .dig_out_nid = ALC662_DIGOUT_NID,
16065 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16066 .channel_mode = alc662_3ST_2ch_modes,
16067 .input_mux = &alc662_eeepc_capture_source,
16068 .unsol_event = alc663_mode6_unsol_event,
16069 .init_hook = alc663_mode6_inithook,
16075 * BIOS auto configuration
16078 /* add playback controls from the parsed DAC table */
16079 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16080 const struct auto_pin_cfg *cfg)
16083 static const char *chname[4] = {
16084 "Front", "Surround", NULL /*CLFE*/, "Side"
16089 for (i = 0; i < cfg->line_outs; i++) {
16090 if (!spec->multiout.dac_nids[i])
16092 nid = alc880_idx_to_dac(i);
16095 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16096 "Center Playback Volume",
16097 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16101 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16102 "LFE Playback Volume",
16103 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16107 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16108 "Center Playback Switch",
16109 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16113 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16114 "LFE Playback Switch",
16115 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16120 sprintf(name, "%s Playback Volume", chname[i]);
16121 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16122 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16126 sprintf(name, "%s Playback Switch", chname[i]);
16127 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16128 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16137 /* add playback controls for speaker and HP outputs */
16138 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16149 /* ALC663 has a mono output pin on 0x17 */
16150 sprintf(name, "%s Playback Switch", pfx);
16151 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16152 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16156 if (alc880_is_fixed_pin(pin)) {
16157 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16158 /* printk("DAC nid=%x\n",nid); */
16159 /* specify the DAC as the extra output */
16160 if (!spec->multiout.hp_nid)
16161 spec->multiout.hp_nid = nid;
16163 spec->multiout.extra_out_nid[0] = nid;
16164 /* control HP volume/switch on the output mixer amp */
16165 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16166 sprintf(name, "%s Playback Volume", pfx);
16167 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16168 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16171 sprintf(name, "%s Playback Switch", pfx);
16172 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16173 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16176 } else if (alc880_is_multi_pin(pin)) {
16177 /* set manual connection */
16178 /* we have only a switch on HP-out PIN */
16179 sprintf(name, "%s Playback Switch", pfx);
16180 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16181 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16188 /* create playback/capture controls for input pins */
16189 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16190 const struct auto_pin_cfg *cfg)
16192 struct hda_input_mux *imux = &spec->private_imux;
16195 for (i = 0; i < AUTO_PIN_LAST; i++) {
16196 if (alc880_is_input_pin(cfg->input_pins[i])) {
16197 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16198 err = new_analog_input(spec, cfg->input_pins[i],
16199 auto_pin_cfg_labels[i],
16203 imux->items[imux->num_items].label =
16204 auto_pin_cfg_labels[i];
16205 imux->items[imux->num_items].index =
16206 alc880_input_pin_idx(cfg->input_pins[i]);
16213 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16214 hda_nid_t nid, int pin_type,
16217 alc_set_pin_output(codec, nid, pin_type);
16218 /* need the manual connection? */
16219 if (alc880_is_multi_pin(nid)) {
16220 struct alc_spec *spec = codec->spec;
16221 int idx = alc880_multi_pin_idx(nid);
16222 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16223 AC_VERB_SET_CONNECT_SEL,
16224 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16228 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16230 struct alc_spec *spec = codec->spec;
16233 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16234 for (i = 0; i <= HDA_SIDE; i++) {
16235 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16236 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16238 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16243 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16245 struct alc_spec *spec = codec->spec;
16248 pin = spec->autocfg.hp_pins[0];
16249 if (pin) /* connect to front */
16251 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16252 pin = spec->autocfg.speaker_pins[0];
16254 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16257 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16258 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16260 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16262 struct alc_spec *spec = codec->spec;
16265 for (i = 0; i < AUTO_PIN_LAST; i++) {
16266 hda_nid_t nid = spec->autocfg.input_pins[i];
16267 if (alc662_is_input_pin(nid)) {
16268 snd_hda_codec_write(codec, nid, 0,
16269 AC_VERB_SET_PIN_WIDGET_CONTROL,
16270 (i <= AUTO_PIN_FRONT_MIC ?
16271 PIN_VREF80 : PIN_IN));
16272 if (nid != ALC662_PIN_CD_NID)
16273 snd_hda_codec_write(codec, nid, 0,
16274 AC_VERB_SET_AMP_GAIN_MUTE,
16280 #define alc662_auto_init_input_src alc882_auto_init_input_src
16282 static int alc662_parse_auto_config(struct hda_codec *codec)
16284 struct alc_spec *spec = codec->spec;
16286 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16288 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16292 if (!spec->autocfg.line_outs)
16293 return 0; /* can't find valid BIOS pin config */
16295 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16298 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16301 err = alc662_auto_create_extra_out(spec,
16302 spec->autocfg.speaker_pins[0],
16306 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16310 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16314 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16316 if (spec->autocfg.dig_out_pin)
16317 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16319 if (spec->kctl_alloc)
16320 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
16322 spec->num_mux_defs = 1;
16323 spec->input_mux = &spec->private_imux;
16325 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
16326 if (codec->vendor_id == 0x10ec0663)
16327 spec->init_verbs[spec->num_init_verbs++] =
16328 alc663_auto_init_verbs;
16330 err = alc_auto_add_mic_boost(codec);
16334 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
16335 spec->num_mixers++;
16337 store_pin_configs(codec);
16341 /* additional initialization for auto-configuration model */
16342 static void alc662_auto_init(struct hda_codec *codec)
16344 struct alc_spec *spec = codec->spec;
16345 alc662_auto_init_multi_out(codec);
16346 alc662_auto_init_hp_out(codec);
16347 alc662_auto_init_analog_input(codec);
16348 alc662_auto_init_input_src(codec);
16349 if (spec->unsol_event)
16350 alc_inithook(codec);
16353 static int patch_alc662(struct hda_codec *codec)
16355 struct alc_spec *spec;
16356 int err, board_config;
16358 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16362 codec->spec = spec;
16364 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16366 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16369 if (board_config < 0) {
16370 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16371 "trying auto-probe from BIOS...\n");
16372 board_config = ALC662_AUTO;
16375 if (board_config == ALC662_AUTO) {
16376 /* automatic parse from the BIOS config */
16377 err = alc662_parse_auto_config(codec);
16383 "hda_codec: Cannot set up configuration "
16384 "from BIOS. Using base mode...\n");
16385 board_config = ALC662_3ST_2ch_DIG;
16389 if (board_config != ALC662_AUTO)
16390 setup_preset(spec, &alc662_presets[board_config]);
16392 if (codec->vendor_id == 0x10ec0663) {
16393 spec->stream_name_analog = "ALC663 Analog";
16394 spec->stream_name_digital = "ALC663 Digital";
16395 } else if (codec->vendor_id == 0x10ec0272) {
16396 spec->stream_name_analog = "ALC272 Analog";
16397 spec->stream_name_digital = "ALC272 Digital";
16399 spec->stream_name_analog = "ALC662 Analog";
16400 spec->stream_name_digital = "ALC662 Digital";
16403 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16404 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16406 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16407 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16409 spec->adc_nids = alc662_adc_nids;
16410 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16411 spec->capsrc_nids = alc662_capsrc_nids;
16413 spec->vmaster_nid = 0x02;
16415 codec->patch_ops = alc_patch_ops;
16416 if (board_config == ALC662_AUTO)
16417 spec->init_hook = alc662_auto_init;
16418 #ifdef CONFIG_SND_HDA_POWER_SAVE
16419 if (!spec->loopback.amplist)
16420 spec->loopback.amplist = alc662_loopbacks;
16429 struct hda_codec_preset snd_hda_preset_realtek[] = {
16430 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16431 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16432 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16433 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16434 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16435 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16436 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16437 .patch = patch_alc861 },
16438 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16439 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16440 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16441 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16442 .patch = patch_alc883 },
16443 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16444 .patch = patch_alc662 },
16445 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16446 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16447 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16448 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16449 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16450 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16451 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16452 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16453 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16454 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16455 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16456 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16457 .patch = patch_alc883 },
16458 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16459 {} /* terminator */