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;
242 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
244 const struct hda_verb *init_verbs[5]; /* initialization verbs
248 unsigned int num_init_verbs;
250 char *stream_name_analog; /* analog PCM stream */
251 struct hda_pcm_stream *stream_analog_playback;
252 struct hda_pcm_stream *stream_analog_capture;
253 struct hda_pcm_stream *stream_analog_alt_playback;
254 struct hda_pcm_stream *stream_analog_alt_capture;
256 char *stream_name_digital; /* digital PCM stream */
257 struct hda_pcm_stream *stream_digital_playback;
258 struct hda_pcm_stream *stream_digital_capture;
261 struct hda_multi_out multiout; /* playback set-up
262 * max_channels, dacs must be set
263 * dig_out_nid and hp_nid are optional
265 hda_nid_t alt_dac_nid;
268 unsigned int num_adc_nids;
270 hda_nid_t *capsrc_nids;
271 hda_nid_t dig_in_nid; /* digital-in NID; optional */
272 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */
275 unsigned int num_mux_defs;
276 const struct hda_input_mux *input_mux;
277 unsigned int cur_mux[3];
280 const struct hda_channel_mode *channel_mode;
281 int num_channel_mode;
284 /* PCM information */
285 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
287 /* dynamic controls, init_verbs and input_mux */
288 struct auto_pin_cfg autocfg;
289 struct snd_array kctls;
290 struct hda_input_mux private_imux;
291 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
294 void (*init_hook)(struct hda_codec *codec);
295 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
297 /* for pin sensing */
298 unsigned int sense_updated: 1;
299 unsigned int jack_present: 1;
300 unsigned int master_sw: 1;
302 /* for virtual master */
303 hda_nid_t vmaster_nid;
304 #ifdef CONFIG_SND_HDA_POWER_SAVE
305 struct hda_loopback_check loopback;
310 unsigned int pll_coef_idx, pll_coef_bit;
312 #ifdef SND_HDA_NEEDS_RESUME
313 #define ALC_MAX_PINS 16
314 unsigned int num_pins;
315 hda_nid_t pin_nids[ALC_MAX_PINS];
316 unsigned int pin_cfgs[ALC_MAX_PINS];
321 * configuration template - to be copied to the spec instance
323 struct alc_config_preset {
324 struct snd_kcontrol_new *mixers[5]; /* should be identical size
327 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
328 const struct hda_verb *init_verbs[5];
329 unsigned int num_dacs;
331 hda_nid_t dig_out_nid; /* optional */
332 hda_nid_t hp_nid; /* optional */
333 unsigned int num_adc_nids;
335 hda_nid_t *capsrc_nids;
336 hda_nid_t dig_in_nid;
337 unsigned int num_channel_mode;
338 const struct hda_channel_mode *channel_mode;
340 unsigned int num_mux_defs;
341 const struct hda_input_mux *input_mux;
342 void (*unsol_event)(struct hda_codec *, unsigned int);
343 void (*init_hook)(struct hda_codec *);
344 #ifdef CONFIG_SND_HDA_POWER_SAVE
345 struct hda_amp_list *loopbacks;
353 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
354 struct snd_ctl_elem_info *uinfo)
356 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
357 struct alc_spec *spec = codec->spec;
358 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
359 if (mux_idx >= spec->num_mux_defs)
361 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
364 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
365 struct snd_ctl_elem_value *ucontrol)
367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
368 struct alc_spec *spec = codec->spec;
369 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
371 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
375 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
376 struct snd_ctl_elem_value *ucontrol)
378 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
379 struct alc_spec *spec = codec->spec;
380 const struct hda_input_mux *imux = spec->input_mux;
381 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
382 hda_nid_t nid = spec->capsrc_nids ?
383 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
385 if (spec->is_mix_capture) {
386 /* Matrix-mixer style (e.g. ALC882) */
387 unsigned int *cur_val = &spec->cur_mux[adc_idx];
390 idx = ucontrol->value.enumerated.item[0];
391 if (idx >= imux->num_items)
392 idx = imux->num_items - 1;
395 for (i = 0; i < imux->num_items; i++) {
396 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
397 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
398 imux->items[i].index,
404 /* MUX style (e.g. ALC880) */
405 unsigned int mux_idx;
406 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
407 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx],
409 &spec->cur_mux[adc_idx]);
414 * channel mode setting
416 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
417 struct snd_ctl_elem_info *uinfo)
419 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
420 struct alc_spec *spec = codec->spec;
421 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
422 spec->num_channel_mode);
425 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
426 struct snd_ctl_elem_value *ucontrol)
428 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
429 struct alc_spec *spec = codec->spec;
430 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
431 spec->num_channel_mode,
432 spec->multiout.max_channels);
435 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
436 struct snd_ctl_elem_value *ucontrol)
438 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
439 struct alc_spec *spec = codec->spec;
440 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
441 spec->num_channel_mode,
442 &spec->multiout.max_channels);
443 if (err >= 0 && spec->need_dac_fix)
444 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
449 * Control the mode of pin widget settings via the mixer. "pc" is used
450 * instead of "%" to avoid consequences of accidently treating the % as
451 * being part of a format specifier. Maximum allowed length of a value is
452 * 63 characters plus NULL terminator.
454 * Note: some retasking pin complexes seem to ignore requests for input
455 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
456 * are requested. Therefore order this list so that this behaviour will not
457 * cause problems when mixer clients move through the enum sequentially.
458 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
461 static char *alc_pin_mode_names[] = {
462 "Mic 50pc bias", "Mic 80pc bias",
463 "Line in", "Line out", "Headphone out",
465 static unsigned char alc_pin_mode_values[] = {
466 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
468 /* The control can present all 5 options, or it can limit the options based
469 * in the pin being assumed to be exclusively an input or an output pin. In
470 * addition, "input" pins may or may not process the mic bias option
471 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
472 * accept requests for bias as of chip versions up to March 2006) and/or
473 * wiring in the computer.
475 #define ALC_PIN_DIR_IN 0x00
476 #define ALC_PIN_DIR_OUT 0x01
477 #define ALC_PIN_DIR_INOUT 0x02
478 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
479 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
481 /* Info about the pin modes supported by the different pin direction modes.
482 * For each direction the minimum and maximum values are given.
484 static signed char alc_pin_mode_dir_info[5][2] = {
485 { 0, 2 }, /* ALC_PIN_DIR_IN */
486 { 3, 4 }, /* ALC_PIN_DIR_OUT */
487 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
488 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
489 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
491 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
492 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
493 #define alc_pin_mode_n_items(_dir) \
494 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
496 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
497 struct snd_ctl_elem_info *uinfo)
499 unsigned int item_num = uinfo->value.enumerated.item;
500 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
502 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
504 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
506 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
507 item_num = alc_pin_mode_min(dir);
508 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
512 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
513 struct snd_ctl_elem_value *ucontrol)
516 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
517 hda_nid_t nid = kcontrol->private_value & 0xffff;
518 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
519 long *valp = ucontrol->value.integer.value;
520 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
521 AC_VERB_GET_PIN_WIDGET_CONTROL,
524 /* Find enumerated value for current pinctl setting */
525 i = alc_pin_mode_min(dir);
526 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
528 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
532 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
533 struct snd_ctl_elem_value *ucontrol)
536 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
537 hda_nid_t nid = kcontrol->private_value & 0xffff;
538 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
539 long val = *ucontrol->value.integer.value;
540 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
541 AC_VERB_GET_PIN_WIDGET_CONTROL,
544 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
545 val = alc_pin_mode_min(dir);
547 change = pinctl != alc_pin_mode_values[val];
549 /* Set pin mode to that requested */
550 snd_hda_codec_write_cache(codec, nid, 0,
551 AC_VERB_SET_PIN_WIDGET_CONTROL,
552 alc_pin_mode_values[val]);
554 /* Also enable the retasking pin's input/output as required
555 * for the requested pin mode. Enum values of 2 or less are
558 * Dynamically switching the input/output buffers probably
559 * reduces noise slightly (particularly on input) so we'll
560 * do it. However, having both input and output buffers
561 * enabled simultaneously doesn't seem to be problematic if
562 * this turns out to be necessary in the future.
565 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
566 HDA_AMP_MUTE, HDA_AMP_MUTE);
567 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
570 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
571 HDA_AMP_MUTE, HDA_AMP_MUTE);
572 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
579 #define ALC_PIN_MODE(xname, nid, dir) \
580 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
581 .info = alc_pin_mode_info, \
582 .get = alc_pin_mode_get, \
583 .put = alc_pin_mode_put, \
584 .private_value = nid | (dir<<16) }
586 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
587 * together using a mask with more than one bit set. This control is
588 * currently used only by the ALC260 test model. At this stage they are not
589 * needed for any "production" models.
591 #ifdef CONFIG_SND_DEBUG
592 #define alc_gpio_data_info snd_ctl_boolean_mono_info
594 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
595 struct snd_ctl_elem_value *ucontrol)
597 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
598 hda_nid_t nid = kcontrol->private_value & 0xffff;
599 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
600 long *valp = ucontrol->value.integer.value;
601 unsigned int val = snd_hda_codec_read(codec, nid, 0,
602 AC_VERB_GET_GPIO_DATA, 0x00);
604 *valp = (val & mask) != 0;
607 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
608 struct snd_ctl_elem_value *ucontrol)
611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
612 hda_nid_t nid = kcontrol->private_value & 0xffff;
613 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
614 long val = *ucontrol->value.integer.value;
615 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
616 AC_VERB_GET_GPIO_DATA,
619 /* Set/unset the masked GPIO bit(s) as needed */
620 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
625 snd_hda_codec_write_cache(codec, nid, 0,
626 AC_VERB_SET_GPIO_DATA, gpio_data);
630 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
631 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
632 .info = alc_gpio_data_info, \
633 .get = alc_gpio_data_get, \
634 .put = alc_gpio_data_put, \
635 .private_value = nid | (mask<<16) }
636 #endif /* CONFIG_SND_DEBUG */
638 /* A switch control to allow the enabling of the digital IO pins on the
639 * ALC260. This is incredibly simplistic; the intention of this control is
640 * to provide something in the test model allowing digital outputs to be
641 * identified if present. If models are found which can utilise these
642 * outputs a more complete mixer control can be devised for those models if
645 #ifdef CONFIG_SND_DEBUG
646 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
648 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
649 struct snd_ctl_elem_value *ucontrol)
651 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
652 hda_nid_t nid = kcontrol->private_value & 0xffff;
653 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
654 long *valp = ucontrol->value.integer.value;
655 unsigned int val = snd_hda_codec_read(codec, nid, 0,
656 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
658 *valp = (val & mask) != 0;
661 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
662 struct snd_ctl_elem_value *ucontrol)
665 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
666 hda_nid_t nid = kcontrol->private_value & 0xffff;
667 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
668 long val = *ucontrol->value.integer.value;
669 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
670 AC_VERB_GET_DIGI_CONVERT_1,
673 /* Set/unset the masked control bit(s) as needed */
674 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
679 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
684 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
685 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
686 .info = alc_spdif_ctrl_info, \
687 .get = alc_spdif_ctrl_get, \
688 .put = alc_spdif_ctrl_put, \
689 .private_value = nid | (mask<<16) }
690 #endif /* CONFIG_SND_DEBUG */
692 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
693 * Again, this is only used in the ALC26x test models to help identify when
694 * the EAPD line must be asserted for features to work.
696 #ifdef CONFIG_SND_DEBUG
697 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
699 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
700 struct snd_ctl_elem_value *ucontrol)
702 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
703 hda_nid_t nid = kcontrol->private_value & 0xffff;
704 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
705 long *valp = ucontrol->value.integer.value;
706 unsigned int val = snd_hda_codec_read(codec, nid, 0,
707 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
709 *valp = (val & mask) != 0;
713 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
714 struct snd_ctl_elem_value *ucontrol)
717 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
718 hda_nid_t nid = kcontrol->private_value & 0xffff;
719 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
720 long val = *ucontrol->value.integer.value;
721 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
722 AC_VERB_GET_EAPD_BTLENABLE,
725 /* Set/unset the masked control bit(s) as needed */
726 change = (!val ? 0 : mask) != (ctrl_data & mask);
731 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
737 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
738 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
739 .info = alc_eapd_ctrl_info, \
740 .get = alc_eapd_ctrl_get, \
741 .put = alc_eapd_ctrl_put, \
742 .private_value = nid | (mask<<16) }
743 #endif /* CONFIG_SND_DEBUG */
747 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
749 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
751 spec->mixers[spec->num_mixers++] = mix;
754 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
756 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
758 spec->init_verbs[spec->num_init_verbs++] = verb;
762 * set up from the preset table
764 static void setup_preset(struct alc_spec *spec,
765 const struct alc_config_preset *preset)
769 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
770 add_mixer(spec, preset->mixers[i]);
771 spec->cap_mixer = preset->cap_mixer;
772 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
774 add_verb(spec, preset->init_verbs[i]);
776 spec->channel_mode = preset->channel_mode;
777 spec->num_channel_mode = preset->num_channel_mode;
778 spec->need_dac_fix = preset->need_dac_fix;
780 spec->multiout.max_channels = spec->channel_mode[0].channels;
782 spec->multiout.num_dacs = preset->num_dacs;
783 spec->multiout.dac_nids = preset->dac_nids;
784 spec->multiout.dig_out_nid = preset->dig_out_nid;
785 spec->multiout.hp_nid = preset->hp_nid;
787 spec->num_mux_defs = preset->num_mux_defs;
788 if (!spec->num_mux_defs)
789 spec->num_mux_defs = 1;
790 spec->input_mux = preset->input_mux;
792 spec->num_adc_nids = preset->num_adc_nids;
793 spec->adc_nids = preset->adc_nids;
794 spec->capsrc_nids = preset->capsrc_nids;
795 spec->dig_in_nid = preset->dig_in_nid;
797 spec->unsol_event = preset->unsol_event;
798 spec->init_hook = preset->init_hook;
799 #ifdef CONFIG_SND_HDA_POWER_SAVE
800 spec->loopback.amplist = preset->loopbacks;
804 /* Enable GPIO mask and set output */
805 static struct hda_verb alc_gpio1_init_verbs[] = {
806 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
807 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
808 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
812 static struct hda_verb alc_gpio2_init_verbs[] = {
813 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
814 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
815 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
819 static struct hda_verb alc_gpio3_init_verbs[] = {
820 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
821 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
822 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
827 * Fix hardware PLL issue
828 * On some codecs, the analog PLL gating control must be off while
829 * the default value is 1.
831 static void alc_fix_pll(struct hda_codec *codec)
833 struct alc_spec *spec = codec->spec;
838 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
840 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
841 AC_VERB_GET_PROC_COEF, 0);
842 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
844 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
845 val & ~(1 << spec->pll_coef_bit));
848 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
849 unsigned int coef_idx, unsigned int coef_bit)
851 struct alc_spec *spec = codec->spec;
853 spec->pll_coef_idx = coef_idx;
854 spec->pll_coef_bit = coef_bit;
858 static void alc_sku_automute(struct hda_codec *codec)
860 struct alc_spec *spec = codec->spec;
861 unsigned int present;
862 unsigned int hp_nid = spec->autocfg.hp_pins[0];
863 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
865 /* need to execute and sync at first */
866 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
867 present = snd_hda_codec_read(codec, hp_nid, 0,
868 AC_VERB_GET_PIN_SENSE, 0);
869 spec->jack_present = (present & 0x80000000) != 0;
870 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
871 spec->jack_present ? 0 : PIN_OUT);
874 #if 0 /* it's broken in some acses -- temporarily disabled */
875 static void alc_mic_automute(struct hda_codec *codec)
877 struct alc_spec *spec = codec->spec;
878 unsigned int present;
879 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
880 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
881 unsigned int mix_nid = spec->capsrc_nids[0];
882 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
884 capsrc_idx_mic = mic_nid - 0x18;
885 capsrc_idx_fmic = fmic_nid - 0x18;
886 present = snd_hda_codec_read(codec, mic_nid, 0,
887 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
888 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
889 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
890 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
891 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
892 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
893 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
896 #define alc_mic_automute(codec) /* NOP */
897 #endif /* disabled */
899 /* unsolicited event for HP jack sensing */
900 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
902 if (codec->vendor_id == 0x10ec0880)
906 if (res == ALC880_HP_EVENT)
907 alc_sku_automute(codec);
909 if (res == ALC880_MIC_EVENT)
910 alc_mic_automute(codec);
913 static void alc_inithook(struct hda_codec *codec)
915 alc_sku_automute(codec);
916 alc_mic_automute(codec);
919 /* additional initialization for ALC888 variants */
920 static void alc888_coef_init(struct hda_codec *codec)
924 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
925 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
926 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
927 if ((tmp & 0xf0) == 2)
929 snd_hda_codec_read(codec, 0x20, 0,
930 AC_VERB_SET_PROC_COEF, 0x830);
933 snd_hda_codec_read(codec, 0x20, 0,
934 AC_VERB_SET_PROC_COEF, 0x3030);
937 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
938 * 31 ~ 16 : Manufacture ID
940 * 7 ~ 0 : Assembly ID
941 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
943 static void alc_subsystem_id(struct hda_codec *codec,
944 unsigned int porta, unsigned int porte,
947 unsigned int ass, tmp, i;
949 struct alc_spec *spec = codec->spec;
951 ass = codec->subsystem_id & 0xffff;
952 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
956 * 31~30 : port conetcivity
959 * 19~16 : Check sum (15:1)
964 if (codec->vendor_id == 0x10ec0260)
966 ass = snd_hda_codec_read(codec, nid, 0,
967 AC_VERB_GET_CONFIG_DEFAULT, 0);
968 if (!(ass & 1) && !(ass & 0x100000))
970 if ((ass >> 30) != 1) /* no physical connection */
975 for (i = 1; i < 16; i++) {
979 if (((ass >> 16) & 0xf) != tmp)
985 * 2 : 0 --> Desktop, 1 --> Laptop
986 * 3~5 : External Amplifier control
989 tmp = (ass & 0x38) >> 3; /* external Amp control */
992 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
995 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
998 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1000 case 5: /* set EAPD output high */
1001 switch (codec->vendor_id) {
1003 snd_hda_codec_write(codec, 0x0f, 0,
1004 AC_VERB_SET_EAPD_BTLENABLE, 2);
1005 snd_hda_codec_write(codec, 0x10, 0,
1006 AC_VERB_SET_EAPD_BTLENABLE, 2);
1017 snd_hda_codec_write(codec, 0x14, 0,
1018 AC_VERB_SET_EAPD_BTLENABLE, 2);
1019 snd_hda_codec_write(codec, 0x15, 0,
1020 AC_VERB_SET_EAPD_BTLENABLE, 2);
1023 switch (codec->vendor_id) {
1025 snd_hda_codec_write(codec, 0x1a, 0,
1026 AC_VERB_SET_COEF_INDEX, 7);
1027 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1028 AC_VERB_GET_PROC_COEF, 0);
1029 snd_hda_codec_write(codec, 0x1a, 0,
1030 AC_VERB_SET_COEF_INDEX, 7);
1031 snd_hda_codec_write(codec, 0x1a, 0,
1032 AC_VERB_SET_PROC_COEF,
1041 snd_hda_codec_write(codec, 0x20, 0,
1042 AC_VERB_SET_COEF_INDEX, 7);
1043 tmp = snd_hda_codec_read(codec, 0x20, 0,
1044 AC_VERB_GET_PROC_COEF, 0);
1045 snd_hda_codec_write(codec, 0x20, 0,
1046 AC_VERB_SET_COEF_INDEX, 7);
1047 snd_hda_codec_write(codec, 0x20, 0,
1048 AC_VERB_SET_PROC_COEF,
1052 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1056 snd_hda_codec_write(codec, 0x20, 0,
1057 AC_VERB_SET_COEF_INDEX, 7);
1058 tmp = snd_hda_codec_read(codec, 0x20, 0,
1059 AC_VERB_GET_PROC_COEF, 0);
1060 snd_hda_codec_write(codec, 0x20, 0,
1061 AC_VERB_SET_COEF_INDEX, 7);
1062 snd_hda_codec_write(codec, 0x20, 0,
1063 AC_VERB_SET_PROC_COEF,
1071 /* is laptop or Desktop and enable the function "Mute internal speaker
1072 * when the external headphone out jack is plugged"
1074 if (!(ass & 0x8000))
1077 * 10~8 : Jack location
1078 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1080 * 15 : 1 --> enable the function "Mute internal speaker
1081 * when the external headphone out jack is plugged"
1083 if (!spec->autocfg.speaker_pins[0]) {
1084 if (spec->autocfg.line_out_pins[0])
1085 spec->autocfg.speaker_pins[0] =
1086 spec->autocfg.line_out_pins[0];
1091 if (!spec->autocfg.hp_pins[0]) {
1092 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1094 spec->autocfg.hp_pins[0] = porta;
1096 spec->autocfg.hp_pins[0] = porte;
1098 spec->autocfg.hp_pins[0] = portd;
1102 if (spec->autocfg.hp_pins[0])
1103 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1104 AC_VERB_SET_UNSOLICITED_ENABLE,
1105 AC_USRSP_EN | ALC880_HP_EVENT);
1107 #if 0 /* it's broken in some acses -- temporarily disabled */
1108 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1109 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1110 snd_hda_codec_write(codec,
1111 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1112 AC_VERB_SET_UNSOLICITED_ENABLE,
1113 AC_USRSP_EN | ALC880_MIC_EVENT);
1114 #endif /* disabled */
1116 spec->unsol_event = alc_sku_unsol_event;
1120 * Fix-up pin default configurations
1128 static void alc_fix_pincfg(struct hda_codec *codec,
1129 const struct snd_pci_quirk *quirk,
1130 const struct alc_pincfg **pinfix)
1132 const struct alc_pincfg *cfg;
1134 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1138 cfg = pinfix[quirk->value];
1139 for (; cfg->nid; cfg++) {
1142 for (i = 0; i < 4; i++) {
1143 snd_hda_codec_write(codec, cfg->nid, 0,
1144 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1152 * ALC880 3-stack model
1154 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1155 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1156 * F-Mic = 0x1b, HP = 0x19
1159 static hda_nid_t alc880_dac_nids[4] = {
1160 /* front, rear, clfe, rear_surr */
1161 0x02, 0x05, 0x04, 0x03
1164 static hda_nid_t alc880_adc_nids[3] = {
1169 /* The datasheet says the node 0x07 is connected from inputs,
1170 * but it shows zero connection in the real implementation on some devices.
1171 * Note: this is a 915GAV bug, fixed on 915GLV
1173 static hda_nid_t alc880_adc_nids_alt[2] = {
1178 #define ALC880_DIGOUT_NID 0x06
1179 #define ALC880_DIGIN_NID 0x0a
1181 static struct hda_input_mux alc880_capture_source = {
1185 { "Front Mic", 0x3 },
1191 /* channel source setting (2/6 channel selection for 3-stack) */
1193 static struct hda_verb alc880_threestack_ch2_init[] = {
1194 /* set line-in to input, mute it */
1195 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1196 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1197 /* set mic-in to input vref 80%, mute it */
1198 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1199 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1204 static struct hda_verb alc880_threestack_ch6_init[] = {
1205 /* set line-in to output, unmute it */
1206 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1207 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1208 /* set mic-in to output, unmute it */
1209 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1210 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1214 static struct hda_channel_mode alc880_threestack_modes[2] = {
1215 { 2, alc880_threestack_ch2_init },
1216 { 6, alc880_threestack_ch6_init },
1219 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1220 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1221 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1222 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1223 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1225 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1226 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1227 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1228 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1229 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1230 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1231 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1236 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1237 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1240 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1241 .name = "Channel Mode",
1242 .info = alc_ch_mode_info,
1243 .get = alc_ch_mode_get,
1244 .put = alc_ch_mode_put,
1249 /* capture mixer elements */
1250 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1251 struct snd_ctl_elem_info *uinfo)
1253 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1254 struct alc_spec *spec = codec->spec;
1257 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1258 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1260 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1261 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1265 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1266 unsigned int size, unsigned int __user *tlv)
1268 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1269 struct alc_spec *spec = codec->spec;
1272 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1273 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1275 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1276 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1280 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1281 struct snd_ctl_elem_value *ucontrol);
1283 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1284 struct snd_ctl_elem_value *ucontrol,
1287 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1288 struct alc_spec *spec = codec->spec;
1289 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1292 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1293 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1295 err = func(kcontrol, ucontrol);
1296 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1300 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1301 struct snd_ctl_elem_value *ucontrol)
1303 return alc_cap_getput_caller(kcontrol, ucontrol,
1304 snd_hda_mixer_amp_volume_get);
1307 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1308 struct snd_ctl_elem_value *ucontrol)
1310 return alc_cap_getput_caller(kcontrol, ucontrol,
1311 snd_hda_mixer_amp_volume_put);
1314 /* capture mixer elements */
1315 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1317 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1318 struct snd_ctl_elem_value *ucontrol)
1320 return alc_cap_getput_caller(kcontrol, ucontrol,
1321 snd_hda_mixer_amp_switch_get);
1324 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1325 struct snd_ctl_elem_value *ucontrol)
1327 return alc_cap_getput_caller(kcontrol, ucontrol,
1328 snd_hda_mixer_amp_switch_put);
1331 #define DEFINE_CAPMIX(num) \
1332 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1335 .name = "Capture Switch", \
1336 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1338 .info = alc_cap_sw_info, \
1339 .get = alc_cap_sw_get, \
1340 .put = alc_cap_sw_put, \
1343 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1344 .name = "Capture Volume", \
1345 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1346 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1347 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1349 .info = alc_cap_vol_info, \
1350 .get = alc_cap_vol_get, \
1351 .put = alc_cap_vol_put, \
1352 .tlv = { .c = alc_cap_vol_tlv }, \
1357 /* up to three ADCs */
1364 * ALC880 5-stack model
1366 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1368 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1369 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1372 /* additional mixers to alc880_three_stack_mixer */
1373 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1374 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1375 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1379 /* channel source setting (6/8 channel selection for 5-stack) */
1381 static struct hda_verb alc880_fivestack_ch6_init[] = {
1382 /* set line-in to input, mute it */
1383 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1384 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1389 static struct hda_verb alc880_fivestack_ch8_init[] = {
1390 /* set line-in to output, unmute it */
1391 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1392 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1396 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1397 { 6, alc880_fivestack_ch6_init },
1398 { 8, alc880_fivestack_ch8_init },
1403 * ALC880 6-stack model
1405 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1406 * Side = 0x05 (0x0f)
1407 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1408 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1411 static hda_nid_t alc880_6st_dac_nids[4] = {
1412 /* front, rear, clfe, rear_surr */
1413 0x02, 0x03, 0x04, 0x05
1416 static struct hda_input_mux alc880_6stack_capture_source = {
1420 { "Front Mic", 0x1 },
1426 /* fixed 8-channels */
1427 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1431 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1433 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1434 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1435 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1436 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1437 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1438 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1439 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1440 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1441 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1442 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1443 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1444 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1445 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1446 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1447 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1448 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1449 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1450 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1451 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1453 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1454 .name = "Channel Mode",
1455 .info = alc_ch_mode_info,
1456 .get = alc_ch_mode_get,
1457 .put = alc_ch_mode_put,
1466 * W810 has rear IO for:
1469 * Center/LFE (DAC 04)
1472 * The system also has a pair of internal speakers, and a headphone jack.
1473 * These are both connected to Line2 on the codec, hence to DAC 02.
1475 * There is a variable resistor to control the speaker or headphone
1476 * volume. This is a hardware-only device without a software API.
1478 * Plugging headphones in will disable the internal speakers. This is
1479 * implemented in hardware, not via the driver using jack sense. In
1480 * a similar fashion, plugging into the rear socket marked "front" will
1481 * disable both the speakers and headphones.
1483 * For input, there's a microphone jack, and an "audio in" jack.
1484 * These may not do anything useful with this driver yet, because I
1485 * haven't setup any initialization verbs for these yet...
1488 static hda_nid_t alc880_w810_dac_nids[3] = {
1489 /* front, rear/surround, clfe */
1493 /* fixed 6 channels */
1494 static struct hda_channel_mode alc880_w810_modes[1] = {
1498 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1499 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1500 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1501 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1502 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1503 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1504 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1505 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1506 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1507 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1516 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1517 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1521 static hda_nid_t alc880_z71v_dac_nids[1] = {
1524 #define ALC880_Z71V_HP_DAC 0x03
1526 /* fixed 2 channels */
1527 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1531 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1532 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1533 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1534 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1535 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1536 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1537 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1545 * ALC880 F1734 model
1547 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1548 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1551 static hda_nid_t alc880_f1734_dac_nids[1] = {
1554 #define ALC880_F1734_HP_DAC 0x02
1556 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1557 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1558 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1559 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1560 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1561 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1562 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1568 static struct hda_input_mux alc880_f1734_capture_source = {
1580 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1581 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1582 * Mic = 0x18, Line = 0x1a
1585 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1586 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1588 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1589 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1590 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1591 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1592 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1593 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1594 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1595 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1596 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1597 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1598 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1599 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1600 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1604 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1605 .name = "Channel Mode",
1606 .info = alc_ch_mode_info,
1607 .get = alc_ch_mode_get,
1608 .put = alc_ch_mode_put,
1614 * ALC880 ASUS W1V model
1616 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1617 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1618 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1621 /* additional mixers to alc880_asus_mixer */
1622 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1623 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1624 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1628 /* additional mixers to alc880_asus_mixer */
1629 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1630 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1631 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1636 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1637 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1638 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1640 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1641 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1644 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1645 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1650 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1651 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1652 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1653 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1654 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1655 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1656 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1657 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1658 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1659 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1660 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1661 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1662 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1663 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1664 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1665 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1666 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1667 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1668 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1670 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1671 .name = "Channel Mode",
1672 .info = alc_ch_mode_info,
1673 .get = alc_ch_mode_get,
1674 .put = alc_ch_mode_put,
1679 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1680 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1681 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1682 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1683 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1684 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1685 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1686 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1687 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1688 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1689 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1693 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1694 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1695 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1696 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1697 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1698 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1699 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1704 * virtual master controls
1708 * slave controls for virtual master
1710 static const char *alc_slave_vols[] = {
1711 "Front Playback Volume",
1712 "Surround Playback Volume",
1713 "Center Playback Volume",
1714 "LFE Playback Volume",
1715 "Side Playback Volume",
1716 "Headphone Playback Volume",
1717 "Speaker Playback Volume",
1718 "Mono Playback Volume",
1719 "Line-Out Playback Volume",
1723 static const char *alc_slave_sws[] = {
1724 "Front Playback Switch",
1725 "Surround Playback Switch",
1726 "Center Playback Switch",
1727 "LFE Playback Switch",
1728 "Side Playback Switch",
1729 "Headphone Playback Switch",
1730 "Speaker Playback Switch",
1731 "Mono Playback Switch",
1732 "IEC958 Playback Switch",
1737 * build control elements
1740 static void alc_free_kctls(struct hda_codec *codec);
1742 static int alc_build_controls(struct hda_codec *codec)
1744 struct alc_spec *spec = codec->spec;
1748 for (i = 0; i < spec->num_mixers; i++) {
1749 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1753 if (spec->cap_mixer) {
1754 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
1758 if (spec->multiout.dig_out_nid) {
1759 err = snd_hda_create_spdif_out_ctls(codec,
1760 spec->multiout.dig_out_nid);
1763 err = snd_hda_create_spdif_share_sw(codec,
1767 spec->multiout.share_spdif = 1;
1769 if (spec->dig_in_nid) {
1770 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1775 /* if we have no master control, let's create it */
1776 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1777 unsigned int vmaster_tlv[4];
1778 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1779 HDA_OUTPUT, vmaster_tlv);
1780 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1781 vmaster_tlv, alc_slave_vols);
1785 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1786 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1787 NULL, alc_slave_sws);
1792 alc_free_kctls(codec); /* no longer needed */
1798 * initialize the codec volumes, etc
1802 * generic initialization of ADC, input mixers and output mixers
1804 static struct hda_verb alc880_volume_init_verbs[] = {
1806 * Unmute ADC0-2 and set the default input to mic-in
1808 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1809 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1810 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1811 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1812 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1813 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1815 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1817 * Note: PASD motherboards uses the Line In 2 as the input for front
1820 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1821 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1822 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1823 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1824 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1825 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1826 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1830 * Set up output mixers (0x0c - 0x0f)
1832 /* set vol=0 to output mixers */
1833 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1834 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1835 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1836 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1837 /* set up input amps for analog loopback */
1838 /* Amp Indices: DAC = 0, mixer = 1 */
1839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1845 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1846 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1852 * 3-stack pin configuration:
1853 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1855 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1857 * preset connection lists of input pins
1858 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1860 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1861 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1862 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1865 * Set pin mode and muting
1867 /* set front pin widgets 0x14 for output */
1868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1869 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1870 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1871 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1873 /* Mic2 (as headphone out) for HP output */
1874 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1875 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1876 /* Line In pin widget for input */
1877 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1878 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1879 /* Line2 (as front mic) pin widget for input and vref at 80% */
1880 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1881 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1882 /* CD pin widget for input */
1883 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1889 * 5-stack pin configuration:
1890 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1891 * line-in/side = 0x1a, f-mic = 0x1b
1893 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1895 * preset connection lists of input pins
1896 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1898 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1899 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1902 * Set pin mode and muting
1904 /* set pin widgets 0x14-0x17 for output */
1905 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1906 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1907 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1908 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1909 /* unmute pins for output (no gain on this amp) */
1910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1911 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1912 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1913 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1915 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1916 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1917 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1918 /* Mic2 (as headphone out) for HP output */
1919 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1920 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1921 /* Line In pin widget for input */
1922 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1923 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1924 /* Line2 (as front mic) pin widget for input and vref at 80% */
1925 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1926 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1927 /* CD pin widget for input */
1928 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1934 * W810 pin configuration:
1935 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1937 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1938 /* hphone/speaker input selector: front DAC */
1939 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1941 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1942 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1943 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1944 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1945 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1946 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1948 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1949 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1955 * Z71V pin configuration:
1956 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1958 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1959 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1960 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1961 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1962 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1964 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1965 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1966 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1967 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1973 * 6-stack pin configuration:
1974 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1975 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1977 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1978 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1981 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1982 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1983 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1984 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1985 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1986 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1987 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1989 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1990 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1991 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1992 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1993 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1994 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1995 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1996 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1997 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2003 * Uniwill pin configuration:
2004 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2007 static struct hda_verb alc880_uniwill_init_verbs[] = {
2008 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2011 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2015 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2016 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2017 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2023 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2025 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2026 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2027 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2028 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2029 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2030 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2031 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2032 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2033 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2035 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2036 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2043 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2045 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2046 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2050 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2052 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2053 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2058 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2061 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2062 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2068 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2069 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2074 static struct hda_verb alc880_beep_init_verbs[] = {
2075 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2079 /* toggle speaker-output according to the hp-jack state */
2080 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2082 unsigned int present;
2085 present = snd_hda_codec_read(codec, 0x14, 0,
2086 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2087 bits = present ? HDA_AMP_MUTE : 0;
2088 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2089 HDA_AMP_MUTE, bits);
2090 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2091 HDA_AMP_MUTE, bits);
2094 /* auto-toggle front mic */
2095 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2097 unsigned int present;
2100 present = snd_hda_codec_read(codec, 0x18, 0,
2101 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2102 bits = present ? HDA_AMP_MUTE : 0;
2103 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2106 static void alc880_uniwill_automute(struct hda_codec *codec)
2108 alc880_uniwill_hp_automute(codec);
2109 alc880_uniwill_mic_automute(codec);
2112 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2115 /* Looks like the unsol event is incompatible with the standard
2116 * definition. 4bit tag is placed at 28 bit!
2118 switch (res >> 28) {
2119 case ALC880_HP_EVENT:
2120 alc880_uniwill_hp_automute(codec);
2122 case ALC880_MIC_EVENT:
2123 alc880_uniwill_mic_automute(codec);
2128 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2130 unsigned int present;
2133 present = snd_hda_codec_read(codec, 0x14, 0,
2134 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2135 bits = present ? HDA_AMP_MUTE : 0;
2136 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2139 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2141 unsigned int present;
2143 present = snd_hda_codec_read(codec, 0x21, 0,
2144 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2145 present &= HDA_AMP_VOLMASK;
2146 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2147 HDA_AMP_VOLMASK, present);
2148 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2149 HDA_AMP_VOLMASK, present);
2152 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2155 /* Looks like the unsol event is incompatible with the standard
2156 * definition. 4bit tag is placed at 28 bit!
2158 if ((res >> 28) == ALC880_HP_EVENT)
2159 alc880_uniwill_p53_hp_automute(codec);
2160 if ((res >> 28) == ALC880_DCVOL_EVENT)
2161 alc880_uniwill_p53_dcvol_automute(codec);
2165 * F1734 pin configuration:
2166 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2168 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2169 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2170 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2171 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2172 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2173 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2175 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2176 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2177 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2180 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2182 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2183 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2184 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2187 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2188 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2190 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2191 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2197 * ASUS pin configuration:
2198 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2200 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2201 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2202 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2203 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2204 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2209 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2210 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2211 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2212 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2213 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2215 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2216 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2217 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2219 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2221 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2222 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2223 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2228 /* Enable GPIO mask and set output */
2229 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2230 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2232 /* Clevo m520g init */
2233 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2234 /* headphone output */
2235 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2238 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2240 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2241 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2243 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2244 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2245 /* Mic1 (rear panel) */
2246 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2247 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2248 /* Mic2 (front panel) */
2249 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2250 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2252 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2254 /* change to EAPD mode */
2255 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2256 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2261 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2262 /* change to EAPD mode */
2263 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2264 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2266 /* Headphone output */
2267 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2269 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2270 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2272 /* Line In pin widget for input */
2273 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2274 /* CD pin widget for input */
2275 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2276 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2279 /* change to EAPD mode */
2280 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2281 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2287 * LG m1 express dual
2290 * Rear Line-In/Out (blue): 0x14
2291 * Build-in Mic-In: 0x15
2293 * HP-Out (green): 0x1b
2294 * Mic-In/Out (red): 0x19
2298 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2299 static hda_nid_t alc880_lg_dac_nids[3] = {
2303 /* seems analog CD is not working */
2304 static struct hda_input_mux alc880_lg_capture_source = {
2309 { "Internal Mic", 0x6 },
2313 /* 2,4,6 channel modes */
2314 static struct hda_verb alc880_lg_ch2_init[] = {
2315 /* set line-in and mic-in to input */
2316 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2317 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2321 static struct hda_verb alc880_lg_ch4_init[] = {
2322 /* set line-in to out and mic-in to input */
2323 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2324 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2328 static struct hda_verb alc880_lg_ch6_init[] = {
2329 /* set line-in and mic-in to output */
2330 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2331 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2335 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2336 { 2, alc880_lg_ch2_init },
2337 { 4, alc880_lg_ch4_init },
2338 { 6, alc880_lg_ch6_init },
2341 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2342 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2343 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2344 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2345 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2346 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2347 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2348 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2349 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2353 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2354 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2355 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2358 .name = "Channel Mode",
2359 .info = alc_ch_mode_info,
2360 .get = alc_ch_mode_get,
2361 .put = alc_ch_mode_put,
2366 static struct hda_verb alc880_lg_init_verbs[] = {
2367 /* set capture source to mic-in */
2368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2369 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2370 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2371 /* mute all amp mixer inputs */
2372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2373 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2374 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2375 /* line-in to input */
2376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2377 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2380 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2382 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2383 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2384 /* mic-in to input */
2385 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2386 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2387 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2389 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2390 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2391 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2393 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2397 /* toggle speaker-output according to the hp-jack state */
2398 static void alc880_lg_automute(struct hda_codec *codec)
2400 unsigned int present;
2403 present = snd_hda_codec_read(codec, 0x1b, 0,
2404 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2405 bits = present ? HDA_AMP_MUTE : 0;
2406 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2407 HDA_AMP_MUTE, bits);
2410 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2412 /* Looks like the unsol event is incompatible with the standard
2413 * definition. 4bit tag is placed at 28 bit!
2415 if ((res >> 28) == 0x01)
2416 alc880_lg_automute(codec);
2425 * Built-in Mic-In: 0x19
2431 static struct hda_input_mux alc880_lg_lw_capture_source = {
2435 { "Internal Mic", 0x1 },
2440 #define alc880_lg_lw_modes alc880_threestack_modes
2442 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2443 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2444 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2445 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2446 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2447 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2448 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2449 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2450 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2455 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2456 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2458 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2459 .name = "Channel Mode",
2460 .info = alc_ch_mode_info,
2461 .get = alc_ch_mode_get,
2462 .put = alc_ch_mode_put,
2467 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2468 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2469 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2470 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2472 /* set capture source to mic-in */
2473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2474 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2475 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2481 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2482 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2483 /* mic-in to input */
2484 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2487 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2488 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2490 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2494 /* toggle speaker-output according to the hp-jack state */
2495 static void alc880_lg_lw_automute(struct hda_codec *codec)
2497 unsigned int present;
2500 present = snd_hda_codec_read(codec, 0x1b, 0,
2501 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2502 bits = present ? HDA_AMP_MUTE : 0;
2503 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2504 HDA_AMP_MUTE, bits);
2507 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2509 /* Looks like the unsol event is incompatible with the standard
2510 * definition. 4bit tag is placed at 28 bit!
2512 if ((res >> 28) == 0x01)
2513 alc880_lg_lw_automute(codec);
2516 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2517 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2518 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2520 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2521 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2522 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2526 static struct hda_input_mux alc880_medion_rim_capture_source = {
2530 { "Internal Mic", 0x1 },
2534 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2535 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2538 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2540 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2541 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2542 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2543 /* Mic2 (as headphone out) for HP output */
2544 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2545 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2546 /* Internal Speaker */
2547 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2548 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2550 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2551 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2553 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2557 /* toggle speaker-output according to the hp-jack state */
2558 static void alc880_medion_rim_automute(struct hda_codec *codec)
2560 unsigned int present;
2563 present = snd_hda_codec_read(codec, 0x14, 0,
2564 AC_VERB_GET_PIN_SENSE, 0)
2565 & AC_PINSENSE_PRESENCE;
2566 bits = present ? HDA_AMP_MUTE : 0;
2567 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2568 HDA_AMP_MUTE, bits);
2570 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2572 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2575 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2578 /* Looks like the unsol event is incompatible with the standard
2579 * definition. 4bit tag is placed at 28 bit!
2581 if ((res >> 28) == ALC880_HP_EVENT)
2582 alc880_medion_rim_automute(codec);
2585 #ifdef CONFIG_SND_HDA_POWER_SAVE
2586 static struct hda_amp_list alc880_loopbacks[] = {
2587 { 0x0b, HDA_INPUT, 0 },
2588 { 0x0b, HDA_INPUT, 1 },
2589 { 0x0b, HDA_INPUT, 2 },
2590 { 0x0b, HDA_INPUT, 3 },
2591 { 0x0b, HDA_INPUT, 4 },
2595 static struct hda_amp_list alc880_lg_loopbacks[] = {
2596 { 0x0b, HDA_INPUT, 1 },
2597 { 0x0b, HDA_INPUT, 6 },
2598 { 0x0b, HDA_INPUT, 7 },
2607 static int alc_init(struct hda_codec *codec)
2609 struct alc_spec *spec = codec->spec;
2613 if (codec->vendor_id == 0x10ec0888)
2614 alc888_coef_init(codec);
2616 for (i = 0; i < spec->num_init_verbs; i++)
2617 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2619 if (spec->init_hook)
2620 spec->init_hook(codec);
2625 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2627 struct alc_spec *spec = codec->spec;
2629 if (spec->unsol_event)
2630 spec->unsol_event(codec, res);
2633 #ifdef CONFIG_SND_HDA_POWER_SAVE
2634 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2636 struct alc_spec *spec = codec->spec;
2637 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2642 * Analog playback callbacks
2644 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2645 struct hda_codec *codec,
2646 struct snd_pcm_substream *substream)
2648 struct alc_spec *spec = codec->spec;
2649 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2653 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2654 struct hda_codec *codec,
2655 unsigned int stream_tag,
2656 unsigned int format,
2657 struct snd_pcm_substream *substream)
2659 struct alc_spec *spec = codec->spec;
2660 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2661 stream_tag, format, substream);
2664 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2665 struct hda_codec *codec,
2666 struct snd_pcm_substream *substream)
2668 struct alc_spec *spec = codec->spec;
2669 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2675 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2676 struct hda_codec *codec,
2677 struct snd_pcm_substream *substream)
2679 struct alc_spec *spec = codec->spec;
2680 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2683 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2684 struct hda_codec *codec,
2685 unsigned int stream_tag,
2686 unsigned int format,
2687 struct snd_pcm_substream *substream)
2689 struct alc_spec *spec = codec->spec;
2690 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2691 stream_tag, format, substream);
2694 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2695 struct hda_codec *codec,
2696 struct snd_pcm_substream *substream)
2698 struct alc_spec *spec = codec->spec;
2699 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2705 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2706 struct hda_codec *codec,
2707 unsigned int stream_tag,
2708 unsigned int format,
2709 struct snd_pcm_substream *substream)
2711 struct alc_spec *spec = codec->spec;
2713 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2714 stream_tag, 0, format);
2718 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2719 struct hda_codec *codec,
2720 struct snd_pcm_substream *substream)
2722 struct alc_spec *spec = codec->spec;
2724 snd_hda_codec_cleanup_stream(codec,
2725 spec->adc_nids[substream->number + 1]);
2732 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2736 /* NID is set in alc_build_pcms */
2738 .open = alc880_playback_pcm_open,
2739 .prepare = alc880_playback_pcm_prepare,
2740 .cleanup = alc880_playback_pcm_cleanup
2744 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2748 /* NID is set in alc_build_pcms */
2751 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2755 /* NID is set in alc_build_pcms */
2758 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2759 .substreams = 2, /* can be overridden */
2762 /* NID is set in alc_build_pcms */
2764 .prepare = alc880_alt_capture_pcm_prepare,
2765 .cleanup = alc880_alt_capture_pcm_cleanup
2769 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2773 /* NID is set in alc_build_pcms */
2775 .open = alc880_dig_playback_pcm_open,
2776 .close = alc880_dig_playback_pcm_close,
2777 .prepare = alc880_dig_playback_pcm_prepare
2781 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2785 /* NID is set in alc_build_pcms */
2788 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2789 static struct hda_pcm_stream alc_pcm_null_stream = {
2795 static int alc_build_pcms(struct hda_codec *codec)
2797 struct alc_spec *spec = codec->spec;
2798 struct hda_pcm *info = spec->pcm_rec;
2801 codec->num_pcms = 1;
2802 codec->pcm_info = info;
2804 info->name = spec->stream_name_analog;
2805 if (spec->stream_analog_playback) {
2806 if (snd_BUG_ON(!spec->multiout.dac_nids))
2808 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2809 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2811 if (spec->stream_analog_capture) {
2812 if (snd_BUG_ON(!spec->adc_nids))
2814 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2815 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2818 if (spec->channel_mode) {
2819 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2820 for (i = 0; i < spec->num_channel_mode; i++) {
2821 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2822 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2827 /* SPDIF for stream index #1 */
2828 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2829 codec->num_pcms = 2;
2830 info = spec->pcm_rec + 1;
2831 info->name = spec->stream_name_digital;
2832 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2833 if (spec->multiout.dig_out_nid &&
2834 spec->stream_digital_playback) {
2835 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2836 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2838 if (spec->dig_in_nid &&
2839 spec->stream_digital_capture) {
2840 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2841 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2843 /* FIXME: do we need this for all Realtek codec models? */
2844 codec->spdif_status_reset = 1;
2847 /* If the use of more than one ADC is requested for the current
2848 * model, configure a second analog capture-only PCM.
2850 /* Additional Analaog capture for index #2 */
2851 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2852 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2853 codec->num_pcms = 3;
2854 info = spec->pcm_rec + 2;
2855 info->name = spec->stream_name_analog;
2856 if (spec->alt_dac_nid) {
2857 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2858 *spec->stream_analog_alt_playback;
2859 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2862 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2863 alc_pcm_null_stream;
2864 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2866 if (spec->num_adc_nids > 1) {
2867 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2868 *spec->stream_analog_alt_capture;
2869 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2871 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2872 spec->num_adc_nids - 1;
2874 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2875 alc_pcm_null_stream;
2876 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2883 static void alc_free_kctls(struct hda_codec *codec)
2885 struct alc_spec *spec = codec->spec;
2887 if (spec->kctls.list) {
2888 struct snd_kcontrol_new *kctl = spec->kctls.list;
2890 for (i = 0; i < spec->kctls.used; i++)
2891 kfree(kctl[i].name);
2893 snd_array_free(&spec->kctls);
2896 static void alc_free(struct hda_codec *codec)
2898 struct alc_spec *spec = codec->spec;
2903 alc_free_kctls(codec);
2905 codec->spec = NULL; /* to be sure */
2908 #ifdef SND_HDA_NEEDS_RESUME
2909 static void store_pin_configs(struct hda_codec *codec)
2911 struct alc_spec *spec = codec->spec;
2912 hda_nid_t nid, end_nid;
2914 end_nid = codec->start_nid + codec->num_nodes;
2915 for (nid = codec->start_nid; nid < end_nid; nid++) {
2916 unsigned int wid_caps = get_wcaps(codec, nid);
2917 unsigned int wid_type =
2918 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2919 if (wid_type != AC_WID_PIN)
2921 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
2923 spec->pin_nids[spec->num_pins] = nid;
2924 spec->pin_cfgs[spec->num_pins] =
2925 snd_hda_codec_read(codec, nid, 0,
2926 AC_VERB_GET_CONFIG_DEFAULT, 0);
2931 static void resume_pin_configs(struct hda_codec *codec)
2933 struct alc_spec *spec = codec->spec;
2936 for (i = 0; i < spec->num_pins; i++) {
2937 hda_nid_t pin_nid = spec->pin_nids[i];
2938 unsigned int pin_config = spec->pin_cfgs[i];
2939 snd_hda_codec_write(codec, pin_nid, 0,
2940 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2941 pin_config & 0x000000ff);
2942 snd_hda_codec_write(codec, pin_nid, 0,
2943 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2944 (pin_config & 0x0000ff00) >> 8);
2945 snd_hda_codec_write(codec, pin_nid, 0,
2946 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2947 (pin_config & 0x00ff0000) >> 16);
2948 snd_hda_codec_write(codec, pin_nid, 0,
2949 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2954 static int alc_resume(struct hda_codec *codec)
2956 resume_pin_configs(codec);
2957 codec->patch_ops.init(codec);
2958 snd_hda_codec_resume_amp(codec);
2959 snd_hda_codec_resume_cache(codec);
2963 #define store_pin_configs(codec)
2968 static struct hda_codec_ops alc_patch_ops = {
2969 .build_controls = alc_build_controls,
2970 .build_pcms = alc_build_pcms,
2973 .unsol_event = alc_unsol_event,
2974 #ifdef SND_HDA_NEEDS_RESUME
2975 .resume = alc_resume,
2977 #ifdef CONFIG_SND_HDA_POWER_SAVE
2978 .check_power_status = alc_check_power_status,
2984 * Test configuration for debugging
2986 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2989 #ifdef CONFIG_SND_DEBUG
2990 static hda_nid_t alc880_test_dac_nids[4] = {
2991 0x02, 0x03, 0x04, 0x05
2994 static struct hda_input_mux alc880_test_capture_source = {
3003 { "Surround", 0x6 },
3007 static struct hda_channel_mode alc880_test_modes[4] = {
3014 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3015 struct snd_ctl_elem_info *uinfo)
3017 static char *texts[] = {
3018 "N/A", "Line Out", "HP Out",
3019 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3021 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3023 uinfo->value.enumerated.items = 8;
3024 if (uinfo->value.enumerated.item >= 8)
3025 uinfo->value.enumerated.item = 7;
3026 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3030 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3031 struct snd_ctl_elem_value *ucontrol)
3033 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3034 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3035 unsigned int pin_ctl, item = 0;
3037 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3038 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3039 if (pin_ctl & AC_PINCTL_OUT_EN) {
3040 if (pin_ctl & AC_PINCTL_HP_EN)
3044 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3045 switch (pin_ctl & AC_PINCTL_VREFEN) {
3046 case AC_PINCTL_VREF_HIZ: item = 3; break;
3047 case AC_PINCTL_VREF_50: item = 4; break;
3048 case AC_PINCTL_VREF_GRD: item = 5; break;
3049 case AC_PINCTL_VREF_80: item = 6; break;
3050 case AC_PINCTL_VREF_100: item = 7; break;
3053 ucontrol->value.enumerated.item[0] = item;
3057 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3058 struct snd_ctl_elem_value *ucontrol)
3060 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3061 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3062 static unsigned int ctls[] = {
3063 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3064 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3065 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3066 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3067 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3068 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3070 unsigned int old_ctl, new_ctl;
3072 old_ctl = snd_hda_codec_read(codec, nid, 0,
3073 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3074 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3075 if (old_ctl != new_ctl) {
3077 snd_hda_codec_write_cache(codec, nid, 0,
3078 AC_VERB_SET_PIN_WIDGET_CONTROL,
3080 val = ucontrol->value.enumerated.item[0] >= 3 ?
3082 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3089 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3090 struct snd_ctl_elem_info *uinfo)
3092 static char *texts[] = {
3093 "Front", "Surround", "CLFE", "Side"
3095 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3097 uinfo->value.enumerated.items = 4;
3098 if (uinfo->value.enumerated.item >= 4)
3099 uinfo->value.enumerated.item = 3;
3100 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3104 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3105 struct snd_ctl_elem_value *ucontrol)
3107 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3108 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3111 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3112 ucontrol->value.enumerated.item[0] = sel & 3;
3116 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3117 struct snd_ctl_elem_value *ucontrol)
3119 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3120 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3123 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3124 if (ucontrol->value.enumerated.item[0] != sel) {
3125 sel = ucontrol->value.enumerated.item[0] & 3;
3126 snd_hda_codec_write_cache(codec, nid, 0,
3127 AC_VERB_SET_CONNECT_SEL, sel);
3133 #define PIN_CTL_TEST(xname,nid) { \
3134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3136 .info = alc_test_pin_ctl_info, \
3137 .get = alc_test_pin_ctl_get, \
3138 .put = alc_test_pin_ctl_put, \
3139 .private_value = nid \
3142 #define PIN_SRC_TEST(xname,nid) { \
3143 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3145 .info = alc_test_pin_src_info, \
3146 .get = alc_test_pin_src_get, \
3147 .put = alc_test_pin_src_put, \
3148 .private_value = nid \
3151 static struct snd_kcontrol_new alc880_test_mixer[] = {
3152 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3153 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3154 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3155 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3156 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3157 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3158 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3159 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3160 PIN_CTL_TEST("Front Pin Mode", 0x14),
3161 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3162 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3163 PIN_CTL_TEST("Side Pin Mode", 0x17),
3164 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3165 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3166 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3167 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3168 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3169 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3170 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3171 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3172 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3173 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3174 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3175 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3176 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3177 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3178 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3179 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3180 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3181 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3183 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3184 .name = "Channel Mode",
3185 .info = alc_ch_mode_info,
3186 .get = alc_ch_mode_get,
3187 .put = alc_ch_mode_put,
3192 static struct hda_verb alc880_test_init_verbs[] = {
3193 /* Unmute inputs of 0x0c - 0x0f */
3194 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3196 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3198 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3200 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3201 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3202 /* Vol output for 0x0c-0x0f */
3203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3205 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3206 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3207 /* Set output pins 0x14-0x17 */
3208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3210 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3211 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3212 /* Unmute output pins 0x14-0x17 */
3213 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3214 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3215 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3216 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3217 /* Set input pins 0x18-0x1c */
3218 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3219 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3220 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3221 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3222 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3223 /* Mute input pins 0x18-0x1b */
3224 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3225 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3226 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3227 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3230 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3231 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3232 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3233 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3234 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3235 /* Analog input/passthru */
3236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3238 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3239 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3240 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3248 static const char *alc880_models[ALC880_MODEL_LAST] = {
3249 [ALC880_3ST] = "3stack",
3250 [ALC880_TCL_S700] = "tcl",
3251 [ALC880_3ST_DIG] = "3stack-digout",
3252 [ALC880_CLEVO] = "clevo",
3253 [ALC880_5ST] = "5stack",
3254 [ALC880_5ST_DIG] = "5stack-digout",
3255 [ALC880_W810] = "w810",
3256 [ALC880_Z71V] = "z71v",
3257 [ALC880_6ST] = "6stack",
3258 [ALC880_6ST_DIG] = "6stack-digout",
3259 [ALC880_ASUS] = "asus",
3260 [ALC880_ASUS_W1V] = "asus-w1v",
3261 [ALC880_ASUS_DIG] = "asus-dig",
3262 [ALC880_ASUS_DIG2] = "asus-dig2",
3263 [ALC880_UNIWILL_DIG] = "uniwill",
3264 [ALC880_UNIWILL_P53] = "uniwill-p53",
3265 [ALC880_FUJITSU] = "fujitsu",
3266 [ALC880_F1734] = "F1734",
3268 [ALC880_LG_LW] = "lg-lw",
3269 [ALC880_MEDION_RIM] = "medion",
3270 #ifdef CONFIG_SND_DEBUG
3271 [ALC880_TEST] = "test",
3273 [ALC880_AUTO] = "auto",
3276 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3277 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3278 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3279 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3280 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3281 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3282 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3283 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3284 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3285 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3286 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3287 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3288 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3289 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3290 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3291 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3292 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3293 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3294 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3295 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3296 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3297 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3298 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3299 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3300 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3301 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3302 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3303 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3304 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3305 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3306 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3307 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3308 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3309 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3310 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3311 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3312 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3313 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3314 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3315 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3316 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3317 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3318 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3319 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3320 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3321 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3322 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3323 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3324 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3325 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3326 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3327 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3328 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3329 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3330 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3331 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3332 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3333 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3334 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3335 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3336 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3337 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3338 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3339 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3340 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3341 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3342 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3343 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3344 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3345 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3346 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3347 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3352 * ALC880 codec presets
3354 static struct alc_config_preset alc880_presets[] = {
3356 .mixers = { alc880_three_stack_mixer },
3357 .init_verbs = { alc880_volume_init_verbs,
3358 alc880_pin_3stack_init_verbs },
3359 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3360 .dac_nids = alc880_dac_nids,
3361 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3362 .channel_mode = alc880_threestack_modes,
3364 .input_mux = &alc880_capture_source,
3366 [ALC880_3ST_DIG] = {
3367 .mixers = { alc880_three_stack_mixer },
3368 .init_verbs = { alc880_volume_init_verbs,
3369 alc880_pin_3stack_init_verbs },
3370 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3371 .dac_nids = alc880_dac_nids,
3372 .dig_out_nid = ALC880_DIGOUT_NID,
3373 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3374 .channel_mode = alc880_threestack_modes,
3376 .input_mux = &alc880_capture_source,
3378 [ALC880_TCL_S700] = {
3379 .mixers = { alc880_tcl_s700_mixer },
3380 .init_verbs = { alc880_volume_init_verbs,
3381 alc880_pin_tcl_S700_init_verbs,
3382 alc880_gpio2_init_verbs },
3383 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3384 .dac_nids = alc880_dac_nids,
3385 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3386 .num_adc_nids = 1, /* single ADC */
3388 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3389 .channel_mode = alc880_2_jack_modes,
3390 .input_mux = &alc880_capture_source,
3393 .mixers = { alc880_three_stack_mixer,
3394 alc880_five_stack_mixer},
3395 .init_verbs = { alc880_volume_init_verbs,
3396 alc880_pin_5stack_init_verbs },
3397 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3398 .dac_nids = alc880_dac_nids,
3399 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3400 .channel_mode = alc880_fivestack_modes,
3401 .input_mux = &alc880_capture_source,
3403 [ALC880_5ST_DIG] = {
3404 .mixers = { alc880_three_stack_mixer,
3405 alc880_five_stack_mixer },
3406 .init_verbs = { alc880_volume_init_verbs,
3407 alc880_pin_5stack_init_verbs },
3408 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3409 .dac_nids = alc880_dac_nids,
3410 .dig_out_nid = ALC880_DIGOUT_NID,
3411 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3412 .channel_mode = alc880_fivestack_modes,
3413 .input_mux = &alc880_capture_source,
3416 .mixers = { alc880_six_stack_mixer },
3417 .init_verbs = { alc880_volume_init_verbs,
3418 alc880_pin_6stack_init_verbs },
3419 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3420 .dac_nids = alc880_6st_dac_nids,
3421 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3422 .channel_mode = alc880_sixstack_modes,
3423 .input_mux = &alc880_6stack_capture_source,
3425 [ALC880_6ST_DIG] = {
3426 .mixers = { alc880_six_stack_mixer },
3427 .init_verbs = { alc880_volume_init_verbs,
3428 alc880_pin_6stack_init_verbs },
3429 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3430 .dac_nids = alc880_6st_dac_nids,
3431 .dig_out_nid = ALC880_DIGOUT_NID,
3432 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3433 .channel_mode = alc880_sixstack_modes,
3434 .input_mux = &alc880_6stack_capture_source,
3437 .mixers = { alc880_w810_base_mixer },
3438 .init_verbs = { alc880_volume_init_verbs,
3439 alc880_pin_w810_init_verbs,
3440 alc880_gpio2_init_verbs },
3441 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3442 .dac_nids = alc880_w810_dac_nids,
3443 .dig_out_nid = ALC880_DIGOUT_NID,
3444 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3445 .channel_mode = alc880_w810_modes,
3446 .input_mux = &alc880_capture_source,
3449 .mixers = { alc880_z71v_mixer },
3450 .init_verbs = { alc880_volume_init_verbs,
3451 alc880_pin_z71v_init_verbs },
3452 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3453 .dac_nids = alc880_z71v_dac_nids,
3454 .dig_out_nid = ALC880_DIGOUT_NID,
3456 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3457 .channel_mode = alc880_2_jack_modes,
3458 .input_mux = &alc880_capture_source,
3461 .mixers = { alc880_f1734_mixer },
3462 .init_verbs = { alc880_volume_init_verbs,
3463 alc880_pin_f1734_init_verbs },
3464 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3465 .dac_nids = alc880_f1734_dac_nids,
3467 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3468 .channel_mode = alc880_2_jack_modes,
3469 .input_mux = &alc880_f1734_capture_source,
3470 .unsol_event = alc880_uniwill_p53_unsol_event,
3471 .init_hook = alc880_uniwill_p53_hp_automute,
3474 .mixers = { alc880_asus_mixer },
3475 .init_verbs = { alc880_volume_init_verbs,
3476 alc880_pin_asus_init_verbs,
3477 alc880_gpio1_init_verbs },
3478 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3479 .dac_nids = alc880_asus_dac_nids,
3480 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3481 .channel_mode = alc880_asus_modes,
3483 .input_mux = &alc880_capture_source,
3485 [ALC880_ASUS_DIG] = {
3486 .mixers = { alc880_asus_mixer },
3487 .init_verbs = { alc880_volume_init_verbs,
3488 alc880_pin_asus_init_verbs,
3489 alc880_gpio1_init_verbs },
3490 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3491 .dac_nids = alc880_asus_dac_nids,
3492 .dig_out_nid = ALC880_DIGOUT_NID,
3493 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3494 .channel_mode = alc880_asus_modes,
3496 .input_mux = &alc880_capture_source,
3498 [ALC880_ASUS_DIG2] = {
3499 .mixers = { alc880_asus_mixer },
3500 .init_verbs = { alc880_volume_init_verbs,
3501 alc880_pin_asus_init_verbs,
3502 alc880_gpio2_init_verbs }, /* use GPIO2 */
3503 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3504 .dac_nids = alc880_asus_dac_nids,
3505 .dig_out_nid = ALC880_DIGOUT_NID,
3506 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3507 .channel_mode = alc880_asus_modes,
3509 .input_mux = &alc880_capture_source,
3511 [ALC880_ASUS_W1V] = {
3512 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3513 .init_verbs = { alc880_volume_init_verbs,
3514 alc880_pin_asus_init_verbs,
3515 alc880_gpio1_init_verbs },
3516 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3517 .dac_nids = alc880_asus_dac_nids,
3518 .dig_out_nid = ALC880_DIGOUT_NID,
3519 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3520 .channel_mode = alc880_asus_modes,
3522 .input_mux = &alc880_capture_source,
3524 [ALC880_UNIWILL_DIG] = {
3525 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3526 .init_verbs = { alc880_volume_init_verbs,
3527 alc880_pin_asus_init_verbs },
3528 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3529 .dac_nids = alc880_asus_dac_nids,
3530 .dig_out_nid = ALC880_DIGOUT_NID,
3531 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3532 .channel_mode = alc880_asus_modes,
3534 .input_mux = &alc880_capture_source,
3536 [ALC880_UNIWILL] = {
3537 .mixers = { alc880_uniwill_mixer },
3538 .init_verbs = { alc880_volume_init_verbs,
3539 alc880_uniwill_init_verbs },
3540 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3541 .dac_nids = alc880_asus_dac_nids,
3542 .dig_out_nid = ALC880_DIGOUT_NID,
3543 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3544 .channel_mode = alc880_threestack_modes,
3546 .input_mux = &alc880_capture_source,
3547 .unsol_event = alc880_uniwill_unsol_event,
3548 .init_hook = alc880_uniwill_automute,
3550 [ALC880_UNIWILL_P53] = {
3551 .mixers = { alc880_uniwill_p53_mixer },
3552 .init_verbs = { alc880_volume_init_verbs,
3553 alc880_uniwill_p53_init_verbs },
3554 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3555 .dac_nids = alc880_asus_dac_nids,
3556 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3557 .channel_mode = alc880_threestack_modes,
3558 .input_mux = &alc880_capture_source,
3559 .unsol_event = alc880_uniwill_p53_unsol_event,
3560 .init_hook = alc880_uniwill_p53_hp_automute,
3562 [ALC880_FUJITSU] = {
3563 .mixers = { alc880_fujitsu_mixer,
3564 alc880_pcbeep_mixer, },
3565 .init_verbs = { alc880_volume_init_verbs,
3566 alc880_uniwill_p53_init_verbs,
3567 alc880_beep_init_verbs },
3568 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3569 .dac_nids = alc880_dac_nids,
3570 .dig_out_nid = ALC880_DIGOUT_NID,
3571 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3572 .channel_mode = alc880_2_jack_modes,
3573 .input_mux = &alc880_capture_source,
3574 .unsol_event = alc880_uniwill_p53_unsol_event,
3575 .init_hook = alc880_uniwill_p53_hp_automute,
3578 .mixers = { alc880_three_stack_mixer },
3579 .init_verbs = { alc880_volume_init_verbs,
3580 alc880_pin_clevo_init_verbs },
3581 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3582 .dac_nids = alc880_dac_nids,
3584 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3585 .channel_mode = alc880_threestack_modes,
3587 .input_mux = &alc880_capture_source,
3590 .mixers = { alc880_lg_mixer },
3591 .init_verbs = { alc880_volume_init_verbs,
3592 alc880_lg_init_verbs },
3593 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3594 .dac_nids = alc880_lg_dac_nids,
3595 .dig_out_nid = ALC880_DIGOUT_NID,
3596 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3597 .channel_mode = alc880_lg_ch_modes,
3599 .input_mux = &alc880_lg_capture_source,
3600 .unsol_event = alc880_lg_unsol_event,
3601 .init_hook = alc880_lg_automute,
3602 #ifdef CONFIG_SND_HDA_POWER_SAVE
3603 .loopbacks = alc880_lg_loopbacks,
3607 .mixers = { alc880_lg_lw_mixer },
3608 .init_verbs = { alc880_volume_init_verbs,
3609 alc880_lg_lw_init_verbs },
3610 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3611 .dac_nids = alc880_dac_nids,
3612 .dig_out_nid = ALC880_DIGOUT_NID,
3613 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3614 .channel_mode = alc880_lg_lw_modes,
3615 .input_mux = &alc880_lg_lw_capture_source,
3616 .unsol_event = alc880_lg_lw_unsol_event,
3617 .init_hook = alc880_lg_lw_automute,
3619 [ALC880_MEDION_RIM] = {
3620 .mixers = { alc880_medion_rim_mixer },
3621 .init_verbs = { alc880_volume_init_verbs,
3622 alc880_medion_rim_init_verbs,
3623 alc_gpio2_init_verbs },
3624 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3625 .dac_nids = alc880_dac_nids,
3626 .dig_out_nid = ALC880_DIGOUT_NID,
3627 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3628 .channel_mode = alc880_2_jack_modes,
3629 .input_mux = &alc880_medion_rim_capture_source,
3630 .unsol_event = alc880_medion_rim_unsol_event,
3631 .init_hook = alc880_medion_rim_automute,
3633 #ifdef CONFIG_SND_DEBUG
3635 .mixers = { alc880_test_mixer },
3636 .init_verbs = { alc880_test_init_verbs },
3637 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3638 .dac_nids = alc880_test_dac_nids,
3639 .dig_out_nid = ALC880_DIGOUT_NID,
3640 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3641 .channel_mode = alc880_test_modes,
3642 .input_mux = &alc880_test_capture_source,
3648 * Automatic parse of I/O pins from the BIOS configuration
3653 ALC_CTL_WIDGET_MUTE,
3656 static struct snd_kcontrol_new alc880_control_templates[] = {
3657 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3658 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3659 HDA_BIND_MUTE(NULL, 0, 0, 0),
3662 /* add dynamic controls */
3663 static int add_control(struct alc_spec *spec, int type, const char *name,
3666 struct snd_kcontrol_new *knew;
3668 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3669 knew = snd_array_new(&spec->kctls);
3672 *knew = alc880_control_templates[type];
3673 knew->name = kstrdup(name, GFP_KERNEL);
3676 knew->private_value = val;
3680 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3681 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3682 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3683 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3684 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3685 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3686 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3687 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3688 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3689 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3690 #define ALC880_PIN_CD_NID 0x1c
3692 /* fill in the dac_nids table from the parsed pin configuration */
3693 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3694 const struct auto_pin_cfg *cfg)
3700 memset(assigned, 0, sizeof(assigned));
3701 spec->multiout.dac_nids = spec->private_dac_nids;
3703 /* check the pins hardwired to audio widget */
3704 for (i = 0; i < cfg->line_outs; i++) {
3705 nid = cfg->line_out_pins[i];
3706 if (alc880_is_fixed_pin(nid)) {
3707 int idx = alc880_fixed_pin_idx(nid);
3708 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3712 /* left pins can be connect to any audio widget */
3713 for (i = 0; i < cfg->line_outs; i++) {
3714 nid = cfg->line_out_pins[i];
3715 if (alc880_is_fixed_pin(nid))
3717 /* search for an empty channel */
3718 for (j = 0; j < cfg->line_outs; j++) {
3720 spec->multiout.dac_nids[i] =
3721 alc880_idx_to_dac(j);
3727 spec->multiout.num_dacs = cfg->line_outs;
3731 /* add playback controls from the parsed DAC table */
3732 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3733 const struct auto_pin_cfg *cfg)
3736 static const char *chname[4] = {
3737 "Front", "Surround", NULL /*CLFE*/, "Side"
3742 for (i = 0; i < cfg->line_outs; i++) {
3743 if (!spec->multiout.dac_nids[i])
3745 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3748 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3749 "Center Playback Volume",
3750 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3754 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3755 "LFE Playback Volume",
3756 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3760 err = add_control(spec, ALC_CTL_BIND_MUTE,
3761 "Center Playback Switch",
3762 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3766 err = add_control(spec, ALC_CTL_BIND_MUTE,
3767 "LFE Playback Switch",
3768 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3773 sprintf(name, "%s Playback Volume", chname[i]);
3774 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3775 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3779 sprintf(name, "%s Playback Switch", chname[i]);
3780 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3781 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3790 /* add playback controls for speaker and HP outputs */
3791 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3801 if (alc880_is_fixed_pin(pin)) {
3802 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3803 /* specify the DAC as the extra output */
3804 if (!spec->multiout.hp_nid)
3805 spec->multiout.hp_nid = nid;
3807 spec->multiout.extra_out_nid[0] = nid;
3808 /* control HP volume/switch on the output mixer amp */
3809 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3810 sprintf(name, "%s Playback Volume", pfx);
3811 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3812 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3815 sprintf(name, "%s Playback Switch", pfx);
3816 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3817 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3820 } else if (alc880_is_multi_pin(pin)) {
3821 /* set manual connection */
3822 /* we have only a switch on HP-out PIN */
3823 sprintf(name, "%s Playback Switch", pfx);
3824 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3825 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3832 /* create input playback/capture controls for the given pin */
3833 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3834 const char *ctlname,
3835 int idx, hda_nid_t mix_nid)
3840 sprintf(name, "%s Playback Volume", ctlname);
3841 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3842 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3845 sprintf(name, "%s Playback Switch", ctlname);
3846 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3847 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3853 /* create playback/capture controls for input pins */
3854 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3855 const struct auto_pin_cfg *cfg)
3857 struct hda_input_mux *imux = &spec->private_imux;
3860 for (i = 0; i < AUTO_PIN_LAST; i++) {
3861 if (alc880_is_input_pin(cfg->input_pins[i])) {
3862 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3863 err = new_analog_input(spec, cfg->input_pins[i],
3864 auto_pin_cfg_labels[i],
3868 imux->items[imux->num_items].label =
3869 auto_pin_cfg_labels[i];
3870 imux->items[imux->num_items].index =
3871 alc880_input_pin_idx(cfg->input_pins[i]);
3878 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3879 unsigned int pin_type)
3881 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3884 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3888 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3889 hda_nid_t nid, int pin_type,
3892 alc_set_pin_output(codec, nid, pin_type);
3893 /* need the manual connection? */
3894 if (alc880_is_multi_pin(nid)) {
3895 struct alc_spec *spec = codec->spec;
3896 int idx = alc880_multi_pin_idx(nid);
3897 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3898 AC_VERB_SET_CONNECT_SEL,
3899 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3903 static int get_pin_type(int line_out_type)
3905 if (line_out_type == AUTO_PIN_HP_OUT)
3911 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3913 struct alc_spec *spec = codec->spec;
3916 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3917 for (i = 0; i < spec->autocfg.line_outs; i++) {
3918 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3919 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3920 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3924 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3926 struct alc_spec *spec = codec->spec;
3929 pin = spec->autocfg.speaker_pins[0];
3930 if (pin) /* connect to front */
3931 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3932 pin = spec->autocfg.hp_pins[0];
3933 if (pin) /* connect to front */
3934 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3937 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3939 struct alc_spec *spec = codec->spec;
3942 for (i = 0; i < AUTO_PIN_LAST; i++) {
3943 hda_nid_t nid = spec->autocfg.input_pins[i];
3944 if (alc880_is_input_pin(nid)) {
3945 snd_hda_codec_write(codec, nid, 0,
3946 AC_VERB_SET_PIN_WIDGET_CONTROL,
3947 i <= AUTO_PIN_FRONT_MIC ?
3948 PIN_VREF80 : PIN_IN);
3949 if (nid != ALC880_PIN_CD_NID)
3950 snd_hda_codec_write(codec, nid, 0,
3951 AC_VERB_SET_AMP_GAIN_MUTE,
3957 /* parse the BIOS configuration and set up the alc_spec */
3958 /* return 1 if successful, 0 if the proper config is not found,
3959 * or a negative error code
3961 static int alc880_parse_auto_config(struct hda_codec *codec)
3963 struct alc_spec *spec = codec->spec;
3965 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3967 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3971 if (!spec->autocfg.line_outs)
3972 return 0; /* can't find valid BIOS pin config */
3974 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3977 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3980 err = alc880_auto_create_extra_out(spec,
3981 spec->autocfg.speaker_pins[0],
3985 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3989 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3993 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3995 if (spec->autocfg.dig_out_pin)
3996 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3997 if (spec->autocfg.dig_in_pin)
3998 spec->dig_in_nid = ALC880_DIGIN_NID;
4000 if (spec->kctls.list)
4001 add_mixer(spec, spec->kctls.list);
4003 add_verb(spec, alc880_volume_init_verbs);
4005 spec->num_mux_defs = 1;
4006 spec->input_mux = &spec->private_imux;
4008 store_pin_configs(codec);
4012 /* additional initialization for auto-configuration model */
4013 static void alc880_auto_init(struct hda_codec *codec)
4015 struct alc_spec *spec = codec->spec;
4016 alc880_auto_init_multi_out(codec);
4017 alc880_auto_init_extra_out(codec);
4018 alc880_auto_init_analog_input(codec);
4019 if (spec->unsol_event)
4020 alc_inithook(codec);
4024 * OK, here we have finally the patch for ALC880
4027 static void set_capture_mixer(struct alc_spec *spec)
4029 static struct snd_kcontrol_new *caps[3] = {
4034 if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3)
4035 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4038 static int patch_alc880(struct hda_codec *codec)
4040 struct alc_spec *spec;
4044 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4050 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4053 if (board_config < 0) {
4054 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4055 "trying auto-probe from BIOS...\n");
4056 board_config = ALC880_AUTO;
4059 if (board_config == ALC880_AUTO) {
4060 /* automatic parse from the BIOS config */
4061 err = alc880_parse_auto_config(codec);
4067 "hda_codec: Cannot set up configuration "
4068 "from BIOS. Using 3-stack mode...\n");
4069 board_config = ALC880_3ST;
4073 if (board_config != ALC880_AUTO)
4074 setup_preset(spec, &alc880_presets[board_config]);
4076 spec->stream_name_analog = "ALC880 Analog";
4077 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4078 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4079 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4081 spec->stream_name_digital = "ALC880 Digital";
4082 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4083 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4085 if (!spec->adc_nids && spec->input_mux) {
4086 /* check whether NID 0x07 is valid */
4087 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4089 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4090 if (wcap != AC_WID_AUD_IN) {
4091 spec->adc_nids = alc880_adc_nids_alt;
4092 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4094 spec->adc_nids = alc880_adc_nids;
4095 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4098 set_capture_mixer(spec);
4100 spec->vmaster_nid = 0x0c;
4102 codec->patch_ops = alc_patch_ops;
4103 if (board_config == ALC880_AUTO)
4104 spec->init_hook = alc880_auto_init;
4105 #ifdef CONFIG_SND_HDA_POWER_SAVE
4106 if (!spec->loopback.amplist)
4107 spec->loopback.amplist = alc880_loopbacks;
4118 static hda_nid_t alc260_dac_nids[1] = {
4123 static hda_nid_t alc260_adc_nids[1] = {
4128 static hda_nid_t alc260_adc_nids_alt[1] = {
4133 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4134 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4136 static hda_nid_t alc260_dual_adc_nids[2] = {
4141 #define ALC260_DIGOUT_NID 0x03
4142 #define ALC260_DIGIN_NID 0x06
4144 static struct hda_input_mux alc260_capture_source = {
4148 { "Front Mic", 0x1 },
4154 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4155 * headphone jack and the internal CD lines since these are the only pins at
4156 * which audio can appear. For flexibility, also allow the option of
4157 * recording the mixer output on the second ADC (ADC0 doesn't have a
4158 * connection to the mixer output).
4160 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4164 { "Mic/Line", 0x0 },
4166 { "Headphone", 0x2 },
4172 { "Mic/Line", 0x0 },
4174 { "Headphone", 0x2 },
4181 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4182 * the Fujitsu S702x, but jacks are marked differently.
4184 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4191 { "Headphone", 0x5 },
4200 { "Headphone", 0x6 },
4206 * This is just place-holder, so there's something for alc_build_pcms to look
4207 * at when it calculates the maximum number of channels. ALC260 has no mixer
4208 * element which allows changing the channel mode, so the verb list is
4211 static struct hda_channel_mode alc260_modes[1] = {
4216 /* Mixer combinations
4218 * basic: base_output + input + pc_beep + capture
4219 * HP: base_output + input + capture_alt
4220 * HP_3013: hp_3013 + input + capture
4221 * fujitsu: fujitsu + capture
4222 * acer: acer + capture
4225 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4226 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4227 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4228 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4229 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4230 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4231 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4235 static struct snd_kcontrol_new alc260_input_mixer[] = {
4236 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4237 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4238 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4239 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4241 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4242 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4243 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4247 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4248 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4249 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4253 /* update HP, line and mono out pins according to the master switch */
4254 static void alc260_hp_master_update(struct hda_codec *codec,
4255 hda_nid_t hp, hda_nid_t line,
4258 struct alc_spec *spec = codec->spec;
4259 unsigned int val = spec->master_sw ? PIN_HP : 0;
4260 /* change HP and line-out pins */
4261 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4263 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4265 /* mono (speaker) depending on the HP jack sense */
4266 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4267 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4271 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4272 struct snd_ctl_elem_value *ucontrol)
4274 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4275 struct alc_spec *spec = codec->spec;
4276 *ucontrol->value.integer.value = spec->master_sw;
4280 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4281 struct snd_ctl_elem_value *ucontrol)
4283 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4284 struct alc_spec *spec = codec->spec;
4285 int val = !!*ucontrol->value.integer.value;
4286 hda_nid_t hp, line, mono;
4288 if (val == spec->master_sw)
4290 spec->master_sw = val;
4291 hp = (kcontrol->private_value >> 16) & 0xff;
4292 line = (kcontrol->private_value >> 8) & 0xff;
4293 mono = kcontrol->private_value & 0xff;
4294 alc260_hp_master_update(codec, hp, line, mono);
4298 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4300 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4301 .name = "Master Playback Switch",
4302 .info = snd_ctl_boolean_mono_info,
4303 .get = alc260_hp_master_sw_get,
4304 .put = alc260_hp_master_sw_put,
4305 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4307 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4308 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4309 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4310 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4311 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4313 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4317 static struct hda_verb alc260_hp_unsol_verbs[] = {
4318 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4322 static void alc260_hp_automute(struct hda_codec *codec)
4324 struct alc_spec *spec = codec->spec;
4325 unsigned int present;
4327 present = snd_hda_codec_read(codec, 0x10, 0,
4328 AC_VERB_GET_PIN_SENSE, 0);
4329 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4330 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4333 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4335 if ((res >> 26) == ALC880_HP_EVENT)
4336 alc260_hp_automute(codec);
4339 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4341 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4342 .name = "Master Playback Switch",
4343 .info = snd_ctl_boolean_mono_info,
4344 .get = alc260_hp_master_sw_get,
4345 .put = alc260_hp_master_sw_put,
4346 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4348 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4349 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4350 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4351 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4352 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4353 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4354 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4355 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4359 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4360 .ops = &snd_hda_bind_vol,
4362 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4363 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4364 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4369 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4370 .ops = &snd_hda_bind_sw,
4372 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4373 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4378 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4379 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4380 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4381 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4382 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4386 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4387 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4391 static void alc260_hp_3013_automute(struct hda_codec *codec)
4393 struct alc_spec *spec = codec->spec;
4394 unsigned int present;
4396 present = snd_hda_codec_read(codec, 0x15, 0,
4397 AC_VERB_GET_PIN_SENSE, 0);
4398 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4399 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4402 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4405 if ((res >> 26) == ALC880_HP_EVENT)
4406 alc260_hp_3013_automute(codec);
4409 static void alc260_hp_3012_automute(struct hda_codec *codec)
4411 unsigned int present, bits;
4413 present = snd_hda_codec_read(codec, 0x10, 0,
4414 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4416 bits = present ? 0 : PIN_OUT;
4417 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4419 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4421 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4425 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4428 if ((res >> 26) == ALC880_HP_EVENT)
4429 alc260_hp_3012_automute(codec);
4432 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4433 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4435 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4436 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4437 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4438 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4439 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4440 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4441 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4442 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4443 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4444 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4445 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4446 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4447 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4451 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4452 * versions of the ALC260 don't act on requests to enable mic bias from NID
4453 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4454 * datasheet doesn't mention this restriction. At this stage it's not clear
4455 * whether this behaviour is intentional or is a hardware bug in chip
4456 * revisions available in early 2006. Therefore for now allow the
4457 * "Headphone Jack Mode" control to span all choices, but if it turns out
4458 * that the lack of mic bias for this NID is intentional we could change the
4459 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4461 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4462 * don't appear to make the mic bias available from the "line" jack, even
4463 * though the NID used for this jack (0x14) can supply it. The theory is
4464 * that perhaps Acer have included blocking capacitors between the ALC260
4465 * and the output jack. If this turns out to be the case for all such
4466 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4467 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4469 * The C20x Tablet series have a mono internal speaker which is controlled
4470 * via the chip's Mono sum widget and pin complex, so include the necessary
4471 * controls for such models. On models without a "mono speaker" the control
4472 * won't do anything.
4474 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4475 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4476 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4477 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4478 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4480 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4482 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4483 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4485 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4486 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4487 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4488 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4489 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4490 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4491 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4495 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4496 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4498 static struct snd_kcontrol_new alc260_will_mixer[] = {
4499 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4500 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4502 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4503 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4504 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4505 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4506 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4507 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4508 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4509 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4510 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4514 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4515 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4517 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4518 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4519 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4521 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4522 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4523 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4524 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4525 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4526 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4527 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4532 * initialization verbs
4534 static struct hda_verb alc260_init_verbs[] = {
4535 /* Line In pin widget for input */
4536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4537 /* CD pin widget for input */
4538 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4539 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4540 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4541 /* Mic2 (front panel) pin widget for input and vref at 80% */
4542 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4543 /* LINE-2 is used for line-out in rear */
4544 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4545 /* select line-out */
4546 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4548 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4550 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4552 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4553 /* mute capture amp left and right */
4554 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4555 /* set connection select to line in (default select for this ADC) */
4556 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4557 /* mute capture amp left and right */
4558 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4559 /* set connection select to line in (default select for this ADC) */
4560 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4561 /* set vol=0 Line-Out mixer amp left and right */
4562 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4563 /* unmute pin widget amp left and right (no gain on this amp) */
4564 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4565 /* set vol=0 HP mixer amp left and right */
4566 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4567 /* unmute pin widget amp left and right (no gain on this amp) */
4568 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4569 /* set vol=0 Mono mixer amp left and right */
4570 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4571 /* unmute pin widget amp left and right (no gain on this amp) */
4572 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4573 /* unmute LINE-2 out pin */
4574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4575 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4578 /* mute analog inputs */
4579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4583 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4584 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4585 /* mute Front out path */
4586 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4587 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4588 /* mute Headphone out path */
4589 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4590 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4591 /* mute Mono out path */
4592 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4593 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4597 #if 0 /* should be identical with alc260_init_verbs? */
4598 static struct hda_verb alc260_hp_init_verbs[] = {
4599 /* Headphone and output */
4600 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4602 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4603 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4604 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4605 /* Mic2 (front panel) pin widget for input and vref at 80% */
4606 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4607 /* Line In pin widget for input */
4608 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4609 /* Line-2 pin widget for output */
4610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4611 /* CD pin widget for input */
4612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4613 /* unmute amp left and right */
4614 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4615 /* set connection select to line in (default select for this ADC) */
4616 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4617 /* unmute Line-Out mixer amp left and right (volume = 0) */
4618 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4619 /* mute pin widget amp left and right (no gain on this amp) */
4620 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4621 /* unmute HP mixer amp left and right (volume = 0) */
4622 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4623 /* mute pin widget amp left and right (no gain on this amp) */
4624 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4625 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4628 /* mute analog inputs */
4629 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4630 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4634 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4635 /* Unmute Front out path */
4636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4637 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4638 /* Unmute Headphone out path */
4639 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4640 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4641 /* Unmute Mono out path */
4642 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4643 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4648 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4649 /* Line out and output */
4650 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4652 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4653 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4654 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4655 /* Mic2 (front panel) pin widget for input and vref at 80% */
4656 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4657 /* Line In pin widget for input */
4658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4659 /* Headphone pin widget for output */
4660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4661 /* CD pin widget for input */
4662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4663 /* unmute amp left and right */
4664 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4665 /* set connection select to line in (default select for this ADC) */
4666 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4667 /* unmute Line-Out mixer amp left and right (volume = 0) */
4668 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4669 /* mute pin widget amp left and right (no gain on this amp) */
4670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4671 /* unmute HP mixer amp left and right (volume = 0) */
4672 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4673 /* mute pin widget amp left and right (no gain on this amp) */
4674 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4675 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4678 /* mute analog inputs */
4679 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4680 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4681 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4682 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4683 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4684 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4685 /* Unmute Front out path */
4686 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4687 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4688 /* Unmute Headphone out path */
4689 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4690 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4691 /* Unmute Mono out path */
4692 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4693 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4697 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4698 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4699 * audio = 0x16, internal speaker = 0x10.
4701 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4702 /* Disable all GPIOs */
4703 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4704 /* Internal speaker is connected to headphone pin */
4705 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4706 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4708 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4709 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4710 /* Ensure all other unused pins are disabled and muted. */
4711 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4712 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4713 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4714 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4715 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4716 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4717 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4720 /* Disable digital (SPDIF) pins */
4721 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4722 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4724 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4725 * when acting as an output.
4727 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4729 /* Start with output sum widgets muted and their output gains at min */
4730 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4731 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4733 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4735 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4736 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4737 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4738 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4740 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4741 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4742 /* Unmute Line1 pin widget output buffer since it starts as an output.
4743 * If the pin mode is changed by the user the pin mode control will
4744 * take care of enabling the pin's input/output buffers as needed.
4745 * Therefore there's no need to enable the input buffer at this
4748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4749 /* Unmute input buffer of pin widget used for Line-in (no equiv
4752 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4754 /* Mute capture amp left and right */
4755 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4756 /* Set ADC connection select to match default mixer setting - line
4759 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4761 /* Do the same for the second ADC: mute capture input amp and
4762 * set ADC connection to line in (on mic1 pin)
4764 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4765 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4767 /* Mute all inputs to mixer widget (even unconnected ones) */
4768 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4769 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4770 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4771 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4774 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4775 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4780 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4781 * similar laptops (adapted from Fujitsu init verbs).
4783 static struct hda_verb alc260_acer_init_verbs[] = {
4784 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4785 * the headphone jack. Turn this on and rely on the standard mute
4786 * methods whenever the user wants to turn these outputs off.
4788 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4789 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4790 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4791 /* Internal speaker/Headphone jack is connected to Line-out pin */
4792 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4793 /* Internal microphone/Mic jack is connected to Mic1 pin */
4794 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4795 /* Line In jack is connected to Line1 pin */
4796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4797 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4798 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4799 /* Ensure all other unused pins are disabled and muted. */
4800 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4801 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4802 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4803 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4806 /* Disable digital (SPDIF) pins */
4807 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4808 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4810 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4811 * bus when acting as outputs.
4813 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4814 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4816 /* Start with output sum widgets muted and their output gains at min */
4817 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4818 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4819 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4820 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4821 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4822 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4823 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4824 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4825 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4827 /* Unmute Line-out pin widget amp left and right
4828 * (no equiv mixer ctrl)
4830 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4831 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4832 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4833 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4834 * inputs. If the pin mode is changed by the user the pin mode control
4835 * will take care of enabling the pin's input/output buffers as needed.
4836 * Therefore there's no need to enable the input buffer at this
4839 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4840 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4842 /* Mute capture amp left and right */
4843 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4844 /* Set ADC connection select to match default mixer setting - mic
4847 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4849 /* Do similar with the second ADC: mute capture input amp and
4850 * set ADC connection to mic to match ALSA's default state.
4852 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4853 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4855 /* Mute all inputs to mixer widget (even unconnected ones) */
4856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4868 static struct hda_verb alc260_will_verbs[] = {
4869 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4870 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4871 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4872 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4873 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4874 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4878 static struct hda_verb alc260_replacer_672v_verbs[] = {
4879 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4880 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4881 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4883 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4884 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4885 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4887 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4891 /* toggle speaker-output according to the hp-jack state */
4892 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4894 unsigned int present;
4896 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4897 present = snd_hda_codec_read(codec, 0x0f, 0,
4898 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4900 snd_hda_codec_write_cache(codec, 0x01, 0,
4901 AC_VERB_SET_GPIO_DATA, 1);
4902 snd_hda_codec_write_cache(codec, 0x0f, 0,
4903 AC_VERB_SET_PIN_WIDGET_CONTROL,
4906 snd_hda_codec_write_cache(codec, 0x01, 0,
4907 AC_VERB_SET_GPIO_DATA, 0);
4908 snd_hda_codec_write_cache(codec, 0x0f, 0,
4909 AC_VERB_SET_PIN_WIDGET_CONTROL,
4914 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4917 if ((res >> 26) == ALC880_HP_EVENT)
4918 alc260_replacer_672v_automute(codec);
4921 static struct hda_verb alc260_hp_dc7600_verbs[] = {
4922 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4923 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4924 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4925 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4926 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4928 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4929 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4930 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4931 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4935 /* Test configuration for debugging, modelled after the ALC880 test
4938 #ifdef CONFIG_SND_DEBUG
4939 static hda_nid_t alc260_test_dac_nids[1] = {
4942 static hda_nid_t alc260_test_adc_nids[2] = {
4945 /* For testing the ALC260, each input MUX needs its own definition since
4946 * the signal assignments are different. This assumes that the first ADC
4949 static struct hda_input_mux alc260_test_capture_sources[2] = {
4953 { "MIC1 pin", 0x0 },
4954 { "MIC2 pin", 0x1 },
4955 { "LINE1 pin", 0x2 },
4956 { "LINE2 pin", 0x3 },
4958 { "LINE-OUT pin", 0x5 },
4959 { "HP-OUT pin", 0x6 },
4965 { "MIC1 pin", 0x0 },
4966 { "MIC2 pin", 0x1 },
4967 { "LINE1 pin", 0x2 },
4968 { "LINE2 pin", 0x3 },
4971 { "LINE-OUT pin", 0x6 },
4972 { "HP-OUT pin", 0x7 },
4976 static struct snd_kcontrol_new alc260_test_mixer[] = {
4977 /* Output driver widgets */
4978 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4979 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4980 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4981 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4982 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4983 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4985 /* Modes for retasking pin widgets
4986 * Note: the ALC260 doesn't seem to act on requests to enable mic
4987 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4988 * mention this restriction. At this stage it's not clear whether
4989 * this behaviour is intentional or is a hardware bug in chip
4990 * revisions available at least up until early 2006. Therefore for
4991 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4992 * choices, but if it turns out that the lack of mic bias for these
4993 * NIDs is intentional we could change their modes from
4994 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4996 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4997 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4998 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4999 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5000 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5001 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5003 /* Loopback mixer controls */
5004 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5005 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5006 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5007 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5008 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5009 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5010 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5011 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5012 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5013 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5014 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5015 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5016 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5017 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5018 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5019 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5021 /* Controls for GPIO pins, assuming they are configured as outputs */
5022 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5023 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5024 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5025 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5027 /* Switches to allow the digital IO pins to be enabled. The datasheet
5028 * is ambigious as to which NID is which; testing on laptops which
5029 * make this output available should provide clarification.
5031 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5032 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5034 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5035 * this output to turn on an external amplifier.
5037 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5038 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5042 static struct hda_verb alc260_test_init_verbs[] = {
5043 /* Enable all GPIOs as outputs with an initial value of 0 */
5044 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5045 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5046 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5048 /* Enable retasking pins as output, initially without power amp */
5049 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5050 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5051 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5052 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5053 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5054 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5056 /* Disable digital (SPDIF) pins initially, but users can enable
5057 * them via a mixer switch. In the case of SPDIF-out, this initverb
5058 * payload also sets the generation to 0, output to be in "consumer"
5059 * PCM format, copyright asserted, no pre-emphasis and no validity
5062 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5063 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5065 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5066 * OUT1 sum bus when acting as an output.
5068 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5069 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5070 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5071 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5073 /* Start with output sum widgets muted and their output gains at min */
5074 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5075 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5076 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5077 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5078 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5080 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5081 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5082 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5084 /* Unmute retasking pin widget output buffers since the default
5085 * state appears to be output. As the pin mode is changed by the
5086 * user the pin mode control will take care of enabling the pin's
5087 * input/output buffers as needed.
5089 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5092 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5093 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5094 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5095 /* Also unmute the mono-out pin widget */
5096 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5098 /* Mute capture amp left and right */
5099 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5100 /* Set ADC connection select to match default mixer setting (mic1
5103 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5105 /* Do the same for the second ADC: mute capture input amp and
5106 * set ADC connection to mic1 pin
5108 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5109 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5111 /* Mute all inputs to mixer widget (even unconnected ones) */
5112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5125 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5126 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5128 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5129 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5132 * for BIOS auto-configuration
5135 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5136 const char *pfx, int *vol_bits)
5139 unsigned long vol_val, sw_val;
5143 if (nid >= 0x0f && nid < 0x11) {
5144 nid_vol = nid - 0x7;
5145 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5146 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5147 } else if (nid == 0x11) {
5148 nid_vol = nid - 0x7;
5149 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5150 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5151 } else if (nid >= 0x12 && nid <= 0x15) {
5153 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5154 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5158 if (!(*vol_bits & (1 << nid_vol))) {
5159 /* first control for the volume widget */
5160 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5161 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5164 *vol_bits |= (1 << nid_vol);
5166 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5167 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5173 /* add playback controls from the parsed DAC table */
5174 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5175 const struct auto_pin_cfg *cfg)
5181 spec->multiout.num_dacs = 1;
5182 spec->multiout.dac_nids = spec->private_dac_nids;
5183 spec->multiout.dac_nids[0] = 0x02;
5185 nid = cfg->line_out_pins[0];
5187 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5192 nid = cfg->speaker_pins[0];
5194 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5199 nid = cfg->hp_pins[0];
5201 err = alc260_add_playback_controls(spec, nid, "Headphone",
5209 /* create playback/capture controls for input pins */
5210 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5211 const struct auto_pin_cfg *cfg)
5213 struct hda_input_mux *imux = &spec->private_imux;
5216 for (i = 0; i < AUTO_PIN_LAST; i++) {
5217 if (cfg->input_pins[i] >= 0x12) {
5218 idx = cfg->input_pins[i] - 0x12;
5219 err = new_analog_input(spec, cfg->input_pins[i],
5220 auto_pin_cfg_labels[i], idx,
5224 imux->items[imux->num_items].label =
5225 auto_pin_cfg_labels[i];
5226 imux->items[imux->num_items].index = idx;
5229 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5230 idx = cfg->input_pins[i] - 0x09;
5231 err = new_analog_input(spec, cfg->input_pins[i],
5232 auto_pin_cfg_labels[i], idx,
5236 imux->items[imux->num_items].label =
5237 auto_pin_cfg_labels[i];
5238 imux->items[imux->num_items].index = idx;
5245 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5246 hda_nid_t nid, int pin_type,
5249 alc_set_pin_output(codec, nid, pin_type);
5250 /* need the manual connection? */
5252 int idx = nid - 0x12;
5253 snd_hda_codec_write(codec, idx + 0x0b, 0,
5254 AC_VERB_SET_CONNECT_SEL, sel_idx);
5258 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5260 struct alc_spec *spec = codec->spec;
5263 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5264 nid = spec->autocfg.line_out_pins[0];
5266 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5267 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5270 nid = spec->autocfg.speaker_pins[0];
5272 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5274 nid = spec->autocfg.hp_pins[0];
5276 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5279 #define ALC260_PIN_CD_NID 0x16
5280 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5282 struct alc_spec *spec = codec->spec;
5285 for (i = 0; i < AUTO_PIN_LAST; i++) {
5286 hda_nid_t nid = spec->autocfg.input_pins[i];
5288 snd_hda_codec_write(codec, nid, 0,
5289 AC_VERB_SET_PIN_WIDGET_CONTROL,
5290 i <= AUTO_PIN_FRONT_MIC ?
5291 PIN_VREF80 : PIN_IN);
5292 if (nid != ALC260_PIN_CD_NID)
5293 snd_hda_codec_write(codec, nid, 0,
5294 AC_VERB_SET_AMP_GAIN_MUTE,
5301 * generic initialization of ADC, input mixers and output mixers
5303 static struct hda_verb alc260_volume_init_verbs[] = {
5305 * Unmute ADC0-1 and set the default input to mic-in
5307 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5308 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5309 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5310 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5312 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5314 * Note: PASD motherboards uses the Line In 2 as the input for
5315 * front panel mic (mic 2)
5317 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5318 /* mute analog inputs */
5319 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5320 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5321 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5322 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5326 * Set up output mixers (0x08 - 0x0a)
5328 /* set vol=0 to output mixers */
5329 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5331 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5332 /* set up input amps for analog loopback */
5333 /* Amp Indices: DAC = 0, mixer = 1 */
5334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5336 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5337 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5338 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5339 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5344 static int alc260_parse_auto_config(struct hda_codec *codec)
5346 struct alc_spec *spec = codec->spec;
5348 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5350 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5354 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5357 if (!spec->kctls.list)
5358 return 0; /* can't find valid BIOS pin config */
5359 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5363 spec->multiout.max_channels = 2;
5365 if (spec->autocfg.dig_out_pin)
5366 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5367 if (spec->kctls.list)
5368 add_mixer(spec, spec->kctls.list);
5370 add_verb(spec, alc260_volume_init_verbs);
5372 spec->num_mux_defs = 1;
5373 spec->input_mux = &spec->private_imux;
5375 store_pin_configs(codec);
5379 /* additional initialization for auto-configuration model */
5380 static void alc260_auto_init(struct hda_codec *codec)
5382 struct alc_spec *spec = codec->spec;
5383 alc260_auto_init_multi_out(codec);
5384 alc260_auto_init_analog_input(codec);
5385 if (spec->unsol_event)
5386 alc_inithook(codec);
5389 #ifdef CONFIG_SND_HDA_POWER_SAVE
5390 static struct hda_amp_list alc260_loopbacks[] = {
5391 { 0x07, HDA_INPUT, 0 },
5392 { 0x07, HDA_INPUT, 1 },
5393 { 0x07, HDA_INPUT, 2 },
5394 { 0x07, HDA_INPUT, 3 },
5395 { 0x07, HDA_INPUT, 4 },
5401 * ALC260 configurations
5403 static const char *alc260_models[ALC260_MODEL_LAST] = {
5404 [ALC260_BASIC] = "basic",
5406 [ALC260_HP_3013] = "hp-3013",
5407 [ALC260_HP_DC7600] = "hp-dc7600",
5408 [ALC260_FUJITSU_S702X] = "fujitsu",
5409 [ALC260_ACER] = "acer",
5410 [ALC260_WILL] = "will",
5411 [ALC260_REPLACER_672V] = "replacer",
5412 #ifdef CONFIG_SND_DEBUG
5413 [ALC260_TEST] = "test",
5415 [ALC260_AUTO] = "auto",
5418 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5419 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5420 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5421 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5422 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5423 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5424 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5425 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5426 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5427 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5428 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5429 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5430 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5431 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5432 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5433 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5434 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5435 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5436 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5440 static struct alc_config_preset alc260_presets[] = {
5442 .mixers = { alc260_base_output_mixer,
5444 alc260_pc_beep_mixer },
5445 .init_verbs = { alc260_init_verbs },
5446 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5447 .dac_nids = alc260_dac_nids,
5448 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5449 .adc_nids = alc260_adc_nids,
5450 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5451 .channel_mode = alc260_modes,
5452 .input_mux = &alc260_capture_source,
5455 .mixers = { alc260_hp_output_mixer,
5456 alc260_input_mixer },
5457 .init_verbs = { alc260_init_verbs,
5458 alc260_hp_unsol_verbs },
5459 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5460 .dac_nids = alc260_dac_nids,
5461 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5462 .adc_nids = alc260_adc_nids_alt,
5463 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5464 .channel_mode = alc260_modes,
5465 .input_mux = &alc260_capture_source,
5466 .unsol_event = alc260_hp_unsol_event,
5467 .init_hook = alc260_hp_automute,
5469 [ALC260_HP_DC7600] = {
5470 .mixers = { alc260_hp_dc7600_mixer,
5471 alc260_input_mixer },
5472 .init_verbs = { alc260_init_verbs,
5473 alc260_hp_dc7600_verbs },
5474 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5475 .dac_nids = alc260_dac_nids,
5476 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5477 .adc_nids = alc260_adc_nids_alt,
5478 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5479 .channel_mode = alc260_modes,
5480 .input_mux = &alc260_capture_source,
5481 .unsol_event = alc260_hp_3012_unsol_event,
5482 .init_hook = alc260_hp_3012_automute,
5484 [ALC260_HP_3013] = {
5485 .mixers = { alc260_hp_3013_mixer,
5486 alc260_input_mixer },
5487 .init_verbs = { alc260_hp_3013_init_verbs,
5488 alc260_hp_3013_unsol_verbs },
5489 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5490 .dac_nids = alc260_dac_nids,
5491 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5492 .adc_nids = alc260_adc_nids_alt,
5493 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5494 .channel_mode = alc260_modes,
5495 .input_mux = &alc260_capture_source,
5496 .unsol_event = alc260_hp_3013_unsol_event,
5497 .init_hook = alc260_hp_3013_automute,
5499 [ALC260_FUJITSU_S702X] = {
5500 .mixers = { alc260_fujitsu_mixer },
5501 .init_verbs = { alc260_fujitsu_init_verbs },
5502 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5503 .dac_nids = alc260_dac_nids,
5504 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5505 .adc_nids = alc260_dual_adc_nids,
5506 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5507 .channel_mode = alc260_modes,
5508 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5509 .input_mux = alc260_fujitsu_capture_sources,
5512 .mixers = { alc260_acer_mixer },
5513 .init_verbs = { alc260_acer_init_verbs },
5514 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5515 .dac_nids = alc260_dac_nids,
5516 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5517 .adc_nids = alc260_dual_adc_nids,
5518 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5519 .channel_mode = alc260_modes,
5520 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5521 .input_mux = alc260_acer_capture_sources,
5524 .mixers = { alc260_will_mixer },
5525 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5526 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5527 .dac_nids = alc260_dac_nids,
5528 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5529 .adc_nids = alc260_adc_nids,
5530 .dig_out_nid = ALC260_DIGOUT_NID,
5531 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5532 .channel_mode = alc260_modes,
5533 .input_mux = &alc260_capture_source,
5535 [ALC260_REPLACER_672V] = {
5536 .mixers = { alc260_replacer_672v_mixer },
5537 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5538 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5539 .dac_nids = alc260_dac_nids,
5540 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5541 .adc_nids = alc260_adc_nids,
5542 .dig_out_nid = ALC260_DIGOUT_NID,
5543 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5544 .channel_mode = alc260_modes,
5545 .input_mux = &alc260_capture_source,
5546 .unsol_event = alc260_replacer_672v_unsol_event,
5547 .init_hook = alc260_replacer_672v_automute,
5549 #ifdef CONFIG_SND_DEBUG
5551 .mixers = { alc260_test_mixer },
5552 .init_verbs = { alc260_test_init_verbs },
5553 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5554 .dac_nids = alc260_test_dac_nids,
5555 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5556 .adc_nids = alc260_test_adc_nids,
5557 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5558 .channel_mode = alc260_modes,
5559 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5560 .input_mux = alc260_test_capture_sources,
5565 static int patch_alc260(struct hda_codec *codec)
5567 struct alc_spec *spec;
5568 int err, board_config;
5570 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5576 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5579 if (board_config < 0) {
5580 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5581 "trying auto-probe from BIOS...\n");
5582 board_config = ALC260_AUTO;
5585 if (board_config == ALC260_AUTO) {
5586 /* automatic parse from the BIOS config */
5587 err = alc260_parse_auto_config(codec);
5593 "hda_codec: Cannot set up configuration "
5594 "from BIOS. Using base mode...\n");
5595 board_config = ALC260_BASIC;
5599 if (board_config != ALC260_AUTO)
5600 setup_preset(spec, &alc260_presets[board_config]);
5602 spec->stream_name_analog = "ALC260 Analog";
5603 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5604 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5606 spec->stream_name_digital = "ALC260 Digital";
5607 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5608 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5610 set_capture_mixer(spec);
5612 spec->vmaster_nid = 0x08;
5614 codec->patch_ops = alc_patch_ops;
5615 if (board_config == ALC260_AUTO)
5616 spec->init_hook = alc260_auto_init;
5617 #ifdef CONFIG_SND_HDA_POWER_SAVE
5618 if (!spec->loopback.amplist)
5619 spec->loopback.amplist = alc260_loopbacks;
5629 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5630 * configuration. Each pin widget can choose any input DACs and a mixer.
5631 * Each ADC is connected from a mixer of all inputs. This makes possible
5632 * 6-channel independent captures.
5634 * In addition, an independent DAC for the multi-playback (not used in this
5637 #define ALC882_DIGOUT_NID 0x06
5638 #define ALC882_DIGIN_NID 0x0a
5640 static struct hda_channel_mode alc882_ch_modes[1] = {
5644 static hda_nid_t alc882_dac_nids[4] = {
5645 /* front, rear, clfe, rear_surr */
5646 0x02, 0x03, 0x04, 0x05
5649 /* identical with ALC880 */
5650 #define alc882_adc_nids alc880_adc_nids
5651 #define alc882_adc_nids_alt alc880_adc_nids_alt
5653 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5654 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5657 /* FIXME: should be a matrix-type input source selection */
5659 static struct hda_input_mux alc882_capture_source = {
5663 { "Front Mic", 0x1 },
5671 static struct hda_verb alc882_3ST_ch2_init[] = {
5672 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5673 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5674 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5675 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5682 static struct hda_verb alc882_3ST_ch6_init[] = {
5683 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5684 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5685 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5686 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5687 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5688 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5692 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5693 { 2, alc882_3ST_ch2_init },
5694 { 6, alc882_3ST_ch6_init },
5700 static struct hda_verb alc882_sixstack_ch6_init[] = {
5701 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5702 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5703 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5704 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5711 static struct hda_verb alc882_sixstack_ch8_init[] = {
5712 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5713 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5714 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5715 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5719 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5720 { 6, alc882_sixstack_ch6_init },
5721 { 8, alc882_sixstack_ch8_init },
5725 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5731 static struct hda_verb alc885_mbp_ch2_init[] = {
5732 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5733 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5734 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5741 static struct hda_verb alc885_mbp_ch6_init[] = {
5742 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5743 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5744 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5745 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5746 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5750 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5751 { 2, alc885_mbp_ch2_init },
5752 { 6, alc885_mbp_ch6_init },
5756 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5757 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5759 static struct snd_kcontrol_new alc882_base_mixer[] = {
5760 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5761 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5762 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5763 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5764 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5765 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5766 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5767 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5768 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5769 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5770 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5771 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5772 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5773 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5774 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5776 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5777 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5778 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5779 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5780 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5781 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5782 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5786 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5787 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5788 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5789 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5790 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5791 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5792 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5793 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5794 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5795 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5799 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5800 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5801 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
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_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5809 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5810 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5814 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5815 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5816 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5818 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5819 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5820 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5821 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5822 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5823 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5824 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5825 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5827 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5831 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5832 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5834 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5835 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5836 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5837 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5838 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 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("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5844 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5847 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5851 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5852 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5853 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5855 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5856 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5860 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5862 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5863 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5867 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5870 .name = "Channel Mode",
5871 .info = alc_ch_mode_info,
5872 .get = alc_ch_mode_get,
5873 .put = alc_ch_mode_put,
5878 static struct hda_verb alc882_init_verbs[] = {
5879 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5885 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5886 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5888 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5889 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5892 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5893 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5894 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5896 /* Front Pin: output 0 (0x0c) */
5897 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5898 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5899 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5900 /* Rear Pin: output 1 (0x0d) */
5901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5902 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5903 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5904 /* CLFE Pin: output 2 (0x0e) */
5905 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5906 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5907 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5908 /* Side Pin: output 3 (0x0f) */
5909 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5910 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5911 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5912 /* Mic (rear) pin: input vref at 80% */
5913 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5914 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5915 /* Front Mic pin: input vref at 80% */
5916 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5917 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5918 /* Line In pin: input */
5919 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5920 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5921 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5922 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5923 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5924 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5925 /* CD pin widget for input */
5926 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5928 /* FIXME: use matrix-type input source selection */
5929 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5930 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5931 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5932 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5933 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5934 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5936 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5937 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5938 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5939 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5941 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5942 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5943 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5944 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5945 /* ADC1: mute amp left and right */
5946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5947 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5948 /* ADC2: mute amp left and right */
5949 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5950 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5951 /* ADC3: mute amp left and right */
5952 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5953 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5958 static struct hda_verb alc882_eapd_verbs[] = {
5959 /* change to EAPD mode */
5960 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5961 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5966 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5967 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5968 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5969 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5970 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5971 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5972 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5973 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5977 static struct hda_verb alc882_macpro_init_verbs[] = {
5978 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5980 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5981 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5982 /* Front Pin: output 0 (0x0c) */
5983 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5984 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5985 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5986 /* Front Mic pin: input vref at 80% */
5987 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5988 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5989 /* Speaker: output */
5990 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5991 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5992 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5993 /* Headphone output (output 0 - 0x0c) */
5994 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5995 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5996 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5998 /* FIXME: use matrix-type input source selection */
5999 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6000 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6002 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6003 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6004 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6008 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6009 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6015 /* ADC1: mute amp left and right */
6016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6017 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6018 /* ADC2: mute amp left and right */
6019 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6020 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6021 /* ADC3: mute amp left and right */
6022 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6023 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6028 /* Macbook Pro rev3 */
6029 static struct hda_verb alc885_mbp3_init_verbs[] = {
6030 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6031 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6033 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6035 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6036 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6037 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6038 /* Front Pin: output 0 (0x0c) */
6039 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6040 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6041 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6042 /* HP Pin: output 0 (0x0d) */
6043 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6044 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6046 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6047 /* Mic (rear) pin: input vref at 80% */
6048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6050 /* Front Mic pin: input vref at 80% */
6051 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6052 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6053 /* Line In pin: use output 1 when in LineOut mode */
6054 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6056 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6058 /* FIXME: use matrix-type input source selection */
6059 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6060 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6061 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6062 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6066 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6067 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6068 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6069 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6075 /* ADC1: mute amp left and right */
6076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6077 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6078 /* ADC2: mute amp left and right */
6079 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6080 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6081 /* ADC3: mute amp left and right */
6082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6083 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6088 /* iMac 24 mixer. */
6089 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6090 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6091 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6095 /* iMac 24 init verbs. */
6096 static struct hda_verb alc885_imac24_init_verbs[] = {
6097 /* Internal speakers: output 0 (0x0c) */
6098 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6100 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6101 /* Internal speakers: output 0 (0x0c) */
6102 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6103 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6104 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6105 /* Headphone: output 0 (0x0c) */
6106 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6108 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6109 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6110 /* Front Mic: input vref at 80% */
6111 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6112 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6116 /* Toggle speaker-output according to the hp-jack state */
6117 static void alc885_imac24_automute(struct hda_codec *codec)
6119 unsigned int present;
6121 present = snd_hda_codec_read(codec, 0x14, 0,
6122 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6123 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6124 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6125 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6126 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6129 /* Processes unsolicited events. */
6130 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6133 /* Headphone insertion or removal. */
6134 if ((res >> 26) == ALC880_HP_EVENT)
6135 alc885_imac24_automute(codec);
6138 static void alc885_mbp3_automute(struct hda_codec *codec)
6140 unsigned int present;
6142 present = snd_hda_codec_read(codec, 0x15, 0,
6143 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6144 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6145 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6146 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6147 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6150 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6153 /* Headphone insertion or removal. */
6154 if ((res >> 26) == ALC880_HP_EVENT)
6155 alc885_mbp3_automute(codec);
6159 static struct hda_verb alc882_targa_verbs[] = {
6160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6164 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6166 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6167 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6168 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6170 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6171 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6172 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6173 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6177 /* toggle speaker-output according to the hp-jack state */
6178 static void alc882_targa_automute(struct hda_codec *codec)
6180 unsigned int present;
6182 present = snd_hda_codec_read(codec, 0x14, 0,
6183 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6184 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6185 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6186 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6190 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6192 /* Looks like the unsol event is incompatible with the standard
6193 * definition. 4bit tag is placed at 26 bit!
6195 if (((res >> 26) == ALC880_HP_EVENT)) {
6196 alc882_targa_automute(codec);
6200 static struct hda_verb alc882_asus_a7j_verbs[] = {
6201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6204 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6206 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6208 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6209 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6210 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6212 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6213 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6214 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6218 static struct hda_verb alc882_asus_a7m_verbs[] = {
6219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6220 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6222 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6223 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6224 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6226 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6227 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6228 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6230 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6231 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6232 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6236 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6238 unsigned int gpiostate, gpiomask, gpiodir;
6240 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6241 AC_VERB_GET_GPIO_DATA, 0);
6244 gpiostate |= (1 << pin);
6246 gpiostate &= ~(1 << pin);
6248 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6249 AC_VERB_GET_GPIO_MASK, 0);
6250 gpiomask |= (1 << pin);
6252 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6253 AC_VERB_GET_GPIO_DIRECTION, 0);
6254 gpiodir |= (1 << pin);
6257 snd_hda_codec_write(codec, codec->afg, 0,
6258 AC_VERB_SET_GPIO_MASK, gpiomask);
6259 snd_hda_codec_write(codec, codec->afg, 0,
6260 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6264 snd_hda_codec_write(codec, codec->afg, 0,
6265 AC_VERB_SET_GPIO_DATA, gpiostate);
6268 /* set up GPIO at initialization */
6269 static void alc885_macpro_init_hook(struct hda_codec *codec)
6271 alc882_gpio_mute(codec, 0, 0);
6272 alc882_gpio_mute(codec, 1, 0);
6275 /* set up GPIO and update auto-muting at initialization */
6276 static void alc885_imac24_init_hook(struct hda_codec *codec)
6278 alc885_macpro_init_hook(codec);
6279 alc885_imac24_automute(codec);
6283 * generic initialization of ADC, input mixers and output mixers
6285 static struct hda_verb alc882_auto_init_verbs[] = {
6287 * Unmute ADC0-2 and set the default input to mic-in
6289 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6291 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6292 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6293 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6296 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6298 * Note: PASD motherboards uses the Line In 2 as the input for
6299 * front panel mic (mic 2)
6301 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6304 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6309 * Set up output mixers (0x0c - 0x0f)
6311 /* set vol=0 to output mixers */
6312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6313 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6316 /* set up input amps for analog loopback */
6317 /* Amp Indices: DAC = 0, mixer = 1 */
6318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6319 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6320 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6321 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6322 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6323 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6325 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6326 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6327 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6329 /* FIXME: use matrix-type input source selection */
6330 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6331 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6337 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6338 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6350 #ifdef CONFIG_SND_HDA_POWER_SAVE
6351 #define alc882_loopbacks alc880_loopbacks
6354 /* pcm configuration: identiacal with ALC880 */
6355 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6356 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6357 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6358 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6361 * configuration and preset
6363 static const char *alc882_models[ALC882_MODEL_LAST] = {
6364 [ALC882_3ST_DIG] = "3stack-dig",
6365 [ALC882_6ST_DIG] = "6stack-dig",
6366 [ALC882_ARIMA] = "arima",
6367 [ALC882_W2JC] = "w2jc",
6368 [ALC882_TARGA] = "targa",
6369 [ALC882_ASUS_A7J] = "asus-a7j",
6370 [ALC882_ASUS_A7M] = "asus-a7m",
6371 [ALC885_MACPRO] = "macpro",
6372 [ALC885_MBP3] = "mbp3",
6373 [ALC885_IMAC24] = "imac24",
6374 [ALC882_AUTO] = "auto",
6377 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6378 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6379 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6380 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6381 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6382 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6383 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6384 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6385 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6386 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6387 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6388 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6389 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6393 static struct alc_config_preset alc882_presets[] = {
6394 [ALC882_3ST_DIG] = {
6395 .mixers = { alc882_base_mixer },
6396 .init_verbs = { alc882_init_verbs },
6397 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6398 .dac_nids = alc882_dac_nids,
6399 .dig_out_nid = ALC882_DIGOUT_NID,
6400 .dig_in_nid = ALC882_DIGIN_NID,
6401 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6402 .channel_mode = alc882_ch_modes,
6404 .input_mux = &alc882_capture_source,
6406 [ALC882_6ST_DIG] = {
6407 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6408 .init_verbs = { alc882_init_verbs },
6409 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6410 .dac_nids = alc882_dac_nids,
6411 .dig_out_nid = ALC882_DIGOUT_NID,
6412 .dig_in_nid = ALC882_DIGIN_NID,
6413 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6414 .channel_mode = alc882_sixstack_modes,
6415 .input_mux = &alc882_capture_source,
6418 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6419 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6420 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6421 .dac_nids = alc882_dac_nids,
6422 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6423 .channel_mode = alc882_sixstack_modes,
6424 .input_mux = &alc882_capture_source,
6427 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6428 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6429 alc880_gpio1_init_verbs },
6430 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6431 .dac_nids = alc882_dac_nids,
6432 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6433 .channel_mode = alc880_threestack_modes,
6435 .input_mux = &alc882_capture_source,
6436 .dig_out_nid = ALC882_DIGOUT_NID,
6439 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6440 .init_verbs = { alc885_mbp3_init_verbs,
6441 alc880_gpio1_init_verbs },
6442 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6443 .dac_nids = alc882_dac_nids,
6444 .channel_mode = alc885_mbp_6ch_modes,
6445 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6446 .input_mux = &alc882_capture_source,
6447 .dig_out_nid = ALC882_DIGOUT_NID,
6448 .dig_in_nid = ALC882_DIGIN_NID,
6449 .unsol_event = alc885_mbp3_unsol_event,
6450 .init_hook = alc885_mbp3_automute,
6453 .mixers = { alc882_macpro_mixer },
6454 .init_verbs = { alc882_macpro_init_verbs },
6455 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6456 .dac_nids = alc882_dac_nids,
6457 .dig_out_nid = ALC882_DIGOUT_NID,
6458 .dig_in_nid = ALC882_DIGIN_NID,
6459 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6460 .channel_mode = alc882_ch_modes,
6461 .input_mux = &alc882_capture_source,
6462 .init_hook = alc885_macpro_init_hook,
6465 .mixers = { alc885_imac24_mixer },
6466 .init_verbs = { alc885_imac24_init_verbs },
6467 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6468 .dac_nids = alc882_dac_nids,
6469 .dig_out_nid = ALC882_DIGOUT_NID,
6470 .dig_in_nid = ALC882_DIGIN_NID,
6471 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6472 .channel_mode = alc882_ch_modes,
6473 .input_mux = &alc882_capture_source,
6474 .unsol_event = alc885_imac24_unsol_event,
6475 .init_hook = alc885_imac24_init_hook,
6478 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6479 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6480 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6481 .dac_nids = alc882_dac_nids,
6482 .dig_out_nid = ALC882_DIGOUT_NID,
6483 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6484 .adc_nids = alc882_adc_nids,
6485 .capsrc_nids = alc882_capsrc_nids,
6486 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6487 .channel_mode = alc882_3ST_6ch_modes,
6489 .input_mux = &alc882_capture_source,
6490 .unsol_event = alc882_targa_unsol_event,
6491 .init_hook = alc882_targa_automute,
6493 [ALC882_ASUS_A7J] = {
6494 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6495 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6496 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6497 .dac_nids = alc882_dac_nids,
6498 .dig_out_nid = ALC882_DIGOUT_NID,
6499 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6500 .adc_nids = alc882_adc_nids,
6501 .capsrc_nids = alc882_capsrc_nids,
6502 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6503 .channel_mode = alc882_3ST_6ch_modes,
6505 .input_mux = &alc882_capture_source,
6507 [ALC882_ASUS_A7M] = {
6508 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6509 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6510 alc880_gpio1_init_verbs,
6511 alc882_asus_a7m_verbs },
6512 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6513 .dac_nids = alc882_dac_nids,
6514 .dig_out_nid = ALC882_DIGOUT_NID,
6515 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6516 .channel_mode = alc880_threestack_modes,
6518 .input_mux = &alc882_capture_source,
6527 PINFIX_ABIT_AW9D_MAX
6530 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6531 { 0x15, 0x01080104 }, /* side */
6532 { 0x16, 0x01011012 }, /* rear */
6533 { 0x17, 0x01016011 }, /* clfe */
6537 static const struct alc_pincfg *alc882_pin_fixes[] = {
6538 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6541 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6542 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6547 * BIOS auto configuration
6549 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6550 hda_nid_t nid, int pin_type,
6554 struct alc_spec *spec = codec->spec;
6557 alc_set_pin_output(codec, nid, pin_type);
6558 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6561 idx = spec->multiout.dac_nids[dac_idx] - 2;
6562 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6566 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6568 struct alc_spec *spec = codec->spec;
6571 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6572 for (i = 0; i <= HDA_SIDE; i++) {
6573 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6574 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6576 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6581 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6583 struct alc_spec *spec = codec->spec;
6586 pin = spec->autocfg.hp_pins[0];
6587 if (pin) /* connect to front */
6589 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6590 pin = spec->autocfg.speaker_pins[0];
6592 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6595 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6596 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6598 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6600 struct alc_spec *spec = codec->spec;
6603 for (i = 0; i < AUTO_PIN_LAST; i++) {
6604 hda_nid_t nid = spec->autocfg.input_pins[i];
6609 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6610 unsigned int pincap;
6611 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6612 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6616 snd_hda_codec_write(codec, nid, 0,
6617 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6618 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6619 snd_hda_codec_write(codec, nid, 0,
6620 AC_VERB_SET_AMP_GAIN_MUTE,
6625 static void alc882_auto_init_input_src(struct hda_codec *codec)
6627 struct alc_spec *spec = codec->spec;
6628 const struct hda_input_mux *imux = spec->input_mux;
6631 for (c = 0; c < spec->num_adc_nids; c++) {
6632 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6633 hda_nid_t nid = spec->capsrc_nids[c];
6634 int conns, mute, idx, item;
6636 conns = snd_hda_get_connections(codec, nid, conn_list,
6637 ARRAY_SIZE(conn_list));
6640 for (idx = 0; idx < conns; idx++) {
6641 /* if the current connection is the selected one,
6642 * unmute it as default - otherwise mute it
6644 mute = AMP_IN_MUTE(idx);
6645 for (item = 0; item < imux->num_items; item++) {
6646 if (imux->items[item].index == idx) {
6647 if (spec->cur_mux[c] == item)
6648 mute = AMP_IN_UNMUTE(idx);
6652 snd_hda_codec_write(codec, nid, 0,
6653 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6658 /* add mic boosts if needed */
6659 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6661 struct alc_spec *spec = codec->spec;
6665 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6666 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6667 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6669 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6673 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6674 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6675 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6677 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6684 /* almost identical with ALC880 parser... */
6685 static int alc882_parse_auto_config(struct hda_codec *codec)
6687 struct alc_spec *spec = codec->spec;
6688 int err = alc880_parse_auto_config(codec);
6693 return 0; /* no config found */
6695 err = alc_auto_add_mic_boost(codec);
6699 /* hack - override the init verbs */
6700 spec->init_verbs[0] = alc882_auto_init_verbs;
6702 return 1; /* config found */
6705 /* additional initialization for auto-configuration model */
6706 static void alc882_auto_init(struct hda_codec *codec)
6708 struct alc_spec *spec = codec->spec;
6709 alc882_auto_init_multi_out(codec);
6710 alc882_auto_init_hp_out(codec);
6711 alc882_auto_init_analog_input(codec);
6712 alc882_auto_init_input_src(codec);
6713 if (spec->unsol_event)
6714 alc_inithook(codec);
6717 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6719 static int patch_alc882(struct hda_codec *codec)
6721 struct alc_spec *spec;
6722 int err, board_config;
6724 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6730 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6734 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6735 /* Pick up systems that don't supply PCI SSID */
6736 switch (codec->subsystem_id) {
6737 case 0x106b0c00: /* Mac Pro */
6738 board_config = ALC885_MACPRO;
6740 case 0x106b1000: /* iMac 24 */
6741 case 0x106b2800: /* AppleTV */
6742 board_config = ALC885_IMAC24;
6744 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6745 case 0x106b00a4: /* MacbookPro4,1 */
6746 case 0x106b2c00: /* Macbook Pro rev3 */
6747 case 0x106b3600: /* Macbook 3.1 */
6748 board_config = ALC885_MBP3;
6751 /* ALC889A is handled better as ALC888-compatible */
6752 if (codec->revision_id == 0x100101 ||
6753 codec->revision_id == 0x100103) {
6755 return patch_alc883(codec);
6757 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6758 "trying auto-probe from BIOS...\n");
6759 board_config = ALC882_AUTO;
6763 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6765 if (board_config == ALC882_AUTO) {
6766 /* automatic parse from the BIOS config */
6767 err = alc882_parse_auto_config(codec);
6773 "hda_codec: Cannot set up configuration "
6774 "from BIOS. Using base mode...\n");
6775 board_config = ALC882_3ST_DIG;
6779 if (board_config != ALC882_AUTO)
6780 setup_preset(spec, &alc882_presets[board_config]);
6782 if (codec->vendor_id == 0x10ec0885) {
6783 spec->stream_name_analog = "ALC885 Analog";
6784 spec->stream_name_digital = "ALC885 Digital";
6786 spec->stream_name_analog = "ALC882 Analog";
6787 spec->stream_name_digital = "ALC882 Digital";
6790 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6791 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6792 /* FIXME: setup DAC5 */
6793 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6794 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6796 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6797 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6799 spec->is_mix_capture = 1; /* matrix-style capture */
6800 if (!spec->adc_nids && spec->input_mux) {
6801 /* check whether NID 0x07 is valid */
6802 unsigned int wcap = get_wcaps(codec, 0x07);
6804 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6805 if (wcap != AC_WID_AUD_IN) {
6806 spec->adc_nids = alc882_adc_nids_alt;
6807 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6808 spec->capsrc_nids = alc882_capsrc_nids_alt;
6810 spec->adc_nids = alc882_adc_nids;
6811 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6812 spec->capsrc_nids = alc882_capsrc_nids;
6815 set_capture_mixer(spec);
6817 spec->vmaster_nid = 0x0c;
6819 codec->patch_ops = alc_patch_ops;
6820 if (board_config == ALC882_AUTO)
6821 spec->init_hook = alc882_auto_init;
6822 #ifdef CONFIG_SND_HDA_POWER_SAVE
6823 if (!spec->loopback.amplist)
6824 spec->loopback.amplist = alc882_loopbacks;
6833 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6834 * configuration. Each pin widget can choose any input DACs and a mixer.
6835 * Each ADC is connected from a mixer of all inputs. This makes possible
6836 * 6-channel independent captures.
6838 * In addition, an independent DAC for the multi-playback (not used in this
6841 #define ALC883_DIGOUT_NID 0x06
6842 #define ALC883_DIGIN_NID 0x0a
6844 static hda_nid_t alc883_dac_nids[4] = {
6845 /* front, rear, clfe, rear_surr */
6846 0x02, 0x03, 0x04, 0x05
6849 static hda_nid_t alc883_adc_nids[2] = {
6854 static hda_nid_t alc883_adc_nids_alt[1] = {
6859 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6862 /* FIXME: should be a matrix-type input source selection */
6864 static struct hda_input_mux alc883_capture_source = {
6868 { "Front Mic", 0x1 },
6874 static struct hda_input_mux alc883_3stack_6ch_intel = {
6878 { "Front Mic", 0x0 },
6884 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6892 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6902 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6910 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6914 { "Front Mic", 0x1 },
6919 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6930 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6937 static struct hda_verb alc883_3ST_ch2_init[] = {
6938 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6939 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6940 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6941 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6948 static struct hda_verb alc883_3ST_ch4_init[] = {
6949 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6950 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6951 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6952 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6953 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6960 static struct hda_verb alc883_3ST_ch6_init[] = {
6961 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6962 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6963 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6964 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6965 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6966 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6970 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6971 { 2, alc883_3ST_ch2_init },
6972 { 4, alc883_3ST_ch4_init },
6973 { 6, alc883_3ST_ch6_init },
6979 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6980 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6981 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6982 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6983 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6990 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6991 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6992 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6993 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6994 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6995 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7002 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7003 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7004 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7005 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7006 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7007 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7008 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7012 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7013 { 2, alc883_3ST_ch2_intel_init },
7014 { 4, alc883_3ST_ch4_intel_init },
7015 { 6, alc883_3ST_ch6_intel_init },
7021 static struct hda_verb alc883_sixstack_ch6_init[] = {
7022 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7023 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7024 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7025 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7032 static struct hda_verb alc883_sixstack_ch8_init[] = {
7033 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7034 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7036 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7040 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7041 { 6, alc883_sixstack_ch6_init },
7042 { 8, alc883_sixstack_ch8_init },
7045 static struct hda_verb alc883_medion_eapd_verbs[] = {
7046 /* eanable EAPD on medion laptop */
7047 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7048 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7052 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7053 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7056 static struct snd_kcontrol_new alc883_base_mixer[] = {
7057 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7058 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7059 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7060 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7061 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7062 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7063 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7064 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7065 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7066 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7067 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7068 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7069 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7071 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7073 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7075 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7076 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7077 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7078 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7079 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7083 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7084 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7085 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7086 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7087 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7088 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7089 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7092 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7094 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7095 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7096 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7100 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7101 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7102 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7104 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7106 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7107 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7108 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7109 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7110 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7114 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7115 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7116 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7118 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7120 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7122 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7123 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7124 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7128 static struct snd_kcontrol_new alc883_3ST_2ch_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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7132 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7133 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7134 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7135 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
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("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7143 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7147 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7148 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7149 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7150 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7151 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7152 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7153 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7154 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7155 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7156 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7157 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7158 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7159 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7160 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7162 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7163 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7165 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7166 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7167 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7168 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7172 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7173 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7174 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7175 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7176 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7177 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7179 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7180 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7181 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7183 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7184 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7185 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7186 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7188 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7190 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7191 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7192 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7193 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7194 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7198 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7199 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7200 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7201 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7202 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7203 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7204 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7205 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7206 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7207 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7208 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7209 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7210 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7211 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7213 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7214 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7217 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7218 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7219 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7223 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7225 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7226 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7227 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7228 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7229 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7230 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7231 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7232 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7233 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7234 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7235 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7236 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7238 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7243 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7244 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7245 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7246 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7250 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7252 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7254 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7258 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7261 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7262 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7263 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7270 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7271 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7272 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7273 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7274 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7275 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7276 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7277 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7278 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7279 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7283 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7284 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7286 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7287 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7288 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7291 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7292 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7296 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7297 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7298 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7299 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7300 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7301 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7302 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7303 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7308 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7310 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7311 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7312 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7313 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7314 0x0d, 1, 0x0, HDA_OUTPUT),
7315 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7316 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7317 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7318 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7319 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7320 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7321 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7322 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7323 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7327 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7329 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7330 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7331 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7335 static struct hda_bind_ctls alc883_bind_cap_vol = {
7336 .ops = &snd_hda_bind_vol,
7338 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7339 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7344 static struct hda_bind_ctls alc883_bind_cap_switch = {
7345 .ops = &snd_hda_bind_sw,
7347 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7348 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7353 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7354 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7355 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7356 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7360 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7361 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7365 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7366 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7367 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7369 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7370 /* .name = "Capture Source", */
7371 .name = "Input Source",
7373 .info = alc_mux_enum_info,
7374 .get = alc_mux_enum_get,
7375 .put = alc_mux_enum_put,
7380 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7382 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7383 .name = "Channel Mode",
7384 .info = alc_ch_mode_info,
7385 .get = alc_ch_mode_get,
7386 .put = alc_ch_mode_put,
7391 static struct hda_verb alc883_init_verbs[] = {
7392 /* ADC1: mute amp left and right */
7393 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7394 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7395 /* ADC2: mute amp left and right */
7396 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7397 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7398 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7403 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7412 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7413 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7415 /* mute analog input loopbacks */
7416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7422 /* Front Pin: output 0 (0x0c) */
7423 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7424 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7425 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7426 /* Rear Pin: output 1 (0x0d) */
7427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7430 /* CLFE Pin: output 2 (0x0e) */
7431 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7432 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7433 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7434 /* Side Pin: output 3 (0x0f) */
7435 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7436 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7437 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7438 /* Mic (rear) pin: input vref at 80% */
7439 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7440 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7441 /* Front Mic pin: input vref at 80% */
7442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7444 /* Line In pin: input */
7445 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7446 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7447 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7448 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7449 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7450 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7451 /* CD pin widget for input */
7452 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7454 /* FIXME: use matrix-type input source selection */
7455 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7469 /* toggle speaker-output according to the hp-jack state */
7470 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7472 unsigned int present;
7474 present = snd_hda_codec_read(codec, 0x15, 0,
7475 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7476 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7477 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7478 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7479 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7482 /* auto-toggle front mic */
7484 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7486 unsigned int present;
7489 present = snd_hda_codec_read(codec, 0x18, 0,
7490 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7491 bits = present ? HDA_AMP_MUTE : 0;
7492 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7496 static void alc883_mitac_automute(struct hda_codec *codec)
7498 alc883_mitac_hp_automute(codec);
7499 /* alc883_mitac_mic_automute(codec); */
7502 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7505 switch (res >> 26) {
7506 case ALC880_HP_EVENT:
7507 alc883_mitac_hp_automute(codec);
7509 case ALC880_MIC_EVENT:
7510 /* alc883_mitac_mic_automute(codec); */
7515 static struct hda_verb alc883_mitac_verbs[] = {
7517 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7518 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7520 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7521 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7523 /* enable unsolicited event */
7524 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7525 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7530 static struct hda_verb alc883_clevo_m720_verbs[] = {
7532 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7535 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7538 /* enable unsolicited event */
7539 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7540 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7545 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7547 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7550 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7551 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7553 /* enable unsolicited event */
7554 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7559 static struct hda_verb alc883_tagra_verbs[] = {
7560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7564 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7566 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7567 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7568 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7570 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7571 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7572 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7573 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7578 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7579 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7580 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7581 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7585 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7586 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7588 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7593 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7595 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7596 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7597 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7598 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7602 static struct hda_verb alc883_haier_w66_verbs[] = {
7603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7608 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7610 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7611 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7615 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7620 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7621 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7622 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7623 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7627 static struct hda_verb alc888_3st_hp_verbs[] = {
7628 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7629 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7630 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7634 static struct hda_verb alc888_6st_dell_verbs[] = {
7635 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7639 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7640 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7641 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7642 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7643 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7647 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7648 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7649 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7650 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7651 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7655 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7656 { 2, alc888_3st_hp_2ch_init },
7657 { 6, alc888_3st_hp_6ch_init },
7660 /* toggle front-jack and RCA according to the hp-jack state */
7661 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7663 unsigned int present;
7665 present = snd_hda_codec_read(codec, 0x1b, 0,
7666 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7667 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7668 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7669 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7670 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7673 /* toggle RCA according to the front-jack state */
7674 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7676 unsigned int present;
7678 present = snd_hda_codec_read(codec, 0x14, 0,
7679 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7680 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7681 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7684 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7687 if ((res >> 26) == ALC880_HP_EVENT)
7688 alc888_lenovo_ms7195_front_automute(codec);
7689 if ((res >> 26) == ALC880_FRONT_EVENT)
7690 alc888_lenovo_ms7195_rca_automute(codec);
7693 static struct hda_verb alc883_medion_md2_verbs[] = {
7694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7697 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7699 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7703 /* toggle speaker-output according to the hp-jack state */
7704 static void alc883_medion_md2_automute(struct hda_codec *codec)
7706 unsigned int present;
7708 present = snd_hda_codec_read(codec, 0x14, 0,
7709 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7710 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7711 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7714 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7717 if ((res >> 26) == ALC880_HP_EVENT)
7718 alc883_medion_md2_automute(codec);
7721 /* toggle speaker-output according to the hp-jack state */
7722 static void alc883_tagra_automute(struct hda_codec *codec)
7724 unsigned int present;
7727 present = snd_hda_codec_read(codec, 0x14, 0,
7728 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7729 bits = present ? HDA_AMP_MUTE : 0;
7730 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7731 HDA_AMP_MUTE, bits);
7732 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7736 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7738 if ((res >> 26) == ALC880_HP_EVENT)
7739 alc883_tagra_automute(codec);
7742 /* toggle speaker-output according to the hp-jack state */
7743 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7745 unsigned int present;
7748 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7749 & AC_PINSENSE_PRESENCE;
7750 bits = present ? HDA_AMP_MUTE : 0;
7751 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7752 HDA_AMP_MUTE, bits);
7755 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7757 unsigned int present;
7759 present = snd_hda_codec_read(codec, 0x18, 0,
7760 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7761 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7762 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7765 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7767 alc883_clevo_m720_hp_automute(codec);
7768 alc883_clevo_m720_mic_automute(codec);
7771 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7774 switch (res >> 26) {
7775 case ALC880_HP_EVENT:
7776 alc883_clevo_m720_hp_automute(codec);
7778 case ALC880_MIC_EVENT:
7779 alc883_clevo_m720_mic_automute(codec);
7784 /* toggle speaker-output according to the hp-jack state */
7785 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7787 unsigned int present;
7790 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7791 & AC_PINSENSE_PRESENCE;
7792 bits = present ? HDA_AMP_MUTE : 0;
7793 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7794 HDA_AMP_MUTE, bits);
7797 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7800 if ((res >> 26) == ALC880_HP_EVENT)
7801 alc883_2ch_fujitsu_pi2515_automute(codec);
7804 static void alc883_haier_w66_automute(struct hda_codec *codec)
7806 unsigned int present;
7809 present = snd_hda_codec_read(codec, 0x1b, 0,
7810 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7811 bits = present ? 0x80 : 0;
7812 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7816 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7819 if ((res >> 26) == ALC880_HP_EVENT)
7820 alc883_haier_w66_automute(codec);
7823 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7825 unsigned int present;
7828 present = snd_hda_codec_read(codec, 0x14, 0,
7829 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7830 bits = present ? HDA_AMP_MUTE : 0;
7831 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7832 HDA_AMP_MUTE, bits);
7835 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7837 unsigned int present;
7840 present = snd_hda_codec_read(codec, 0x1b, 0,
7841 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7842 bits = present ? HDA_AMP_MUTE : 0;
7843 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7844 HDA_AMP_MUTE, bits);
7845 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7846 HDA_AMP_MUTE, bits);
7849 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7852 if ((res >> 26) == ALC880_HP_EVENT)
7853 alc883_lenovo_101e_all_automute(codec);
7854 if ((res >> 26) == ALC880_FRONT_EVENT)
7855 alc883_lenovo_101e_ispeaker_automute(codec);
7858 /* toggle speaker-output according to the hp-jack state */
7859 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7861 unsigned int present;
7863 present = snd_hda_codec_read(codec, 0x14, 0,
7864 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7865 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7866 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7867 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7868 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7871 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7874 if ((res >> 26) == ALC880_HP_EVENT)
7875 alc883_acer_aspire_automute(codec);
7878 static struct hda_verb alc883_acer_eapd_verbs[] = {
7879 /* HP Pin: output 0 (0x0c) */
7880 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7881 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7882 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7883 /* Front Pin: output 0 (0x0c) */
7884 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7885 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7886 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7887 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7888 /* eanable EAPD on medion laptop */
7889 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7890 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7891 /* enable unsolicited event */
7892 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7896 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7898 unsigned int present;
7900 present = snd_hda_codec_read(codec, 0x1b, 0,
7901 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7902 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7903 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7904 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7905 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7906 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7907 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7908 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7909 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7912 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7915 switch (res >> 26) {
7916 case ALC880_HP_EVENT:
7917 printk("hp_event\n");
7918 alc888_6st_dell_front_automute(codec);
7923 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
7926 unsigned int present;
7928 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
7929 present = snd_hda_codec_read(codec, 0x1b, 0,
7930 AC_VERB_GET_PIN_SENSE, 0);
7931 present = (present & 0x80000000) != 0;
7933 /* mute internal speaker */
7934 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7935 HDA_AMP_MUTE, HDA_AMP_MUTE);
7936 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7937 HDA_AMP_MUTE, HDA_AMP_MUTE);
7938 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7939 HDA_AMP_MUTE, HDA_AMP_MUTE);
7940 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7941 HDA_AMP_MUTE, HDA_AMP_MUTE);
7942 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7943 HDA_AMP_MUTE, HDA_AMP_MUTE);
7945 /* unmute internal speaker if necessary */
7946 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7947 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7948 HDA_AMP_MUTE, mute);
7949 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7950 HDA_AMP_MUTE, mute);
7951 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7952 HDA_AMP_MUTE, mute);
7953 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7954 HDA_AMP_MUTE, mute);
7955 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7956 HDA_AMP_MUTE, mute);
7960 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
7963 if ((res >> 26) == ALC880_HP_EVENT)
7964 alc888_lenovo_sky_front_automute(codec);
7968 * generic initialization of ADC, input mixers and output mixers
7970 static struct hda_verb alc883_auto_init_verbs[] = {
7972 * Unmute ADC0-2 and set the default input to mic-in
7974 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7976 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7979 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7981 * Note: PASD motherboards uses the Line In 2 as the input for
7982 * front panel mic (mic 2)
7984 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7992 * Set up output mixers (0x0c - 0x0f)
7994 /* set vol=0 to output mixers */
7995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7996 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7997 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7998 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7999 /* set up input amps for analog loopback */
8000 /* Amp Indices: DAC = 0, mixer = 1 */
8001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8004 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8005 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8006 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8008 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8009 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8010 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8012 /* FIXME: use matrix-type input source selection */
8013 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8015 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8016 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8017 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8018 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8019 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8023 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8024 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8025 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8030 static struct hda_verb alc888_asus_m90v_verbs[] = {
8031 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8034 /* enable unsolicited event */
8035 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8036 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8040 static void alc883_nb_mic_automute(struct hda_codec *codec)
8042 unsigned int present;
8044 present = snd_hda_codec_read(codec, 0x18, 0,
8045 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8046 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8047 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8048 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8049 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8052 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8054 unsigned int present;
8057 present = snd_hda_codec_read(codec, 0x1b, 0,
8058 AC_VERB_GET_PIN_SENSE, 0)
8059 & AC_PINSENSE_PRESENCE;
8060 bits = present ? 0 : PIN_OUT;
8061 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8063 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8065 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8069 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8072 switch (res >> 26) {
8073 case ALC880_HP_EVENT:
8074 alc883_M90V_speaker_automute(codec);
8076 case ALC880_MIC_EVENT:
8077 alc883_nb_mic_automute(codec);
8082 static void alc883_mode2_inithook(struct hda_codec *codec)
8084 alc883_M90V_speaker_automute(codec);
8085 alc883_nb_mic_automute(codec);
8088 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8089 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8090 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8094 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8095 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8096 /* enable unsolicited event */
8097 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8101 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8103 unsigned int present;
8106 present = snd_hda_codec_read(codec, 0x14, 0,
8107 AC_VERB_GET_PIN_SENSE, 0)
8108 & AC_PINSENSE_PRESENCE;
8109 bits = present ? 0 : PIN_OUT;
8110 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8114 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8117 switch (res >> 26) {
8118 case ALC880_HP_EVENT:
8119 alc883_eee1601_speaker_automute(codec);
8124 static void alc883_eee1601_inithook(struct hda_codec *codec)
8126 alc883_eee1601_speaker_automute(codec);
8129 #ifdef CONFIG_SND_HDA_POWER_SAVE
8130 #define alc883_loopbacks alc880_loopbacks
8133 /* pcm configuration: identiacal with ALC880 */
8134 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8135 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8136 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8137 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8138 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8141 * configuration and preset
8143 static const char *alc883_models[ALC883_MODEL_LAST] = {
8144 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8145 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8146 [ALC883_3ST_6ch] = "3stack-6ch",
8147 [ALC883_6ST_DIG] = "6stack-dig",
8148 [ALC883_TARGA_DIG] = "targa-dig",
8149 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8150 [ALC883_ACER] = "acer",
8151 [ALC883_ACER_ASPIRE] = "acer-aspire",
8152 [ALC883_MEDION] = "medion",
8153 [ALC883_MEDION_MD2] = "medion-md2",
8154 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8155 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8156 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8157 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8158 [ALC888_LENOVO_SKY] = "lenovo-sky",
8159 [ALC883_HAIER_W66] = "haier-w66",
8160 [ALC888_3ST_HP] = "3stack-hp",
8161 [ALC888_6ST_DELL] = "6stack-dell",
8162 [ALC883_MITAC] = "mitac",
8163 [ALC883_CLEVO_M720] = "clevo-m720",
8164 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8165 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8166 [ALC883_AUTO] = "auto",
8169 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8170 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8171 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8172 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8173 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8174 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8175 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8176 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8177 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8178 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8179 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8180 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8181 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8182 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8183 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8184 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8185 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8186 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8187 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8188 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8189 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8190 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8191 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8192 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8193 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8194 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8195 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8196 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8197 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8198 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8199 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8200 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8201 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8202 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8203 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8204 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8205 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8206 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8207 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8208 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8209 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8210 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8211 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8212 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8213 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8214 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8215 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8216 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8217 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8218 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8219 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8220 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8221 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8222 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8223 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8224 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8225 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8226 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8227 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8228 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8229 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8230 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8234 static struct alc_config_preset alc883_presets[] = {
8235 [ALC883_3ST_2ch_DIG] = {
8236 .mixers = { alc883_3ST_2ch_mixer },
8237 .init_verbs = { alc883_init_verbs },
8238 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8239 .dac_nids = alc883_dac_nids,
8240 .dig_out_nid = ALC883_DIGOUT_NID,
8241 .dig_in_nid = ALC883_DIGIN_NID,
8242 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8243 .channel_mode = alc883_3ST_2ch_modes,
8244 .input_mux = &alc883_capture_source,
8246 [ALC883_3ST_6ch_DIG] = {
8247 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8248 .init_verbs = { alc883_init_verbs },
8249 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8250 .dac_nids = alc883_dac_nids,
8251 .dig_out_nid = ALC883_DIGOUT_NID,
8252 .dig_in_nid = ALC883_DIGIN_NID,
8253 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8254 .channel_mode = alc883_3ST_6ch_modes,
8256 .input_mux = &alc883_capture_source,
8258 [ALC883_3ST_6ch] = {
8259 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8260 .init_verbs = { alc883_init_verbs },
8261 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8262 .dac_nids = alc883_dac_nids,
8263 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8264 .channel_mode = alc883_3ST_6ch_modes,
8266 .input_mux = &alc883_capture_source,
8268 [ALC883_3ST_6ch_INTEL] = {
8269 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8270 .init_verbs = { alc883_init_verbs },
8271 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8272 .dac_nids = alc883_dac_nids,
8273 .dig_out_nid = ALC883_DIGOUT_NID,
8274 .dig_in_nid = ALC883_DIGIN_NID,
8275 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8276 .channel_mode = alc883_3ST_6ch_intel_modes,
8278 .input_mux = &alc883_3stack_6ch_intel,
8280 [ALC883_6ST_DIG] = {
8281 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8282 .init_verbs = { alc883_init_verbs },
8283 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8284 .dac_nids = alc883_dac_nids,
8285 .dig_out_nid = ALC883_DIGOUT_NID,
8286 .dig_in_nid = ALC883_DIGIN_NID,
8287 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8288 .channel_mode = alc883_sixstack_modes,
8289 .input_mux = &alc883_capture_source,
8291 [ALC883_TARGA_DIG] = {
8292 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8293 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8294 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8295 .dac_nids = alc883_dac_nids,
8296 .dig_out_nid = ALC883_DIGOUT_NID,
8297 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8298 .channel_mode = alc883_3ST_6ch_modes,
8300 .input_mux = &alc883_capture_source,
8301 .unsol_event = alc883_tagra_unsol_event,
8302 .init_hook = alc883_tagra_automute,
8304 [ALC883_TARGA_2ch_DIG] = {
8305 .mixers = { alc883_tagra_2ch_mixer},
8306 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8307 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8308 .dac_nids = alc883_dac_nids,
8309 .adc_nids = alc883_adc_nids_alt,
8310 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8311 .dig_out_nid = ALC883_DIGOUT_NID,
8312 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8313 .channel_mode = alc883_3ST_2ch_modes,
8314 .input_mux = &alc883_capture_source,
8315 .unsol_event = alc883_tagra_unsol_event,
8316 .init_hook = alc883_tagra_automute,
8319 .mixers = { alc883_base_mixer },
8320 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8321 * and the headphone jack. Turn this on and rely on the
8322 * standard mute methods whenever the user wants to turn
8323 * these outputs off.
8325 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8327 .dac_nids = alc883_dac_nids,
8328 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8329 .channel_mode = alc883_3ST_2ch_modes,
8330 .input_mux = &alc883_capture_source,
8332 [ALC883_ACER_ASPIRE] = {
8333 .mixers = { alc883_acer_aspire_mixer },
8334 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8335 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8336 .dac_nids = alc883_dac_nids,
8337 .dig_out_nid = ALC883_DIGOUT_NID,
8338 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8339 .channel_mode = alc883_3ST_2ch_modes,
8340 .input_mux = &alc883_capture_source,
8341 .unsol_event = alc883_acer_aspire_unsol_event,
8342 .init_hook = alc883_acer_aspire_automute,
8345 .mixers = { alc883_fivestack_mixer,
8346 alc883_chmode_mixer },
8347 .init_verbs = { alc883_init_verbs,
8348 alc883_medion_eapd_verbs },
8349 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8350 .dac_nids = alc883_dac_nids,
8351 .adc_nids = alc883_adc_nids_alt,
8352 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8353 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8354 .channel_mode = alc883_sixstack_modes,
8355 .input_mux = &alc883_capture_source,
8357 [ALC883_MEDION_MD2] = {
8358 .mixers = { alc883_medion_md2_mixer},
8359 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8360 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8361 .dac_nids = alc883_dac_nids,
8362 .dig_out_nid = ALC883_DIGOUT_NID,
8363 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8364 .channel_mode = alc883_3ST_2ch_modes,
8365 .input_mux = &alc883_capture_source,
8366 .unsol_event = alc883_medion_md2_unsol_event,
8367 .init_hook = alc883_medion_md2_automute,
8369 [ALC883_LAPTOP_EAPD] = {
8370 .mixers = { alc883_base_mixer },
8371 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8372 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8373 .dac_nids = alc883_dac_nids,
8374 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8375 .channel_mode = alc883_3ST_2ch_modes,
8376 .input_mux = &alc883_capture_source,
8378 [ALC883_CLEVO_M720] = {
8379 .mixers = { alc883_clevo_m720_mixer },
8380 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8381 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8382 .dac_nids = alc883_dac_nids,
8383 .dig_out_nid = ALC883_DIGOUT_NID,
8384 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8385 .channel_mode = alc883_3ST_2ch_modes,
8386 .input_mux = &alc883_capture_source,
8387 .unsol_event = alc883_clevo_m720_unsol_event,
8388 .init_hook = alc883_clevo_m720_automute,
8390 [ALC883_LENOVO_101E_2ch] = {
8391 .mixers = { alc883_lenovo_101e_2ch_mixer},
8392 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8394 .dac_nids = alc883_dac_nids,
8395 .adc_nids = alc883_adc_nids_alt,
8396 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8397 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8398 .channel_mode = alc883_3ST_2ch_modes,
8399 .input_mux = &alc883_lenovo_101e_capture_source,
8400 .unsol_event = alc883_lenovo_101e_unsol_event,
8401 .init_hook = alc883_lenovo_101e_all_automute,
8403 [ALC883_LENOVO_NB0763] = {
8404 .mixers = { alc883_lenovo_nb0763_mixer },
8405 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8407 .dac_nids = alc883_dac_nids,
8408 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8409 .channel_mode = alc883_3ST_2ch_modes,
8411 .input_mux = &alc883_lenovo_nb0763_capture_source,
8412 .unsol_event = alc883_medion_md2_unsol_event,
8413 .init_hook = alc883_medion_md2_automute,
8415 [ALC888_LENOVO_MS7195_DIG] = {
8416 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8417 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8418 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8419 .dac_nids = alc883_dac_nids,
8420 .dig_out_nid = ALC883_DIGOUT_NID,
8421 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8422 .channel_mode = alc883_3ST_6ch_modes,
8424 .input_mux = &alc883_capture_source,
8425 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8426 .init_hook = alc888_lenovo_ms7195_front_automute,
8428 [ALC883_HAIER_W66] = {
8429 .mixers = { alc883_tagra_2ch_mixer},
8430 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8431 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8432 .dac_nids = alc883_dac_nids,
8433 .dig_out_nid = ALC883_DIGOUT_NID,
8434 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8435 .channel_mode = alc883_3ST_2ch_modes,
8436 .input_mux = &alc883_capture_source,
8437 .unsol_event = alc883_haier_w66_unsol_event,
8438 .init_hook = alc883_haier_w66_automute,
8441 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8442 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8443 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8444 .dac_nids = alc883_dac_nids,
8445 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8446 .channel_mode = alc888_3st_hp_modes,
8448 .input_mux = &alc883_capture_source,
8450 [ALC888_6ST_DELL] = {
8451 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8452 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8453 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8454 .dac_nids = alc883_dac_nids,
8455 .dig_out_nid = ALC883_DIGOUT_NID,
8456 .dig_in_nid = ALC883_DIGIN_NID,
8457 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8458 .channel_mode = alc883_sixstack_modes,
8459 .input_mux = &alc883_capture_source,
8460 .unsol_event = alc888_6st_dell_unsol_event,
8461 .init_hook = alc888_6st_dell_front_automute,
8464 .mixers = { alc883_mitac_mixer },
8465 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8466 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8467 .dac_nids = alc883_dac_nids,
8468 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8469 .channel_mode = alc883_3ST_2ch_modes,
8470 .input_mux = &alc883_capture_source,
8471 .unsol_event = alc883_mitac_unsol_event,
8472 .init_hook = alc883_mitac_automute,
8474 [ALC883_FUJITSU_PI2515] = {
8475 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8476 .init_verbs = { alc883_init_verbs,
8477 alc883_2ch_fujitsu_pi2515_verbs},
8478 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8479 .dac_nids = alc883_dac_nids,
8480 .dig_out_nid = ALC883_DIGOUT_NID,
8481 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8482 .channel_mode = alc883_3ST_2ch_modes,
8483 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8484 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8485 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8487 [ALC888_LENOVO_SKY] = {
8488 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8489 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8490 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8491 .dac_nids = alc883_dac_nids,
8492 .dig_out_nid = ALC883_DIGOUT_NID,
8493 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8494 .channel_mode = alc883_sixstack_modes,
8496 .input_mux = &alc883_lenovo_sky_capture_source,
8497 .unsol_event = alc883_lenovo_sky_unsol_event,
8498 .init_hook = alc888_lenovo_sky_front_automute,
8500 [ALC888_ASUS_M90V] = {
8501 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8502 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8503 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8504 .dac_nids = alc883_dac_nids,
8505 .dig_out_nid = ALC883_DIGOUT_NID,
8506 .dig_in_nid = ALC883_DIGIN_NID,
8507 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8508 .channel_mode = alc883_3ST_6ch_modes,
8510 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8511 .unsol_event = alc883_mode2_unsol_event,
8512 .init_hook = alc883_mode2_inithook,
8514 [ALC888_ASUS_EEE1601] = {
8515 .mixers = { alc883_asus_eee1601_mixer },
8516 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8517 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8518 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8519 .dac_nids = alc883_dac_nids,
8520 .dig_out_nid = ALC883_DIGOUT_NID,
8521 .dig_in_nid = ALC883_DIGIN_NID,
8522 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8523 .channel_mode = alc883_3ST_2ch_modes,
8525 .input_mux = &alc883_asus_eee1601_capture_source,
8526 .unsol_event = alc883_eee1601_unsol_event,
8527 .init_hook = alc883_eee1601_inithook,
8533 * BIOS auto configuration
8535 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8536 hda_nid_t nid, int pin_type,
8540 struct alc_spec *spec = codec->spec;
8543 alc_set_pin_output(codec, nid, pin_type);
8544 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8547 idx = spec->multiout.dac_nids[dac_idx] - 2;
8548 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8552 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8554 struct alc_spec *spec = codec->spec;
8557 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8558 for (i = 0; i <= HDA_SIDE; i++) {
8559 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8560 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8562 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8567 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8569 struct alc_spec *spec = codec->spec;
8572 pin = spec->autocfg.hp_pins[0];
8573 if (pin) /* connect to front */
8575 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8576 pin = spec->autocfg.speaker_pins[0];
8578 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8581 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8582 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8584 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8586 struct alc_spec *spec = codec->spec;
8589 for (i = 0; i < AUTO_PIN_LAST; i++) {
8590 hda_nid_t nid = spec->autocfg.input_pins[i];
8591 if (alc883_is_input_pin(nid)) {
8592 snd_hda_codec_write(codec, nid, 0,
8593 AC_VERB_SET_PIN_WIDGET_CONTROL,
8594 (i <= AUTO_PIN_FRONT_MIC ?
8595 PIN_VREF80 : PIN_IN));
8596 if (nid != ALC883_PIN_CD_NID)
8597 snd_hda_codec_write(codec, nid, 0,
8598 AC_VERB_SET_AMP_GAIN_MUTE,
8604 #define alc883_auto_init_input_src alc882_auto_init_input_src
8606 /* almost identical with ALC880 parser... */
8607 static int alc883_parse_auto_config(struct hda_codec *codec)
8609 struct alc_spec *spec = codec->spec;
8610 int err = alc880_parse_auto_config(codec);
8615 return 0; /* no config found */
8617 err = alc_auto_add_mic_boost(codec);
8621 /* hack - override the init verbs */
8622 spec->init_verbs[0] = alc883_auto_init_verbs;
8624 return 1; /* config found */
8627 /* additional initialization for auto-configuration model */
8628 static void alc883_auto_init(struct hda_codec *codec)
8630 struct alc_spec *spec = codec->spec;
8631 alc883_auto_init_multi_out(codec);
8632 alc883_auto_init_hp_out(codec);
8633 alc883_auto_init_analog_input(codec);
8634 alc883_auto_init_input_src(codec);
8635 if (spec->unsol_event)
8636 alc_inithook(codec);
8639 static int patch_alc883(struct hda_codec *codec)
8641 struct alc_spec *spec;
8642 int err, board_config;
8644 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8650 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8652 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8655 if (board_config < 0) {
8656 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8657 "trying auto-probe from BIOS...\n");
8658 board_config = ALC883_AUTO;
8661 if (board_config == ALC883_AUTO) {
8662 /* automatic parse from the BIOS config */
8663 err = alc883_parse_auto_config(codec);
8669 "hda_codec: Cannot set up configuration "
8670 "from BIOS. Using base mode...\n");
8671 board_config = ALC883_3ST_2ch_DIG;
8675 if (board_config != ALC883_AUTO)
8676 setup_preset(spec, &alc883_presets[board_config]);
8678 switch (codec->vendor_id) {
8680 if (codec->revision_id == 0x100101) {
8681 spec->stream_name_analog = "ALC1200 Analog";
8682 spec->stream_name_digital = "ALC1200 Digital";
8684 spec->stream_name_analog = "ALC888 Analog";
8685 spec->stream_name_digital = "ALC888 Digital";
8689 spec->stream_name_analog = "ALC889 Analog";
8690 spec->stream_name_digital = "ALC889 Digital";
8693 spec->stream_name_analog = "ALC883 Analog";
8694 spec->stream_name_digital = "ALC883 Digital";
8698 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8699 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8700 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8702 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8703 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8705 if (!spec->num_adc_nids) {
8706 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8707 spec->adc_nids = alc883_adc_nids;
8709 if (!spec->capsrc_nids)
8710 spec->capsrc_nids = alc883_capsrc_nids;
8711 spec->is_mix_capture = 1; /* matrix-style capture */
8712 if (!spec->cap_mixer)
8713 set_capture_mixer(spec);
8715 spec->vmaster_nid = 0x0c;
8717 codec->patch_ops = alc_patch_ops;
8718 if (board_config == ALC883_AUTO)
8719 spec->init_hook = alc883_auto_init;
8721 #ifdef CONFIG_SND_HDA_POWER_SAVE
8722 if (!spec->loopback.amplist)
8723 spec->loopback.amplist = alc883_loopbacks;
8733 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8734 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8736 #define alc262_dac_nids alc260_dac_nids
8737 #define alc262_adc_nids alc882_adc_nids
8738 #define alc262_adc_nids_alt alc882_adc_nids_alt
8739 #define alc262_capsrc_nids alc882_capsrc_nids
8740 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8742 #define alc262_modes alc260_modes
8743 #define alc262_capture_source alc882_capture_source
8745 static hda_nid_t alc262_dmic_adc_nids[1] = {
8750 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8752 static struct snd_kcontrol_new alc262_base_mixer[] = {
8753 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8754 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8755 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8756 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8757 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8758 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8761 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8762 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8763 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8764 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8765 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8766 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8767 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8769 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8770 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8774 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8775 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8776 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8777 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8778 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8779 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8780 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8782 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8783 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8784 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8785 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8786 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8787 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8788 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8789 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8794 /* update HP, line and mono-out pins according to the master switch */
8795 static void alc262_hp_master_update(struct hda_codec *codec)
8797 struct alc_spec *spec = codec->spec;
8798 int val = spec->master_sw;
8801 snd_hda_codec_write_cache(codec, 0x1b, 0,
8802 AC_VERB_SET_PIN_WIDGET_CONTROL,
8804 snd_hda_codec_write_cache(codec, 0x15, 0,
8805 AC_VERB_SET_PIN_WIDGET_CONTROL,
8807 /* mono (speaker) depending on the HP jack sense */
8808 val = val && !spec->jack_present;
8809 snd_hda_codec_write_cache(codec, 0x16, 0,
8810 AC_VERB_SET_PIN_WIDGET_CONTROL,
8814 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8816 struct alc_spec *spec = codec->spec;
8817 unsigned int presence;
8818 presence = snd_hda_codec_read(codec, 0x1b, 0,
8819 AC_VERB_GET_PIN_SENSE, 0);
8820 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8821 alc262_hp_master_update(codec);
8824 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8826 if ((res >> 26) != ALC880_HP_EVENT)
8828 alc262_hp_bpc_automute(codec);
8831 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8833 struct alc_spec *spec = codec->spec;
8834 unsigned int presence;
8835 presence = snd_hda_codec_read(codec, 0x15, 0,
8836 AC_VERB_GET_PIN_SENSE, 0);
8837 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8838 alc262_hp_master_update(codec);
8841 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8844 if ((res >> 26) != ALC880_HP_EVENT)
8846 alc262_hp_wildwest_automute(codec);
8849 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8850 struct snd_ctl_elem_value *ucontrol)
8852 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8853 struct alc_spec *spec = codec->spec;
8854 *ucontrol->value.integer.value = spec->master_sw;
8858 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8859 struct snd_ctl_elem_value *ucontrol)
8861 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8862 struct alc_spec *spec = codec->spec;
8863 int val = !!*ucontrol->value.integer.value;
8865 if (val == spec->master_sw)
8867 spec->master_sw = val;
8868 alc262_hp_master_update(codec);
8872 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8874 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8875 .name = "Master Playback Switch",
8876 .info = snd_ctl_boolean_mono_info,
8877 .get = alc262_hp_master_sw_get,
8878 .put = alc262_hp_master_sw_put,
8880 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8881 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8883 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8885 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8887 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8888 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8890 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8891 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8892 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8893 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8894 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8895 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8896 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8897 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8898 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8899 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8900 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8904 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8906 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8907 .name = "Master Playback Switch",
8908 .info = snd_ctl_boolean_mono_info,
8909 .get = alc262_hp_master_sw_get,
8910 .put = alc262_hp_master_sw_put,
8912 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8913 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8914 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8916 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8918 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8920 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8921 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8922 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8923 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8924 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8925 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8926 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8927 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8928 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8932 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8933 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8934 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8935 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8939 /* mute/unmute internal speaker according to the hp jack and mute state */
8940 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8942 struct alc_spec *spec = codec->spec;
8944 if (force || !spec->sense_updated) {
8945 unsigned int present;
8946 present = snd_hda_codec_read(codec, 0x15, 0,
8947 AC_VERB_GET_PIN_SENSE, 0);
8948 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8949 spec->sense_updated = 1;
8951 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8952 spec->jack_present ? HDA_AMP_MUTE : 0);
8955 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8958 if ((res >> 26) != ALC880_HP_EVENT)
8960 alc262_hp_t5735_automute(codec, 1);
8963 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8965 alc262_hp_t5735_automute(codec, 1);
8968 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8969 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8970 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8971 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8973 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8974 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8975 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8979 static struct hda_verb alc262_hp_t5735_verbs[] = {
8980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8983 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8987 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8988 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8990 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8991 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8997 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8999 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9000 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9001 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9002 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9003 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9005 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9007 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9011 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9018 /* bind hp and internal speaker mute (with plug check) */
9019 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9020 struct snd_ctl_elem_value *ucontrol)
9022 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9023 long *valp = ucontrol->value.integer.value;
9026 /* change hp mute */
9027 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9029 valp[0] ? 0 : HDA_AMP_MUTE);
9030 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9032 valp[1] ? 0 : HDA_AMP_MUTE);
9034 /* change speaker according to HP jack state */
9035 struct alc_spec *spec = codec->spec;
9037 if (spec->jack_present)
9038 mute = HDA_AMP_MUTE;
9040 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9042 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9043 HDA_AMP_MUTE, mute);
9048 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9049 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9051 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9052 .name = "Master Playback Switch",
9053 .info = snd_hda_mixer_amp_switch_info,
9054 .get = snd_hda_mixer_amp_switch_get,
9055 .put = alc262_sony_master_sw_put,
9056 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9060 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9061 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9065 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9066 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9067 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9068 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9070 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9071 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9072 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9076 #define alc262_capture_mixer alc882_capture_mixer
9077 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9080 * generic initialization of ADC, input mixers and output mixers
9082 static struct hda_verb alc262_init_verbs[] = {
9084 * Unmute ADC0-2 and set the default input to mic-in
9086 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9087 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9088 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9090 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9093 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9095 * Note: PASD motherboards uses the Line In 2 as the input for
9096 * front panel mic (mic 2)
9098 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9106 * Set up output mixers (0x0c - 0x0e)
9108 /* set vol=0 to output mixers */
9109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9110 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9111 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9112 /* set up input amps for analog loopback */
9113 /* Amp Indices: DAC = 0, mixer = 1 */
9114 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9116 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9117 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9118 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9119 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9121 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9122 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9123 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9124 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9125 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9126 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9128 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9130 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9131 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9132 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9134 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9135 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9137 /* FIXME: use matrix-type input source selection */
9138 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9139 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9140 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9141 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9142 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9143 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9145 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9146 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9147 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9148 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9158 static struct hda_verb alc262_eapd_verbs[] = {
9159 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9160 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9164 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9165 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9170 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9171 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9172 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9173 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9175 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9176 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9180 static struct hda_verb alc262_sony_unsol_verbs[] = {
9181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9182 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9183 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9185 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9186 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9190 static struct hda_input_mux alc262_dmic_capture_source = {
9193 { "Int DMic", 0x9 },
9198 static struct snd_kcontrol_new alc262_toshiba_s06_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_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9207 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9208 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9209 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9212 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9213 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9214 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9215 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9219 static void alc262_dmic_automute(struct hda_codec *codec)
9221 unsigned int present;
9223 present = snd_hda_codec_read(codec, 0x18, 0,
9224 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9225 snd_hda_codec_write(codec, 0x22, 0,
9226 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9229 /* toggle speaker-output according to the hp-jack state */
9230 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9232 unsigned int present;
9235 present = snd_hda_codec_read(codec, 0x15, 0,
9236 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9237 bits = present ? 0 : PIN_OUT;
9238 snd_hda_codec_write(codec, 0x14, 0,
9239 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9244 /* unsolicited event for HP jack sensing */
9245 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9248 if ((res >> 26) == ALC880_HP_EVENT)
9249 alc262_toshiba_s06_speaker_automute(codec);
9250 if ((res >> 26) == ALC880_MIC_EVENT)
9251 alc262_dmic_automute(codec);
9255 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9257 alc262_toshiba_s06_speaker_automute(codec);
9258 alc262_dmic_automute(codec);
9261 /* mute/unmute internal speaker according to the hp jack and mute state */
9262 static void alc262_hippo_automute(struct hda_codec *codec)
9264 struct alc_spec *spec = codec->spec;
9266 unsigned int present;
9268 /* need to execute and sync at first */
9269 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9270 present = snd_hda_codec_read(codec, 0x15, 0,
9271 AC_VERB_GET_PIN_SENSE, 0);
9272 spec->jack_present = (present & 0x80000000) != 0;
9273 if (spec->jack_present) {
9274 /* mute internal speaker */
9275 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9276 HDA_AMP_MUTE, HDA_AMP_MUTE);
9278 /* unmute internal speaker if necessary */
9279 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9280 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9281 HDA_AMP_MUTE, mute);
9285 /* unsolicited event for HP jack sensing */
9286 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9289 if ((res >> 26) != ALC880_HP_EVENT)
9291 alc262_hippo_automute(codec);
9294 static void alc262_hippo1_automute(struct hda_codec *codec)
9297 unsigned int present;
9299 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9300 present = snd_hda_codec_read(codec, 0x1b, 0,
9301 AC_VERB_GET_PIN_SENSE, 0);
9302 present = (present & 0x80000000) != 0;
9304 /* mute internal speaker */
9305 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9306 HDA_AMP_MUTE, HDA_AMP_MUTE);
9308 /* unmute internal speaker if necessary */
9309 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9310 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9311 HDA_AMP_MUTE, mute);
9315 /* unsolicited event for HP jack sensing */
9316 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9319 if ((res >> 26) != ALC880_HP_EVENT)
9321 alc262_hippo1_automute(codec);
9327 * 0x16 = internal speaker
9328 * 0x18 = external mic
9331 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9332 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9333 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9337 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9339 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9340 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9344 static struct hda_verb alc262_nec_verbs[] = {
9345 /* Unmute Speaker */
9346 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9352 /* External mic to headphone */
9353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9354 /* External mic to speaker */
9355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9361 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9362 * 0x1b = port replicator headphone out
9365 #define ALC_HP_EVENT 0x37
9367 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9368 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9370 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9371 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9375 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9376 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9377 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9381 static struct hda_input_mux alc262_fujitsu_capture_source = {
9390 static struct hda_input_mux alc262_HP_capture_source = {
9394 { "Front Mic", 0x1 },
9401 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9405 { "Front Mic", 0x2 },
9411 /* mute/unmute internal speaker according to the hp jacks and mute state */
9412 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9414 struct alc_spec *spec = codec->spec;
9417 if (force || !spec->sense_updated) {
9418 unsigned int present;
9419 /* need to execute and sync at first */
9420 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9421 /* check laptop HP jack */
9422 present = snd_hda_codec_read(codec, 0x14, 0,
9423 AC_VERB_GET_PIN_SENSE, 0);
9424 /* need to execute and sync at first */
9425 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9426 /* check docking HP jack */
9427 present |= snd_hda_codec_read(codec, 0x1b, 0,
9428 AC_VERB_GET_PIN_SENSE, 0);
9429 if (present & AC_PINSENSE_PRESENCE)
9430 spec->jack_present = 1;
9432 spec->jack_present = 0;
9433 spec->sense_updated = 1;
9435 /* unmute internal speaker only if both HPs are unplugged and
9436 * master switch is on
9438 if (spec->jack_present)
9439 mute = HDA_AMP_MUTE;
9441 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9442 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9443 HDA_AMP_MUTE, mute);
9446 /* unsolicited event for HP jack sensing */
9447 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9450 if ((res >> 26) != ALC_HP_EVENT)
9452 alc262_fujitsu_automute(codec, 1);
9455 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9457 alc262_fujitsu_automute(codec, 1);
9460 /* bind volumes of both NID 0x0c and 0x0d */
9461 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9462 .ops = &snd_hda_bind_vol,
9464 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9465 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9470 /* mute/unmute internal speaker according to the hp jack and mute state */
9471 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9473 struct alc_spec *spec = codec->spec;
9476 if (force || !spec->sense_updated) {
9477 unsigned int present_int_hp;
9478 /* need to execute and sync at first */
9479 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9480 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9481 AC_VERB_GET_PIN_SENSE, 0);
9482 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9483 spec->sense_updated = 1;
9485 if (spec->jack_present) {
9486 /* mute internal speaker */
9487 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9488 HDA_AMP_MUTE, HDA_AMP_MUTE);
9489 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9490 HDA_AMP_MUTE, HDA_AMP_MUTE);
9492 /* unmute internal speaker if necessary */
9493 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9494 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9495 HDA_AMP_MUTE, mute);
9496 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9497 HDA_AMP_MUTE, mute);
9501 /* unsolicited event for HP jack sensing */
9502 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9505 if ((res >> 26) != ALC_HP_EVENT)
9507 alc262_lenovo_3000_automute(codec, 1);
9510 /* bind hp and internal speaker mute (with plug check) */
9511 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9512 struct snd_ctl_elem_value *ucontrol)
9514 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9515 long *valp = ucontrol->value.integer.value;
9518 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9520 valp ? 0 : HDA_AMP_MUTE);
9521 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9523 valp ? 0 : HDA_AMP_MUTE);
9526 alc262_fujitsu_automute(codec, 0);
9530 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9531 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9533 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9534 .name = "Master Playback Switch",
9535 .info = snd_hda_mixer_amp_switch_info,
9536 .get = snd_hda_mixer_amp_switch_get,
9537 .put = alc262_fujitsu_master_sw_put,
9538 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9540 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9541 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9542 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9543 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9544 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9547 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9548 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9549 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9553 /* bind hp and internal speaker mute (with plug check) */
9554 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9555 struct snd_ctl_elem_value *ucontrol)
9557 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9558 long *valp = ucontrol->value.integer.value;
9561 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9563 valp ? 0 : HDA_AMP_MUTE);
9566 alc262_lenovo_3000_automute(codec, 0);
9570 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9571 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9573 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9574 .name = "Master Playback Switch",
9575 .info = snd_hda_mixer_amp_switch_info,
9576 .get = snd_hda_mixer_amp_switch_get,
9577 .put = alc262_lenovo_3000_master_sw_put,
9578 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9580 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9581 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9582 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9585 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9586 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9587 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9591 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9592 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9594 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9595 .name = "Master Playback Switch",
9596 .info = snd_hda_mixer_amp_switch_info,
9597 .get = snd_hda_mixer_amp_switch_get,
9598 .put = alc262_sony_master_sw_put,
9599 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9603 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9604 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9605 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9606 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9610 /* additional init verbs for Benq laptops */
9611 static struct hda_verb alc262_EAPD_verbs[] = {
9612 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9613 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9617 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9618 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9619 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9621 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9622 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9626 /* Samsung Q1 Ultra Vista model setup */
9627 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9628 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9629 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9630 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9631 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9632 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9633 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9637 static struct hda_verb alc262_ultra_verbs[] = {
9639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9646 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9651 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9652 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9654 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9655 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9656 /* ADC, choose mic */
9657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9670 /* mute/unmute internal speaker according to the hp jack and mute state */
9671 static void alc262_ultra_automute(struct hda_codec *codec)
9673 struct alc_spec *spec = codec->spec;
9677 /* auto-mute only when HP is used as HP */
9678 if (!spec->cur_mux[0]) {
9679 unsigned int present;
9680 /* need to execute and sync at first */
9681 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9682 present = snd_hda_codec_read(codec, 0x15, 0,
9683 AC_VERB_GET_PIN_SENSE, 0);
9684 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9685 if (spec->jack_present)
9686 mute = HDA_AMP_MUTE;
9688 /* mute/unmute internal speaker */
9689 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9690 HDA_AMP_MUTE, mute);
9691 /* mute/unmute HP */
9692 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9693 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9696 /* unsolicited event for HP jack sensing */
9697 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9700 if ((res >> 26) != ALC880_HP_EVENT)
9702 alc262_ultra_automute(codec);
9705 static struct hda_input_mux alc262_ultra_capture_source = {
9709 { "Headphone", 0x7 },
9713 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9714 struct snd_ctl_elem_value *ucontrol)
9716 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9717 struct alc_spec *spec = codec->spec;
9720 ret = alc_mux_enum_put(kcontrol, ucontrol);
9723 /* reprogram the HP pin as mic or HP according to the input source */
9724 snd_hda_codec_write_cache(codec, 0x15, 0,
9725 AC_VERB_SET_PIN_WIDGET_CONTROL,
9726 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9727 alc262_ultra_automute(codec); /* mute/unmute HP */
9731 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9732 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9733 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9736 .name = "Capture Source",
9737 .info = alc_mux_enum_info,
9738 .get = alc_mux_enum_get,
9739 .put = alc262_ultra_mux_enum_put,
9744 /* add playback controls from the parsed DAC table */
9745 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9746 const struct auto_pin_cfg *cfg)
9751 spec->multiout.num_dacs = 1; /* only use one dac */
9752 spec->multiout.dac_nids = spec->private_dac_nids;
9753 spec->multiout.dac_nids[0] = 2;
9755 nid = cfg->line_out_pins[0];
9757 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9758 "Front Playback Volume",
9759 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9762 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9763 "Front Playback Switch",
9764 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9769 nid = cfg->speaker_pins[0];
9772 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9773 "Speaker Playback Volume",
9774 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9778 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9779 "Speaker Playback Switch",
9780 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9785 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9786 "Speaker Playback Switch",
9787 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9793 nid = cfg->hp_pins[0];
9795 /* spec->multiout.hp_nid = 2; */
9797 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9798 "Headphone Playback Volume",
9799 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9803 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9804 "Headphone Playback Switch",
9805 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9810 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9811 "Headphone Playback Switch",
9812 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9821 /* identical with ALC880 */
9822 #define alc262_auto_create_analog_input_ctls \
9823 alc880_auto_create_analog_input_ctls
9826 * generic initialization of ADC, input mixers and output mixers
9828 static struct hda_verb alc262_volume_init_verbs[] = {
9830 * Unmute ADC0-2 and set the default input to mic-in
9832 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9833 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9834 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9835 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9836 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9837 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9839 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9841 * Note: PASD motherboards uses the Line In 2 as the input for
9842 * front panel mic (mic 2)
9844 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9846 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9847 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9848 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9849 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9852 * Set up output mixers (0x0c - 0x0f)
9854 /* set vol=0 to output mixers */
9855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9856 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9857 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9859 /* set up input amps for analog loopback */
9860 /* Amp Indices: DAC = 0, mixer = 1 */
9861 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9863 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9864 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9865 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9866 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9868 /* FIXME: use matrix-type input source selection */
9869 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9870 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9871 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9872 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9873 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9874 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9876 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9877 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9878 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9879 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9882 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9883 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9889 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9891 * Unmute ADC0-2 and set the default input to mic-in
9893 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9895 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9896 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9897 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9898 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9900 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9902 * Note: PASD motherboards uses the Line In 2 as the input for
9903 * front panel mic (mic 2)
9905 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9909 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9910 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9911 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9912 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9915 * Set up output mixers (0x0c - 0x0e)
9917 /* set vol=0 to output mixers */
9918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9920 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9922 /* set up input amps for analog loopback */
9923 /* Amp Indices: DAC = 0, mixer = 1 */
9924 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9926 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9927 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9928 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9929 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9931 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9932 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9933 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9935 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9938 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9939 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9941 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9943 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9944 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9945 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9948 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9949 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9950 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9951 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9952 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9955 /* FIXME: use matrix-type input source selection */
9956 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9957 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9958 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9959 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9960 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9961 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9963 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9964 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9965 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9966 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9973 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9978 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9980 * Unmute ADC0-2 and set the default input to mic-in
9982 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9983 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9984 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9986 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9989 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9991 * Note: PASD motherboards uses the Line In 2 as the input for front
9994 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9996 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9998 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9999 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10004 * Set up output mixers (0x0c - 0x0e)
10006 /* set vol=0 to output mixers */
10007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10009 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10011 /* set up input amps for analog loopback */
10012 /* Amp Indices: DAC = 0, mixer = 1 */
10013 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10015 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10016 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10017 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10018 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10021 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10022 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10023 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10025 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10026 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10027 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10029 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10030 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10032 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10033 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10035 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10036 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10037 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10038 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10039 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10040 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10042 /* FIXME: use matrix-type input source selection */
10043 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10044 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10049 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10050 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10051 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10054 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10055 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10056 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10058 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10059 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10065 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10066 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10069 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10074 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10077 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10078 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10080 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10081 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10082 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10083 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10085 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10086 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10087 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10092 #ifdef CONFIG_SND_HDA_POWER_SAVE
10093 #define alc262_loopbacks alc880_loopbacks
10096 /* pcm configuration: identiacal with ALC880 */
10097 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10098 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10099 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10100 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10103 * BIOS auto configuration
10105 static int alc262_parse_auto_config(struct hda_codec *codec)
10107 struct alc_spec *spec = codec->spec;
10109 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10111 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10115 if (!spec->autocfg.line_outs)
10116 return 0; /* can't find valid BIOS pin config */
10117 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10120 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10124 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10126 if (spec->autocfg.dig_out_pin)
10127 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10128 if (spec->autocfg.dig_in_pin)
10129 spec->dig_in_nid = ALC262_DIGIN_NID;
10131 if (spec->kctls.list)
10132 add_mixer(spec, spec->kctls.list);
10134 add_verb(spec, alc262_volume_init_verbs);
10135 spec->num_mux_defs = 1;
10136 spec->input_mux = &spec->private_imux;
10138 err = alc_auto_add_mic_boost(codec);
10142 store_pin_configs(codec);
10146 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10147 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10148 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10149 #define alc262_auto_init_input_src alc882_auto_init_input_src
10152 /* init callback for auto-configuration model -- overriding the default init */
10153 static void alc262_auto_init(struct hda_codec *codec)
10155 struct alc_spec *spec = codec->spec;
10156 alc262_auto_init_multi_out(codec);
10157 alc262_auto_init_hp_out(codec);
10158 alc262_auto_init_analog_input(codec);
10159 alc262_auto_init_input_src(codec);
10160 if (spec->unsol_event)
10161 alc_inithook(codec);
10165 * configuration and preset
10167 static const char *alc262_models[ALC262_MODEL_LAST] = {
10168 [ALC262_BASIC] = "basic",
10169 [ALC262_HIPPO] = "hippo",
10170 [ALC262_HIPPO_1] = "hippo_1",
10171 [ALC262_FUJITSU] = "fujitsu",
10172 [ALC262_HP_BPC] = "hp-bpc",
10173 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10174 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10175 [ALC262_HP_RP5700] = "hp-rp5700",
10176 [ALC262_BENQ_ED8] = "benq",
10177 [ALC262_BENQ_T31] = "benq-t31",
10178 [ALC262_SONY_ASSAMD] = "sony-assamd",
10179 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10180 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10181 [ALC262_ULTRA] = "ultra",
10182 [ALC262_LENOVO_3000] = "lenovo-3000",
10183 [ALC262_NEC] = "nec",
10184 [ALC262_AUTO] = "auto",
10187 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10188 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10189 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10190 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10191 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10192 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10193 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10194 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10195 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10196 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10197 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10198 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10199 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10200 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10201 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10202 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10203 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10204 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10205 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10206 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10207 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10208 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10209 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10210 ALC262_HP_TC_T5735),
10211 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10212 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10213 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10214 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10215 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10216 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10217 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10218 ALC262_TOSHIBA_RX1),
10219 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10220 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10221 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10222 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10223 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10224 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10225 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10226 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10227 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10231 static struct alc_config_preset alc262_presets[] = {
10233 .mixers = { alc262_base_mixer },
10234 .init_verbs = { alc262_init_verbs },
10235 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10236 .dac_nids = alc262_dac_nids,
10238 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10239 .channel_mode = alc262_modes,
10240 .input_mux = &alc262_capture_source,
10243 .mixers = { alc262_base_mixer },
10244 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10245 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10246 .dac_nids = alc262_dac_nids,
10248 .dig_out_nid = ALC262_DIGOUT_NID,
10249 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10250 .channel_mode = alc262_modes,
10251 .input_mux = &alc262_capture_source,
10252 .unsol_event = alc262_hippo_unsol_event,
10253 .init_hook = alc262_hippo_automute,
10255 [ALC262_HIPPO_1] = {
10256 .mixers = { alc262_hippo1_mixer },
10257 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10258 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10259 .dac_nids = alc262_dac_nids,
10261 .dig_out_nid = ALC262_DIGOUT_NID,
10262 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10263 .channel_mode = alc262_modes,
10264 .input_mux = &alc262_capture_source,
10265 .unsol_event = alc262_hippo1_unsol_event,
10266 .init_hook = alc262_hippo1_automute,
10268 [ALC262_FUJITSU] = {
10269 .mixers = { alc262_fujitsu_mixer },
10270 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10271 alc262_fujitsu_unsol_verbs },
10272 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10273 .dac_nids = alc262_dac_nids,
10275 .dig_out_nid = ALC262_DIGOUT_NID,
10276 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10277 .channel_mode = alc262_modes,
10278 .input_mux = &alc262_fujitsu_capture_source,
10279 .unsol_event = alc262_fujitsu_unsol_event,
10280 .init_hook = alc262_fujitsu_init_hook,
10282 [ALC262_HP_BPC] = {
10283 .mixers = { alc262_HP_BPC_mixer },
10284 .init_verbs = { alc262_HP_BPC_init_verbs },
10285 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10286 .dac_nids = alc262_dac_nids,
10288 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10289 .channel_mode = alc262_modes,
10290 .input_mux = &alc262_HP_capture_source,
10291 .unsol_event = alc262_hp_bpc_unsol_event,
10292 .init_hook = alc262_hp_bpc_automute,
10294 [ALC262_HP_BPC_D7000_WF] = {
10295 .mixers = { alc262_HP_BPC_WildWest_mixer },
10296 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10297 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10298 .dac_nids = alc262_dac_nids,
10300 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10301 .channel_mode = alc262_modes,
10302 .input_mux = &alc262_HP_D7000_capture_source,
10303 .unsol_event = alc262_hp_wildwest_unsol_event,
10304 .init_hook = alc262_hp_wildwest_automute,
10306 [ALC262_HP_BPC_D7000_WL] = {
10307 .mixers = { alc262_HP_BPC_WildWest_mixer,
10308 alc262_HP_BPC_WildWest_option_mixer },
10309 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10310 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10311 .dac_nids = alc262_dac_nids,
10313 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10314 .channel_mode = alc262_modes,
10315 .input_mux = &alc262_HP_D7000_capture_source,
10316 .unsol_event = alc262_hp_wildwest_unsol_event,
10317 .init_hook = alc262_hp_wildwest_automute,
10319 [ALC262_HP_TC_T5735] = {
10320 .mixers = { alc262_hp_t5735_mixer },
10321 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10322 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10323 .dac_nids = alc262_dac_nids,
10325 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10326 .channel_mode = alc262_modes,
10327 .input_mux = &alc262_capture_source,
10328 .unsol_event = alc262_hp_t5735_unsol_event,
10329 .init_hook = alc262_hp_t5735_init_hook,
10331 [ALC262_HP_RP5700] = {
10332 .mixers = { alc262_hp_rp5700_mixer },
10333 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10334 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10335 .dac_nids = alc262_dac_nids,
10336 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10337 .channel_mode = alc262_modes,
10338 .input_mux = &alc262_hp_rp5700_capture_source,
10340 [ALC262_BENQ_ED8] = {
10341 .mixers = { alc262_base_mixer },
10342 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10343 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10344 .dac_nids = alc262_dac_nids,
10346 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10347 .channel_mode = alc262_modes,
10348 .input_mux = &alc262_capture_source,
10350 [ALC262_SONY_ASSAMD] = {
10351 .mixers = { alc262_sony_mixer },
10352 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10353 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10354 .dac_nids = alc262_dac_nids,
10356 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10357 .channel_mode = alc262_modes,
10358 .input_mux = &alc262_capture_source,
10359 .unsol_event = alc262_hippo_unsol_event,
10360 .init_hook = alc262_hippo_automute,
10362 [ALC262_BENQ_T31] = {
10363 .mixers = { alc262_benq_t31_mixer },
10364 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10365 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10366 .dac_nids = alc262_dac_nids,
10368 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10369 .channel_mode = alc262_modes,
10370 .input_mux = &alc262_capture_source,
10371 .unsol_event = alc262_hippo_unsol_event,
10372 .init_hook = alc262_hippo_automute,
10375 .mixers = { alc262_ultra_mixer },
10376 .cap_mixer = alc262_ultra_capture_mixer,
10377 .init_verbs = { alc262_ultra_verbs },
10378 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10379 .dac_nids = alc262_dac_nids,
10380 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10381 .channel_mode = alc262_modes,
10382 .input_mux = &alc262_ultra_capture_source,
10383 .adc_nids = alc262_adc_nids, /* ADC0 */
10384 .capsrc_nids = alc262_capsrc_nids,
10385 .num_adc_nids = 1, /* single ADC */
10386 .unsol_event = alc262_ultra_unsol_event,
10387 .init_hook = alc262_ultra_automute,
10389 [ALC262_LENOVO_3000] = {
10390 .mixers = { alc262_lenovo_3000_mixer },
10391 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10392 alc262_lenovo_3000_unsol_verbs },
10393 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10394 .dac_nids = alc262_dac_nids,
10396 .dig_out_nid = ALC262_DIGOUT_NID,
10397 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10398 .channel_mode = alc262_modes,
10399 .input_mux = &alc262_fujitsu_capture_source,
10400 .unsol_event = alc262_lenovo_3000_unsol_event,
10403 .mixers = { alc262_nec_mixer },
10404 .init_verbs = { alc262_nec_verbs },
10405 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10406 .dac_nids = alc262_dac_nids,
10408 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10409 .channel_mode = alc262_modes,
10410 .input_mux = &alc262_capture_source,
10412 [ALC262_TOSHIBA_S06] = {
10413 .mixers = { alc262_toshiba_s06_mixer },
10414 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10415 alc262_eapd_verbs },
10416 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10417 .capsrc_nids = alc262_dmic_capsrc_nids,
10418 .dac_nids = alc262_dac_nids,
10419 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10420 .dig_out_nid = ALC262_DIGOUT_NID,
10421 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10422 .channel_mode = alc262_modes,
10423 .input_mux = &alc262_dmic_capture_source,
10424 .unsol_event = alc262_toshiba_s06_unsol_event,
10425 .init_hook = alc262_toshiba_s06_init_hook,
10427 [ALC262_TOSHIBA_RX1] = {
10428 .mixers = { alc262_toshiba_rx1_mixer },
10429 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10430 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10431 .dac_nids = alc262_dac_nids,
10433 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10434 .channel_mode = alc262_modes,
10435 .input_mux = &alc262_capture_source,
10436 .unsol_event = alc262_hippo_unsol_event,
10437 .init_hook = alc262_hippo_automute,
10441 static int patch_alc262(struct hda_codec *codec)
10443 struct alc_spec *spec;
10447 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10451 codec->spec = spec;
10453 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10458 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10459 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10460 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10461 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10465 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10467 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10471 if (board_config < 0) {
10472 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10473 "trying auto-probe from BIOS...\n");
10474 board_config = ALC262_AUTO;
10477 if (board_config == ALC262_AUTO) {
10478 /* automatic parse from the BIOS config */
10479 err = alc262_parse_auto_config(codec);
10485 "hda_codec: Cannot set up configuration "
10486 "from BIOS. Using base mode...\n");
10487 board_config = ALC262_BASIC;
10491 if (board_config != ALC262_AUTO)
10492 setup_preset(spec, &alc262_presets[board_config]);
10494 spec->stream_name_analog = "ALC262 Analog";
10495 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10496 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10498 spec->stream_name_digital = "ALC262 Digital";
10499 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10500 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10502 spec->is_mix_capture = 1;
10503 if (!spec->adc_nids && spec->input_mux) {
10504 /* check whether NID 0x07 is valid */
10505 unsigned int wcap = get_wcaps(codec, 0x07);
10508 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10509 if (wcap != AC_WID_AUD_IN) {
10510 spec->adc_nids = alc262_adc_nids_alt;
10511 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10512 spec->capsrc_nids = alc262_capsrc_nids_alt;
10514 spec->adc_nids = alc262_adc_nids;
10515 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10516 spec->capsrc_nids = alc262_capsrc_nids;
10519 if (!spec->cap_mixer)
10520 set_capture_mixer(spec);
10522 spec->vmaster_nid = 0x0c;
10524 codec->patch_ops = alc_patch_ops;
10525 if (board_config == ALC262_AUTO)
10526 spec->init_hook = alc262_auto_init;
10527 #ifdef CONFIG_SND_HDA_POWER_SAVE
10528 if (!spec->loopback.amplist)
10529 spec->loopback.amplist = alc262_loopbacks;
10536 * ALC268 channel source setting (2 channel)
10538 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10539 #define alc268_modes alc260_modes
10541 static hda_nid_t alc268_dac_nids[2] = {
10546 static hda_nid_t alc268_adc_nids[2] = {
10551 static hda_nid_t alc268_adc_nids_alt[1] = {
10556 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10558 static struct snd_kcontrol_new alc268_base_mixer[] = {
10559 /* output mixer control */
10560 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10561 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10562 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10563 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10564 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10565 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10566 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10570 /* bind Beep switches of both NID 0x0f and 0x10 */
10571 static struct hda_bind_ctls alc268_bind_beep_sw = {
10572 .ops = &snd_hda_bind_sw,
10574 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10575 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10580 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10581 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10582 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10586 static struct hda_verb alc268_eapd_verbs[] = {
10587 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10588 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10592 /* Toshiba specific */
10593 #define alc268_toshiba_automute alc262_hippo_automute
10595 static struct hda_verb alc268_toshiba_verbs[] = {
10596 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10600 static struct hda_input_mux alc268_acer_lc_capture_source = {
10608 /* Acer specific */
10609 /* bind volumes of both NID 0x02 and 0x03 */
10610 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10611 .ops = &snd_hda_bind_vol,
10613 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10614 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10619 /* mute/unmute internal speaker according to the hp jack and mute state */
10620 static void alc268_acer_automute(struct hda_codec *codec, int force)
10622 struct alc_spec *spec = codec->spec;
10625 if (force || !spec->sense_updated) {
10626 unsigned int present;
10627 present = snd_hda_codec_read(codec, 0x14, 0,
10628 AC_VERB_GET_PIN_SENSE, 0);
10629 spec->jack_present = (present & 0x80000000) != 0;
10630 spec->sense_updated = 1;
10632 if (spec->jack_present)
10633 mute = HDA_AMP_MUTE; /* mute internal speaker */
10634 else /* unmute internal speaker if necessary */
10635 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10636 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10637 HDA_AMP_MUTE, mute);
10641 /* bind hp and internal speaker mute (with plug check) */
10642 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10643 struct snd_ctl_elem_value *ucontrol)
10645 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10646 long *valp = ucontrol->value.integer.value;
10649 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10651 valp[0] ? 0 : HDA_AMP_MUTE);
10652 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10654 valp[1] ? 0 : HDA_AMP_MUTE);
10656 alc268_acer_automute(codec, 0);
10660 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10661 /* output mixer control */
10662 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10664 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10665 .name = "Master Playback Switch",
10666 .info = snd_hda_mixer_amp_switch_info,
10667 .get = snd_hda_mixer_amp_switch_get,
10668 .put = alc268_acer_master_sw_put,
10669 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10671 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10675 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10676 /* output mixer control */
10677 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10680 .name = "Master Playback Switch",
10681 .info = snd_hda_mixer_amp_switch_info,
10682 .get = snd_hda_mixer_amp_switch_get,
10683 .put = alc268_acer_master_sw_put,
10684 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10686 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10687 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10688 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10692 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10693 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10695 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10696 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10697 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10698 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10702 static struct hda_verb alc268_acer_verbs[] = {
10703 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10704 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10705 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10706 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10707 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10708 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10709 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10713 /* unsolicited event for HP jack sensing */
10714 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10717 if ((res >> 26) != ALC880_HP_EVENT)
10719 alc268_toshiba_automute(codec);
10722 static void alc268_acer_unsol_event(struct hda_codec *codec,
10725 if ((res >> 26) != ALC880_HP_EVENT)
10727 alc268_acer_automute(codec, 1);
10730 static void alc268_acer_init_hook(struct hda_codec *codec)
10732 alc268_acer_automute(codec, 1);
10735 /* toggle speaker-output according to the hp-jack state */
10736 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10738 unsigned int present;
10739 unsigned char bits;
10741 present = snd_hda_codec_read(codec, 0x15, 0,
10742 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10743 bits = present ? AMP_IN_MUTE(0) : 0;
10744 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10745 AMP_IN_MUTE(0), bits);
10746 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10747 AMP_IN_MUTE(0), bits);
10751 static void alc268_acer_mic_automute(struct hda_codec *codec)
10753 unsigned int present;
10755 present = snd_hda_codec_read(codec, 0x18, 0,
10756 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10757 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
10758 present ? 0x0 : 0x6);
10761 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
10764 if ((res >> 26) == ALC880_HP_EVENT)
10765 alc268_aspire_one_speaker_automute(codec);
10766 if ((res >> 26) == ALC880_MIC_EVENT)
10767 alc268_acer_mic_automute(codec);
10770 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
10772 alc268_aspire_one_speaker_automute(codec);
10773 alc268_acer_mic_automute(codec);
10776 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10777 /* output mixer control */
10778 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10779 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10780 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10781 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10782 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10783 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10787 static struct hda_verb alc268_dell_verbs[] = {
10788 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10790 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10794 /* mute/unmute internal speaker according to the hp jack and mute state */
10795 static void alc268_dell_automute(struct hda_codec *codec)
10797 unsigned int present;
10800 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10801 if (present & 0x80000000)
10802 mute = HDA_AMP_MUTE;
10804 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10805 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10806 HDA_AMP_MUTE, mute);
10809 static void alc268_dell_unsol_event(struct hda_codec *codec,
10812 if ((res >> 26) != ALC880_HP_EVENT)
10814 alc268_dell_automute(codec);
10817 #define alc268_dell_init_hook alc268_dell_automute
10819 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10820 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10821 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10822 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10823 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10824 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10825 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10826 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10827 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10831 static struct hda_verb alc267_quanta_il1_verbs[] = {
10832 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10833 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10837 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10839 unsigned int present;
10841 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10842 & AC_PINSENSE_PRESENCE;
10843 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10844 present ? 0 : PIN_OUT);
10847 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10849 unsigned int present;
10851 present = snd_hda_codec_read(codec, 0x18, 0,
10852 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10853 snd_hda_codec_write(codec, 0x23, 0,
10854 AC_VERB_SET_CONNECT_SEL,
10855 present ? 0x00 : 0x01);
10858 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10860 alc267_quanta_il1_hp_automute(codec);
10861 alc267_quanta_il1_mic_automute(codec);
10864 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10867 switch (res >> 26) {
10868 case ALC880_HP_EVENT:
10869 alc267_quanta_il1_hp_automute(codec);
10871 case ALC880_MIC_EVENT:
10872 alc267_quanta_il1_mic_automute(codec);
10878 * generic initialization of ADC, input mixers and output mixers
10880 static struct hda_verb alc268_base_init_verbs[] = {
10881 /* Unmute DAC0-1 and set vol = 0 */
10882 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10883 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10884 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10885 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10886 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10887 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10890 * Set up output mixers (0x0c - 0x0e)
10892 /* set vol=0 to output mixers */
10893 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10894 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10895 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10896 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10898 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10899 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10901 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10902 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10903 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10904 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10905 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10906 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10907 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10908 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10911 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10912 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10913 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10914 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10915 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10916 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10918 /* set PCBEEP vol = 0, mute connections */
10919 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10920 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10921 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10923 /* Unmute Selector 23h,24h and set the default input to mic-in */
10925 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10926 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10927 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10928 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10934 * generic initialization of ADC, input mixers and output mixers
10936 static struct hda_verb alc268_volume_init_verbs[] = {
10937 /* set output DAC */
10938 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10939 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10940 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10941 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10943 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10945 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10946 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10947 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10949 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10951 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10952 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10953 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10955 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10956 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10957 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10958 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10960 /* set PCBEEP vol = 0, mute connections */
10961 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10962 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10963 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10968 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10969 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10970 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10972 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10973 /* The multiple "Capture Source" controls confuse alsamixer
10974 * So call somewhat different..
10976 /* .name = "Capture Source", */
10977 .name = "Input Source",
10979 .info = alc_mux_enum_info,
10980 .get = alc_mux_enum_get,
10981 .put = alc_mux_enum_put,
10986 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10987 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10988 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10989 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10990 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10992 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10993 /* The multiple "Capture Source" controls confuse alsamixer
10994 * So call somewhat different..
10996 /* .name = "Capture Source", */
10997 .name = "Input Source",
10999 .info = alc_mux_enum_info,
11000 .get = alc_mux_enum_get,
11001 .put = alc_mux_enum_put,
11006 static struct hda_input_mux alc268_capture_source = {
11010 { "Front Mic", 0x1 },
11016 static struct hda_input_mux alc268_acer_capture_source = {
11020 { "Internal Mic", 0x6 },
11025 #ifdef CONFIG_SND_DEBUG
11026 static struct snd_kcontrol_new alc268_test_mixer[] = {
11027 /* Volume widgets */
11028 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11029 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11030 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11031 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11032 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11033 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11034 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11035 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11036 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11037 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11038 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11039 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11040 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11041 /* The below appears problematic on some hardwares */
11042 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11043 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11044 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11045 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11046 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11048 /* Modes for retasking pin widgets */
11049 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11050 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11051 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11052 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11054 /* Controls for GPIO pins, assuming they are configured as outputs */
11055 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11056 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11057 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11058 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11060 /* Switches to allow the digital SPDIF output pin to be enabled.
11061 * The ALC268 does not have an SPDIF input.
11063 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11065 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11066 * this output to turn on an external amplifier.
11068 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11069 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11075 /* create input playback/capture controls for the given pin */
11076 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11077 const char *ctlname, int idx)
11082 sprintf(name, "%s Playback Volume", ctlname);
11084 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11085 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11089 } else if (nid == 0x15) {
11090 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11091 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11097 sprintf(name, "%s Playback Switch", ctlname);
11098 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11099 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11105 /* add playback controls from the parsed DAC table */
11106 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11107 const struct auto_pin_cfg *cfg)
11112 spec->multiout.num_dacs = 2; /* only use one dac */
11113 spec->multiout.dac_nids = spec->private_dac_nids;
11114 spec->multiout.dac_nids[0] = 2;
11115 spec->multiout.dac_nids[1] = 3;
11117 nid = cfg->line_out_pins[0];
11119 alc268_new_analog_output(spec, nid, "Front", 0);
11121 nid = cfg->speaker_pins[0];
11123 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11124 "Speaker Playback Volume",
11125 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11129 nid = cfg->hp_pins[0];
11131 alc268_new_analog_output(spec, nid, "Headphone", 0);
11133 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11135 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11136 "Mono Playback Switch",
11137 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11144 /* create playback/capture controls for input pins */
11145 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11146 const struct auto_pin_cfg *cfg)
11148 struct hda_input_mux *imux = &spec->private_imux;
11151 for (i = 0; i < AUTO_PIN_LAST; i++) {
11152 switch(cfg->input_pins[i]) {
11154 idx1 = 0; /* Mic 1 */
11157 idx1 = 1; /* Mic 2 */
11160 idx1 = 2; /* Line In */
11167 idx1 = 6; /* digital mics */
11172 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11173 imux->items[imux->num_items].index = idx1;
11179 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11181 struct alc_spec *spec = codec->spec;
11182 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11183 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11184 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11185 unsigned int dac_vol1, dac_vol2;
11188 snd_hda_codec_write(codec, speaker_nid, 0,
11189 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11190 snd_hda_codec_write(codec, 0x0f, 0,
11191 AC_VERB_SET_AMP_GAIN_MUTE,
11193 snd_hda_codec_write(codec, 0x10, 0,
11194 AC_VERB_SET_AMP_GAIN_MUTE,
11197 snd_hda_codec_write(codec, 0x0f, 0,
11198 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11199 snd_hda_codec_write(codec, 0x10, 0,
11200 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11203 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11204 if (line_nid == 0x14)
11205 dac_vol2 = AMP_OUT_ZERO;
11206 else if (line_nid == 0x15)
11207 dac_vol1 = AMP_OUT_ZERO;
11208 if (hp_nid == 0x14)
11209 dac_vol2 = AMP_OUT_ZERO;
11210 else if (hp_nid == 0x15)
11211 dac_vol1 = AMP_OUT_ZERO;
11212 if (line_nid != 0x16 || hp_nid != 0x16 ||
11213 spec->autocfg.line_out_pins[1] != 0x16 ||
11214 spec->autocfg.line_out_pins[2] != 0x16)
11215 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11217 snd_hda_codec_write(codec, 0x02, 0,
11218 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11219 snd_hda_codec_write(codec, 0x03, 0,
11220 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11223 /* pcm configuration: identiacal with ALC880 */
11224 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11225 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11226 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11227 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11230 * BIOS auto configuration
11232 static int alc268_parse_auto_config(struct hda_codec *codec)
11234 struct alc_spec *spec = codec->spec;
11236 static hda_nid_t alc268_ignore[] = { 0 };
11238 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11242 if (!spec->autocfg.line_outs)
11243 return 0; /* can't find valid BIOS pin config */
11245 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11248 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11252 spec->multiout.max_channels = 2;
11254 /* digital only support output */
11255 if (spec->autocfg.dig_out_pin)
11256 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11258 if (spec->kctls.list)
11259 add_mixer(spec, spec->kctls.list);
11261 if (spec->autocfg.speaker_pins[0] != 0x1d)
11262 add_mixer(spec, alc268_beep_mixer);
11264 add_verb(spec, alc268_volume_init_verbs);
11265 spec->num_mux_defs = 1;
11266 spec->input_mux = &spec->private_imux;
11268 err = alc_auto_add_mic_boost(codec);
11272 store_pin_configs(codec);
11276 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11277 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11278 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11280 /* init callback for auto-configuration model -- overriding the default init */
11281 static void alc268_auto_init(struct hda_codec *codec)
11283 struct alc_spec *spec = codec->spec;
11284 alc268_auto_init_multi_out(codec);
11285 alc268_auto_init_hp_out(codec);
11286 alc268_auto_init_mono_speaker_out(codec);
11287 alc268_auto_init_analog_input(codec);
11288 if (spec->unsol_event)
11289 alc_inithook(codec);
11293 * configuration and preset
11295 static const char *alc268_models[ALC268_MODEL_LAST] = {
11296 [ALC267_QUANTA_IL1] = "quanta-il1",
11297 [ALC268_3ST] = "3stack",
11298 [ALC268_TOSHIBA] = "toshiba",
11299 [ALC268_ACER] = "acer",
11300 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11301 [ALC268_DELL] = "dell",
11302 [ALC268_ZEPTO] = "zepto",
11303 #ifdef CONFIG_SND_DEBUG
11304 [ALC268_TEST] = "test",
11306 [ALC268_AUTO] = "auto",
11309 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11310 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11311 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11312 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11313 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11314 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11315 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11316 ALC268_ACER_ASPIRE_ONE),
11317 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11318 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11319 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11320 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11321 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11322 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11323 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11324 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11325 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11326 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11330 static struct alc_config_preset alc268_presets[] = {
11331 [ALC267_QUANTA_IL1] = {
11332 .mixers = { alc267_quanta_il1_mixer },
11333 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11334 alc267_quanta_il1_verbs },
11335 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11336 .dac_nids = alc268_dac_nids,
11337 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11338 .adc_nids = alc268_adc_nids_alt,
11340 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11341 .channel_mode = alc268_modes,
11342 .input_mux = &alc268_capture_source,
11343 .unsol_event = alc267_quanta_il1_unsol_event,
11344 .init_hook = alc267_quanta_il1_automute,
11347 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11348 alc268_beep_mixer },
11349 .init_verbs = { alc268_base_init_verbs },
11350 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11351 .dac_nids = alc268_dac_nids,
11352 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11353 .adc_nids = alc268_adc_nids_alt,
11354 .capsrc_nids = alc268_capsrc_nids,
11356 .dig_out_nid = ALC268_DIGOUT_NID,
11357 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11358 .channel_mode = alc268_modes,
11359 .input_mux = &alc268_capture_source,
11361 [ALC268_TOSHIBA] = {
11362 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11363 alc268_beep_mixer },
11364 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11365 alc268_toshiba_verbs },
11366 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11367 .dac_nids = alc268_dac_nids,
11368 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11369 .adc_nids = alc268_adc_nids_alt,
11370 .capsrc_nids = alc268_capsrc_nids,
11372 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11373 .channel_mode = alc268_modes,
11374 .input_mux = &alc268_capture_source,
11375 .unsol_event = alc268_toshiba_unsol_event,
11376 .init_hook = alc268_toshiba_automute,
11379 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11380 alc268_beep_mixer },
11381 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11382 alc268_acer_verbs },
11383 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11384 .dac_nids = alc268_dac_nids,
11385 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11386 .adc_nids = alc268_adc_nids_alt,
11387 .capsrc_nids = alc268_capsrc_nids,
11389 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11390 .channel_mode = alc268_modes,
11391 .input_mux = &alc268_acer_capture_source,
11392 .unsol_event = alc268_acer_unsol_event,
11393 .init_hook = alc268_acer_init_hook,
11395 [ALC268_ACER_ASPIRE_ONE] = {
11396 .mixers = { alc268_acer_aspire_one_mixer,
11397 alc268_capture_alt_mixer },
11398 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11399 alc268_acer_aspire_one_verbs },
11400 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11401 .dac_nids = alc268_dac_nids,
11402 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11403 .adc_nids = alc268_adc_nids_alt,
11404 .capsrc_nids = alc268_capsrc_nids,
11406 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11407 .channel_mode = alc268_modes,
11408 .input_mux = &alc268_acer_lc_capture_source,
11409 .unsol_event = alc268_acer_lc_unsol_event,
11410 .init_hook = alc268_acer_lc_init_hook,
11413 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11414 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11415 alc268_dell_verbs },
11416 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11417 .dac_nids = alc268_dac_nids,
11419 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11420 .channel_mode = alc268_modes,
11421 .unsol_event = alc268_dell_unsol_event,
11422 .init_hook = alc268_dell_init_hook,
11423 .input_mux = &alc268_capture_source,
11426 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11427 alc268_beep_mixer },
11428 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11429 alc268_toshiba_verbs },
11430 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11431 .dac_nids = alc268_dac_nids,
11432 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11433 .adc_nids = alc268_adc_nids_alt,
11434 .capsrc_nids = alc268_capsrc_nids,
11436 .dig_out_nid = ALC268_DIGOUT_NID,
11437 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11438 .channel_mode = alc268_modes,
11439 .input_mux = &alc268_capture_source,
11440 .unsol_event = alc268_toshiba_unsol_event,
11441 .init_hook = alc268_toshiba_automute
11443 #ifdef CONFIG_SND_DEBUG
11445 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11446 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11447 alc268_volume_init_verbs },
11448 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11449 .dac_nids = alc268_dac_nids,
11450 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11451 .adc_nids = alc268_adc_nids_alt,
11452 .capsrc_nids = alc268_capsrc_nids,
11454 .dig_out_nid = ALC268_DIGOUT_NID,
11455 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11456 .channel_mode = alc268_modes,
11457 .input_mux = &alc268_capture_source,
11462 static int patch_alc268(struct hda_codec *codec)
11464 struct alc_spec *spec;
11468 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11472 codec->spec = spec;
11474 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11478 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11479 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11480 "trying auto-probe from BIOS...\n");
11481 board_config = ALC268_AUTO;
11484 if (board_config == ALC268_AUTO) {
11485 /* automatic parse from the BIOS config */
11486 err = alc268_parse_auto_config(codec);
11492 "hda_codec: Cannot set up configuration "
11493 "from BIOS. Using base mode...\n");
11494 board_config = ALC268_3ST;
11498 if (board_config != ALC268_AUTO)
11499 setup_preset(spec, &alc268_presets[board_config]);
11501 if (codec->vendor_id == 0x10ec0267) {
11502 spec->stream_name_analog = "ALC267 Analog";
11503 spec->stream_name_digital = "ALC267 Digital";
11505 spec->stream_name_analog = "ALC268 Analog";
11506 spec->stream_name_digital = "ALC268 Digital";
11509 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11510 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11511 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11513 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11515 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11516 /* override the amp caps for beep generator */
11517 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11518 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11519 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11520 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11521 (0 << AC_AMPCAP_MUTE_SHIFT));
11523 if (!spec->adc_nids && spec->input_mux) {
11524 /* check whether NID 0x07 is valid */
11525 unsigned int wcap = get_wcaps(codec, 0x07);
11529 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11530 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11531 spec->adc_nids = alc268_adc_nids_alt;
11532 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11533 add_mixer(spec, alc268_capture_alt_mixer);
11535 spec->adc_nids = alc268_adc_nids;
11536 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11537 add_mixer(spec, alc268_capture_mixer);
11539 spec->capsrc_nids = alc268_capsrc_nids;
11540 /* set default input source */
11541 for (i = 0; i < spec->num_adc_nids; i++)
11542 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11543 0, AC_VERB_SET_CONNECT_SEL,
11544 spec->input_mux->items[0].index);
11547 spec->vmaster_nid = 0x02;
11549 codec->patch_ops = alc_patch_ops;
11550 if (board_config == ALC268_AUTO)
11551 spec->init_hook = alc268_auto_init;
11557 * ALC269 channel source setting (2 channel)
11559 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11561 #define alc269_dac_nids alc260_dac_nids
11563 static hda_nid_t alc269_adc_nids[1] = {
11568 static hda_nid_t alc269_capsrc_nids[1] = {
11572 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11576 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11584 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11592 #define alc269_modes alc260_modes
11593 #define alc269_capture_source alc880_lg_lw_capture_source
11595 static struct snd_kcontrol_new alc269_base_mixer[] = {
11596 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11597 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11598 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11599 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11600 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11601 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11602 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11603 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11604 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11605 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11606 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11607 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11608 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11609 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11613 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11614 /* output mixer control */
11615 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11617 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11618 .name = "Master Playback Switch",
11619 .info = snd_hda_mixer_amp_switch_info,
11620 .get = snd_hda_mixer_amp_switch_get,
11621 .put = alc268_acer_master_sw_put,
11622 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11625 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11626 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11627 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11628 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11629 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11630 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11631 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11635 /* bind volumes of both NID 0x0c and 0x0d */
11636 static struct hda_bind_ctls alc269_epc_bind_vol = {
11637 .ops = &snd_hda_bind_vol,
11639 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11640 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11645 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11646 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11647 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11648 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11652 /* capture mixer elements */
11653 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11654 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11655 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11660 static struct snd_kcontrol_new alc269_beep_mixer[] = {
11661 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11662 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11666 static struct hda_verb alc269_quanta_fl1_verbs[] = {
11667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11668 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11670 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11671 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11672 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11676 /* toggle speaker-output according to the hp-jack state */
11677 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11679 unsigned int present;
11680 unsigned char bits;
11682 present = snd_hda_codec_read(codec, 0x15, 0,
11683 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11684 bits = present ? AMP_IN_MUTE(0) : 0;
11685 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11686 AMP_IN_MUTE(0), bits);
11687 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11688 AMP_IN_MUTE(0), bits);
11690 snd_hda_codec_write(codec, 0x20, 0,
11691 AC_VERB_SET_COEF_INDEX, 0x0c);
11692 snd_hda_codec_write(codec, 0x20, 0,
11693 AC_VERB_SET_PROC_COEF, 0x680);
11695 snd_hda_codec_write(codec, 0x20, 0,
11696 AC_VERB_SET_COEF_INDEX, 0x0c);
11697 snd_hda_codec_write(codec, 0x20, 0,
11698 AC_VERB_SET_PROC_COEF, 0x480);
11701 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11703 unsigned int present;
11705 present = snd_hda_codec_read(codec, 0x18, 0,
11706 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11707 snd_hda_codec_write(codec, 0x23, 0,
11708 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11711 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11714 if ((res >> 26) == ALC880_HP_EVENT)
11715 alc269_quanta_fl1_speaker_automute(codec);
11716 if ((res >> 26) == ALC880_MIC_EVENT)
11717 alc269_quanta_fl1_mic_automute(codec);
11720 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
11722 alc269_quanta_fl1_speaker_automute(codec);
11723 alc269_quanta_fl1_mic_automute(codec);
11726 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11727 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11728 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
11729 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11730 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
11731 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11732 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11733 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11737 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11738 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11739 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
11740 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11741 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
11742 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11743 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11747 /* toggle speaker-output according to the hp-jack state */
11748 static void alc269_speaker_automute(struct hda_codec *codec)
11750 unsigned int present;
11751 unsigned char bits;
11753 present = snd_hda_codec_read(codec, 0x15, 0,
11754 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11755 bits = present ? AMP_IN_MUTE(0) : 0;
11756 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11757 AMP_IN_MUTE(0), bits);
11758 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11759 AMP_IN_MUTE(0), bits);
11762 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11764 unsigned int present;
11766 present = snd_hda_codec_read(codec, 0x18, 0,
11767 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11768 snd_hda_codec_write(codec, 0x23, 0,
11769 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
11772 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11774 unsigned int present;
11776 present = snd_hda_codec_read(codec, 0x18, 0,
11777 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11778 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11779 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11780 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11781 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11784 /* unsolicited event for HP jack sensing */
11785 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11788 if ((res >> 26) == ALC880_HP_EVENT)
11789 alc269_speaker_automute(codec);
11791 if ((res >> 26) == ALC880_MIC_EVENT)
11792 alc269_eeepc_dmic_automute(codec);
11795 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11797 alc269_speaker_automute(codec);
11798 alc269_eeepc_dmic_automute(codec);
11801 /* unsolicited event for HP jack sensing */
11802 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
11805 if ((res >> 26) == ALC880_HP_EVENT)
11806 alc269_speaker_automute(codec);
11808 if ((res >> 26) == ALC880_MIC_EVENT)
11809 alc269_eeepc_amic_automute(codec);
11812 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
11814 alc269_speaker_automute(codec);
11815 alc269_eeepc_amic_automute(codec);
11819 * generic initialization of ADC, input mixers and output mixers
11821 static struct hda_verb alc269_init_verbs[] = {
11823 * Unmute ADC0 and set the default input to mic-in
11825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11827 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11828 * analog-loopback mixer widget
11829 * Note: PASD motherboards uses the Line In 2 as the input for
11830 * front panel mic (mic 2)
11832 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11840 * Set up output mixers (0x0c - 0x0e)
11842 /* set vol=0 to output mixers */
11843 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11844 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11846 /* set up input amps for analog loopback */
11847 /* Amp Indices: DAC = 0, mixer = 1 */
11848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11850 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11855 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11856 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11857 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11858 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11859 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11860 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11861 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11865 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11866 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11867 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11868 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11869 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11871 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11872 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11874 /* FIXME: use matrix-type input source selection */
11875 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11876 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11877 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11878 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11879 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11880 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11883 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11884 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11888 /* add playback controls from the parsed DAC table */
11889 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11890 const struct auto_pin_cfg *cfg)
11895 spec->multiout.num_dacs = 1; /* only use one dac */
11896 spec->multiout.dac_nids = spec->private_dac_nids;
11897 spec->multiout.dac_nids[0] = 2;
11899 nid = cfg->line_out_pins[0];
11901 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11902 "Front Playback Volume",
11903 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
11906 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11907 "Front Playback Switch",
11908 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11913 nid = cfg->speaker_pins[0];
11915 if (!cfg->line_out_pins[0]) {
11916 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11917 "Speaker Playback Volume",
11918 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11924 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11925 "Speaker Playback Switch",
11926 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11931 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11932 "Speaker Playback Switch",
11933 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11939 nid = cfg->hp_pins[0];
11941 /* spec->multiout.hp_nid = 2; */
11942 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
11943 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11944 "Headphone Playback Volume",
11945 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11951 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11952 "Headphone Playback Switch",
11953 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11958 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11959 "Headphone Playback Switch",
11960 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11969 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
11970 const struct auto_pin_cfg *cfg)
11974 err = alc880_auto_create_analog_input_ctls(spec, cfg);
11977 /* digital-mic input pin is excluded in alc880_auto_create..()
11978 * because it's under 0x18
11980 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
11981 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
11982 struct hda_input_mux *imux = &spec->private_imux;
11983 imux->items[imux->num_items].label = "Int Mic";
11984 imux->items[imux->num_items].index = 0x05;
11990 #ifdef CONFIG_SND_HDA_POWER_SAVE
11991 #define alc269_loopbacks alc880_loopbacks
11994 /* pcm configuration: identiacal with ALC880 */
11995 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11996 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11997 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11998 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12001 * BIOS auto configuration
12003 static int alc269_parse_auto_config(struct hda_codec *codec)
12005 struct alc_spec *spec = codec->spec;
12007 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12009 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12014 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12017 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12021 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12023 if (spec->autocfg.dig_out_pin)
12024 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12026 if (spec->kctls.list)
12027 add_mixer(spec, spec->kctls.list);
12029 /* create a beep mixer control if the pin 0x1d isn't assigned */
12030 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12031 if (spec->autocfg.input_pins[i] == 0x1d)
12033 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12034 add_mixer(spec, alc269_beep_mixer);
12036 add_verb(spec, alc269_init_verbs);
12037 spec->num_mux_defs = 1;
12038 spec->input_mux = &spec->private_imux;
12039 /* set default input source */
12040 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12041 0, AC_VERB_SET_CONNECT_SEL,
12042 spec->input_mux->items[0].index);
12044 err = alc_auto_add_mic_boost(codec);
12048 if (!spec->cap_mixer)
12049 set_capture_mixer(spec);
12051 store_pin_configs(codec);
12055 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12056 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12057 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12060 /* init callback for auto-configuration model -- overriding the default init */
12061 static void alc269_auto_init(struct hda_codec *codec)
12063 struct alc_spec *spec = codec->spec;
12064 alc269_auto_init_multi_out(codec);
12065 alc269_auto_init_hp_out(codec);
12066 alc269_auto_init_analog_input(codec);
12067 if (spec->unsol_event)
12068 alc_inithook(codec);
12072 * configuration and preset
12074 static const char *alc269_models[ALC269_MODEL_LAST] = {
12075 [ALC269_BASIC] = "basic",
12076 [ALC269_QUANTA_FL1] = "quanta",
12077 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12078 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901"
12081 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12082 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12083 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12084 ALC269_ASUS_EEEPC_P703),
12085 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12086 ALC269_ASUS_EEEPC_P901),
12087 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12088 ALC269_ASUS_EEEPC_P901),
12092 static struct alc_config_preset alc269_presets[] = {
12094 .mixers = { alc269_base_mixer },
12095 .init_verbs = { alc269_init_verbs },
12096 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12097 .dac_nids = alc269_dac_nids,
12099 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12100 .channel_mode = alc269_modes,
12101 .input_mux = &alc269_capture_source,
12103 [ALC269_QUANTA_FL1] = {
12104 .mixers = { alc269_quanta_fl1_mixer },
12105 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12106 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12107 .dac_nids = alc269_dac_nids,
12109 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12110 .channel_mode = alc269_modes,
12111 .input_mux = &alc269_capture_source,
12112 .unsol_event = alc269_quanta_fl1_unsol_event,
12113 .init_hook = alc269_quanta_fl1_init_hook,
12115 [ALC269_ASUS_EEEPC_P703] = {
12116 .mixers = { alc269_eeepc_mixer },
12117 .cap_mixer = alc269_epc_capture_mixer,
12118 .init_verbs = { alc269_init_verbs,
12119 alc269_eeepc_amic_init_verbs },
12120 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12121 .dac_nids = alc269_dac_nids,
12123 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12124 .channel_mode = alc269_modes,
12125 .input_mux = &alc269_eeepc_amic_capture_source,
12126 .unsol_event = alc269_eeepc_amic_unsol_event,
12127 .init_hook = alc269_eeepc_amic_inithook,
12129 [ALC269_ASUS_EEEPC_P901] = {
12130 .mixers = { alc269_eeepc_mixer },
12131 .cap_mixer = alc269_epc_capture_mixer,
12132 .init_verbs = { alc269_init_verbs,
12133 alc269_eeepc_dmic_init_verbs },
12134 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12135 .dac_nids = alc269_dac_nids,
12137 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12138 .channel_mode = alc269_modes,
12139 .input_mux = &alc269_eeepc_dmic_capture_source,
12140 .unsol_event = alc269_eeepc_dmic_unsol_event,
12141 .init_hook = alc269_eeepc_dmic_inithook,
12145 static int patch_alc269(struct hda_codec *codec)
12147 struct alc_spec *spec;
12151 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12155 codec->spec = spec;
12157 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12159 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12163 if (board_config < 0) {
12164 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12165 "trying auto-probe from BIOS...\n");
12166 board_config = ALC269_AUTO;
12169 if (board_config == ALC269_AUTO) {
12170 /* automatic parse from the BIOS config */
12171 err = alc269_parse_auto_config(codec);
12177 "hda_codec: Cannot set up configuration "
12178 "from BIOS. Using base mode...\n");
12179 board_config = ALC269_BASIC;
12183 if (board_config != ALC269_AUTO)
12184 setup_preset(spec, &alc269_presets[board_config]);
12186 spec->stream_name_analog = "ALC269 Analog";
12187 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12188 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12190 spec->stream_name_digital = "ALC269 Digital";
12191 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12192 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12194 spec->adc_nids = alc269_adc_nids;
12195 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12196 spec->capsrc_nids = alc269_capsrc_nids;
12197 if (!spec->cap_mixer)
12198 set_capture_mixer(spec);
12200 codec->patch_ops = alc_patch_ops;
12201 if (board_config == ALC269_AUTO)
12202 spec->init_hook = alc269_auto_init;
12203 #ifdef CONFIG_SND_HDA_POWER_SAVE
12204 if (!spec->loopback.amplist)
12205 spec->loopback.amplist = alc269_loopbacks;
12212 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12216 * set the path ways for 2 channel output
12217 * need to set the codec line out and mic 1 pin widgets to inputs
12219 static struct hda_verb alc861_threestack_ch2_init[] = {
12220 /* set pin widget 1Ah (line in) for input */
12221 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12222 /* set pin widget 18h (mic1/2) for input, for mic also enable
12225 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12227 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12229 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12230 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12236 * need to set the codec line out and mic 1 pin widgets to outputs
12238 static struct hda_verb alc861_threestack_ch6_init[] = {
12239 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12240 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12241 /* set pin widget 18h (mic1) for output (CLFE)*/
12242 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12244 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12245 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12247 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12249 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12250 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12255 static struct hda_channel_mode alc861_threestack_modes[2] = {
12256 { 2, alc861_threestack_ch2_init },
12257 { 6, alc861_threestack_ch6_init },
12259 /* Set mic1 as input and unmute the mixer */
12260 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12261 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12262 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12265 /* Set mic1 as output and mute mixer */
12266 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12267 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12268 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12272 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12273 { 2, alc861_uniwill_m31_ch2_init },
12274 { 4, alc861_uniwill_m31_ch4_init },
12277 /* Set mic1 and line-in as input and unmute the mixer */
12278 static struct hda_verb alc861_asus_ch2_init[] = {
12279 /* set pin widget 1Ah (line in) for input */
12280 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12281 /* set pin widget 18h (mic1/2) for input, for mic also enable
12284 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12286 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12288 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12289 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12293 /* Set mic1 nad line-in as output and mute mixer */
12294 static struct hda_verb alc861_asus_ch6_init[] = {
12295 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12296 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12297 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12298 /* set pin widget 18h (mic1) for output (CLFE)*/
12299 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12300 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12301 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12302 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12304 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12306 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12307 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12312 static struct hda_channel_mode alc861_asus_modes[2] = {
12313 { 2, alc861_asus_ch2_init },
12314 { 6, alc861_asus_ch6_init },
12319 static struct snd_kcontrol_new alc861_base_mixer[] = {
12320 /* output mixer control */
12321 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12322 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12323 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12324 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12325 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12327 /*Input mixer control */
12328 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12329 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12330 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12331 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12332 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12333 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12335 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12336 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12342 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12343 /* output mixer control */
12344 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12345 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12346 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12347 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12348 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12350 /* Input mixer control */
12351 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12352 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12353 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12354 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12355 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12356 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12357 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12358 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12359 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12364 .name = "Channel Mode",
12365 .info = alc_ch_mode_info,
12366 .get = alc_ch_mode_get,
12367 .put = alc_ch_mode_put,
12368 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12373 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12374 /* output mixer control */
12375 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12377 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12382 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12383 /* output mixer control */
12384 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12385 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12386 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12387 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12388 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12390 /* Input mixer control */
12391 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12392 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12393 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12394 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12395 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12396 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12397 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12398 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12399 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12400 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12403 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12404 .name = "Channel Mode",
12405 .info = alc_ch_mode_info,
12406 .get = alc_ch_mode_get,
12407 .put = alc_ch_mode_put,
12408 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12413 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12414 /* output mixer control */
12415 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12416 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12417 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12418 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12419 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12421 /* Input mixer control */
12422 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12423 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12424 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12425 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12426 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12427 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12429 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12430 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12434 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12435 .name = "Channel Mode",
12436 .info = alc_ch_mode_info,
12437 .get = alc_ch_mode_get,
12438 .put = alc_ch_mode_put,
12439 .private_value = ARRAY_SIZE(alc861_asus_modes),
12444 /* additional mixer */
12445 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12446 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12447 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12448 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12449 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12454 * generic initialization of ADC, input mixers and output mixers
12456 static struct hda_verb alc861_base_init_verbs[] = {
12458 * Unmute ADC0 and set the default input to mic-in
12460 /* port-A for surround (rear panel) */
12461 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12462 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
12463 /* port-B for mic-in (rear panel) with vref */
12464 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12465 /* port-C for line-in (rear panel) */
12466 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12467 /* port-D for Front */
12468 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12469 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12470 /* port-E for HP out (front panel) */
12471 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12472 /* route front PCM to HP */
12473 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12474 /* port-F for mic-in (front panel) with vref */
12475 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12476 /* port-G for CLFE (rear panel) */
12477 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12478 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12479 /* port-H for side (rear panel) */
12480 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12481 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
12483 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12484 /* route front mic to ADC1*/
12485 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12486 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12488 /* Unmute DAC0~3 & spdif out*/
12489 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12490 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12491 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12492 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12495 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12496 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12497 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12498 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12499 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12501 /* Unmute Stereo Mixer 15 */
12502 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12503 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12507 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12508 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12509 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12510 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12511 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12513 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12514 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12515 /* hp used DAC 3 (Front) */
12516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12517 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12522 static struct hda_verb alc861_threestack_init_verbs[] = {
12524 * Unmute ADC0 and set the default input to mic-in
12526 /* port-A for surround (rear panel) */
12527 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12528 /* port-B for mic-in (rear panel) with vref */
12529 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12530 /* port-C for line-in (rear panel) */
12531 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12532 /* port-D for Front */
12533 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12534 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12535 /* port-E for HP out (front panel) */
12536 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12537 /* route front PCM to HP */
12538 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12539 /* port-F for mic-in (front panel) with vref */
12540 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12541 /* port-G for CLFE (rear panel) */
12542 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12543 /* port-H for side (rear panel) */
12544 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12546 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12547 /* route front mic to ADC1*/
12548 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12550 /* Unmute DAC0~3 & spdif out*/
12551 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12552 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12553 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12554 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12557 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12558 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12559 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12560 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12561 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12563 /* Unmute Stereo Mixer 15 */
12564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12566 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12569 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12570 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12571 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12572 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12573 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12574 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12575 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12576 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12577 /* hp used DAC 3 (Front) */
12578 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12579 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12583 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
12585 * Unmute ADC0 and set the default input to mic-in
12587 /* port-A for surround (rear panel) */
12588 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12589 /* port-B for mic-in (rear panel) with vref */
12590 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12591 /* port-C for line-in (rear panel) */
12592 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12593 /* port-D for Front */
12594 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12595 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12596 /* port-E for HP out (front panel) */
12597 /* this has to be set to VREF80 */
12598 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12599 /* route front PCM to HP */
12600 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12601 /* port-F for mic-in (front panel) with vref */
12602 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12603 /* port-G for CLFE (rear panel) */
12604 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12605 /* port-H for side (rear panel) */
12606 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12608 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12609 /* route front mic to ADC1*/
12610 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12612 /* Unmute DAC0~3 & spdif out*/
12613 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12614 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12615 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12616 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12619 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12620 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12621 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12622 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12623 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12625 /* Unmute Stereo Mixer 15 */
12626 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12631 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12632 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12633 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12634 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12635 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12636 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12637 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12639 /* hp used DAC 3 (Front) */
12640 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12645 static struct hda_verb alc861_asus_init_verbs[] = {
12647 * Unmute ADC0 and set the default input to mic-in
12649 /* port-A for surround (rear panel)
12650 * according to codec#0 this is the HP jack
12652 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12653 /* route front PCM to HP */
12654 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12655 /* port-B for mic-in (rear panel) with vref */
12656 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12657 /* port-C for line-in (rear panel) */
12658 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12659 /* port-D for Front */
12660 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12661 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12662 /* port-E for HP out (front panel) */
12663 /* this has to be set to VREF80 */
12664 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12665 /* route front PCM to HP */
12666 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12667 /* port-F for mic-in (front panel) with vref */
12668 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12669 /* port-G for CLFE (rear panel) */
12670 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12671 /* port-H for side (rear panel) */
12672 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12674 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12675 /* route front mic to ADC1*/
12676 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12677 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12678 /* Unmute DAC0~3 & spdif out*/
12679 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12680 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12681 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12682 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12683 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12684 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12685 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12686 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12687 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12688 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12690 /* Unmute Stereo Mixer 15 */
12691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12694 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12696 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12697 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12698 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12699 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12701 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12702 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12703 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12704 /* hp used DAC 3 (Front) */
12705 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12706 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12710 /* additional init verbs for ASUS laptops */
12711 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
12712 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
12713 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
12718 * generic initialization of ADC, input mixers and output mixers
12720 static struct hda_verb alc861_auto_init_verbs[] = {
12722 * Unmute ADC0 and set the default input to mic-in
12724 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12725 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12727 /* Unmute DAC0~3 & spdif out*/
12728 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12729 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12730 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12731 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12732 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12734 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12735 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12736 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12737 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12738 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12740 /* Unmute Stereo Mixer 15 */
12741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
12746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12748 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12749 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12750 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12752 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12756 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12758 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12759 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12760 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12761 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12762 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12764 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
12769 static struct hda_verb alc861_toshiba_init_verbs[] = {
12770 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12775 /* toggle speaker-output according to the hp-jack state */
12776 static void alc861_toshiba_automute(struct hda_codec *codec)
12778 unsigned int present;
12780 present = snd_hda_codec_read(codec, 0x0f, 0,
12781 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12782 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
12783 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12784 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
12785 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
12788 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
12791 if ((res >> 26) == ALC880_HP_EVENT)
12792 alc861_toshiba_automute(codec);
12795 /* pcm configuration: identiacal with ALC880 */
12796 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
12797 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
12798 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
12799 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
12802 #define ALC861_DIGOUT_NID 0x07
12804 static struct hda_channel_mode alc861_8ch_modes[1] = {
12808 static hda_nid_t alc861_dac_nids[4] = {
12809 /* front, surround, clfe, side */
12810 0x03, 0x06, 0x05, 0x04
12813 static hda_nid_t alc660_dac_nids[3] = {
12814 /* front, clfe, surround */
12818 static hda_nid_t alc861_adc_nids[1] = {
12823 static struct hda_input_mux alc861_capture_source = {
12827 { "Front Mic", 0x3 },
12834 /* fill in the dac_nids table from the parsed pin configuration */
12835 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
12836 const struct auto_pin_cfg *cfg)
12841 spec->multiout.dac_nids = spec->private_dac_nids;
12842 for (i = 0; i < cfg->line_outs; i++) {
12843 nid = cfg->line_out_pins[i];
12845 if (i >= ARRAY_SIZE(alc861_dac_nids))
12847 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
12850 spec->multiout.num_dacs = cfg->line_outs;
12854 /* add playback controls from the parsed DAC table */
12855 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
12856 const struct auto_pin_cfg *cfg)
12859 static const char *chname[4] = {
12860 "Front", "Surround", NULL /*CLFE*/, "Side"
12865 for (i = 0; i < cfg->line_outs; i++) {
12866 nid = spec->multiout.dac_nids[i];
12871 err = add_control(spec, ALC_CTL_BIND_MUTE,
12872 "Center Playback Switch",
12873 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12877 err = add_control(spec, ALC_CTL_BIND_MUTE,
12878 "LFE Playback Switch",
12879 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12884 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
12886 if (nid == alc861_dac_nids[idx])
12888 sprintf(name, "%s Playback Switch", chname[idx]);
12889 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12890 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12899 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
12907 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
12909 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12910 "Headphone Playback Switch",
12911 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12914 spec->multiout.hp_nid = nid;
12919 /* create playback/capture controls for input pins */
12920 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
12921 const struct auto_pin_cfg *cfg)
12923 struct hda_input_mux *imux = &spec->private_imux;
12924 int i, err, idx, idx1;
12926 for (i = 0; i < AUTO_PIN_LAST; i++) {
12927 switch (cfg->input_pins[i]) {
12930 idx = 2; /* Line In */
12934 idx = 2; /* Line In */
12938 idx = 1; /* Mic In */
12942 idx = 1; /* Mic In */
12952 err = new_analog_input(spec, cfg->input_pins[i],
12953 auto_pin_cfg_labels[i], idx, 0x15);
12957 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12958 imux->items[imux->num_items].index = idx1;
12964 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
12966 int pin_type, int dac_idx)
12968 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12970 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12974 static void alc861_auto_init_multi_out(struct hda_codec *codec)
12976 struct alc_spec *spec = codec->spec;
12979 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
12980 for (i = 0; i < spec->autocfg.line_outs; i++) {
12981 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12982 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12984 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
12985 spec->multiout.dac_nids[i]);
12989 static void alc861_auto_init_hp_out(struct hda_codec *codec)
12991 struct alc_spec *spec = codec->spec;
12994 pin = spec->autocfg.hp_pins[0];
12995 if (pin) /* connect to front */
12996 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
12997 spec->multiout.dac_nids[0]);
12998 pin = spec->autocfg.speaker_pins[0];
13000 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13003 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13005 struct alc_spec *spec = codec->spec;
13008 for (i = 0; i < AUTO_PIN_LAST; i++) {
13009 hda_nid_t nid = spec->autocfg.input_pins[i];
13010 if (nid >= 0x0c && nid <= 0x11) {
13011 snd_hda_codec_write(codec, nid, 0,
13012 AC_VERB_SET_PIN_WIDGET_CONTROL,
13013 i <= AUTO_PIN_FRONT_MIC ?
13014 PIN_VREF80 : PIN_IN);
13019 /* parse the BIOS configuration and set up the alc_spec */
13020 /* return 1 if successful, 0 if the proper config is not found,
13021 * or a negative error code
13023 static int alc861_parse_auto_config(struct hda_codec *codec)
13025 struct alc_spec *spec = codec->spec;
13027 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13029 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13033 if (!spec->autocfg.line_outs)
13034 return 0; /* can't find valid BIOS pin config */
13036 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13039 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13042 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13045 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13049 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13051 if (spec->autocfg.dig_out_pin)
13052 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13054 if (spec->kctls.list)
13055 add_mixer(spec, spec->kctls.list);
13057 add_verb(spec, alc861_auto_init_verbs);
13059 spec->num_mux_defs = 1;
13060 spec->input_mux = &spec->private_imux;
13062 spec->adc_nids = alc861_adc_nids;
13063 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13064 set_capture_mixer(spec);
13066 store_pin_configs(codec);
13070 /* additional initialization for auto-configuration model */
13071 static void alc861_auto_init(struct hda_codec *codec)
13073 struct alc_spec *spec = codec->spec;
13074 alc861_auto_init_multi_out(codec);
13075 alc861_auto_init_hp_out(codec);
13076 alc861_auto_init_analog_input(codec);
13077 if (spec->unsol_event)
13078 alc_inithook(codec);
13081 #ifdef CONFIG_SND_HDA_POWER_SAVE
13082 static struct hda_amp_list alc861_loopbacks[] = {
13083 { 0x15, HDA_INPUT, 0 },
13084 { 0x15, HDA_INPUT, 1 },
13085 { 0x15, HDA_INPUT, 2 },
13086 { 0x15, HDA_INPUT, 3 },
13093 * configuration and preset
13095 static const char *alc861_models[ALC861_MODEL_LAST] = {
13096 [ALC861_3ST] = "3stack",
13097 [ALC660_3ST] = "3stack-660",
13098 [ALC861_3ST_DIG] = "3stack-dig",
13099 [ALC861_6ST_DIG] = "6stack-dig",
13100 [ALC861_UNIWILL_M31] = "uniwill-m31",
13101 [ALC861_TOSHIBA] = "toshiba",
13102 [ALC861_ASUS] = "asus",
13103 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13104 [ALC861_AUTO] = "auto",
13107 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13108 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13109 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13110 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13111 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13112 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13113 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13114 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13115 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13116 * Any other models that need this preset?
13118 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13119 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13120 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13121 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13122 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13123 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13124 /* FIXME: the below seems conflict */
13125 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13126 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13127 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13131 static struct alc_config_preset alc861_presets[] = {
13133 .mixers = { alc861_3ST_mixer },
13134 .init_verbs = { alc861_threestack_init_verbs },
13135 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13136 .dac_nids = alc861_dac_nids,
13137 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13138 .channel_mode = alc861_threestack_modes,
13140 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13141 .adc_nids = alc861_adc_nids,
13142 .input_mux = &alc861_capture_source,
13144 [ALC861_3ST_DIG] = {
13145 .mixers = { alc861_base_mixer },
13146 .init_verbs = { alc861_threestack_init_verbs },
13147 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13148 .dac_nids = alc861_dac_nids,
13149 .dig_out_nid = ALC861_DIGOUT_NID,
13150 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13151 .channel_mode = alc861_threestack_modes,
13153 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13154 .adc_nids = alc861_adc_nids,
13155 .input_mux = &alc861_capture_source,
13157 [ALC861_6ST_DIG] = {
13158 .mixers = { alc861_base_mixer },
13159 .init_verbs = { alc861_base_init_verbs },
13160 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13161 .dac_nids = alc861_dac_nids,
13162 .dig_out_nid = ALC861_DIGOUT_NID,
13163 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13164 .channel_mode = alc861_8ch_modes,
13165 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13166 .adc_nids = alc861_adc_nids,
13167 .input_mux = &alc861_capture_source,
13170 .mixers = { alc861_3ST_mixer },
13171 .init_verbs = { alc861_threestack_init_verbs },
13172 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13173 .dac_nids = alc660_dac_nids,
13174 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13175 .channel_mode = alc861_threestack_modes,
13177 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13178 .adc_nids = alc861_adc_nids,
13179 .input_mux = &alc861_capture_source,
13181 [ALC861_UNIWILL_M31] = {
13182 .mixers = { alc861_uniwill_m31_mixer },
13183 .init_verbs = { alc861_uniwill_m31_init_verbs },
13184 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13185 .dac_nids = alc861_dac_nids,
13186 .dig_out_nid = ALC861_DIGOUT_NID,
13187 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13188 .channel_mode = alc861_uniwill_m31_modes,
13190 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13191 .adc_nids = alc861_adc_nids,
13192 .input_mux = &alc861_capture_source,
13194 [ALC861_TOSHIBA] = {
13195 .mixers = { alc861_toshiba_mixer },
13196 .init_verbs = { alc861_base_init_verbs,
13197 alc861_toshiba_init_verbs },
13198 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13199 .dac_nids = alc861_dac_nids,
13200 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13201 .channel_mode = alc883_3ST_2ch_modes,
13202 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13203 .adc_nids = alc861_adc_nids,
13204 .input_mux = &alc861_capture_source,
13205 .unsol_event = alc861_toshiba_unsol_event,
13206 .init_hook = alc861_toshiba_automute,
13209 .mixers = { alc861_asus_mixer },
13210 .init_verbs = { alc861_asus_init_verbs },
13211 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13212 .dac_nids = alc861_dac_nids,
13213 .dig_out_nid = ALC861_DIGOUT_NID,
13214 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13215 .channel_mode = alc861_asus_modes,
13218 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13219 .adc_nids = alc861_adc_nids,
13220 .input_mux = &alc861_capture_source,
13222 [ALC861_ASUS_LAPTOP] = {
13223 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13224 .init_verbs = { alc861_asus_init_verbs,
13225 alc861_asus_laptop_init_verbs },
13226 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13227 .dac_nids = alc861_dac_nids,
13228 .dig_out_nid = ALC861_DIGOUT_NID,
13229 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13230 .channel_mode = alc883_3ST_2ch_modes,
13232 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13233 .adc_nids = alc861_adc_nids,
13234 .input_mux = &alc861_capture_source,
13239 static int patch_alc861(struct hda_codec *codec)
13241 struct alc_spec *spec;
13245 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13249 codec->spec = spec;
13251 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13255 if (board_config < 0) {
13256 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13257 "trying auto-probe from BIOS...\n");
13258 board_config = ALC861_AUTO;
13261 if (board_config == ALC861_AUTO) {
13262 /* automatic parse from the BIOS config */
13263 err = alc861_parse_auto_config(codec);
13269 "hda_codec: Cannot set up configuration "
13270 "from BIOS. Using base mode...\n");
13271 board_config = ALC861_3ST_DIG;
13275 if (board_config != ALC861_AUTO)
13276 setup_preset(spec, &alc861_presets[board_config]);
13278 spec->stream_name_analog = "ALC861 Analog";
13279 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13280 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13282 spec->stream_name_digital = "ALC861 Digital";
13283 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13284 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13286 spec->vmaster_nid = 0x03;
13288 codec->patch_ops = alc_patch_ops;
13289 if (board_config == ALC861_AUTO)
13290 spec->init_hook = alc861_auto_init;
13291 #ifdef CONFIG_SND_HDA_POWER_SAVE
13292 if (!spec->loopback.amplist)
13293 spec->loopback.amplist = alc861_loopbacks;
13300 * ALC861-VD support
13304 * In addition, an independent DAC
13306 #define ALC861VD_DIGOUT_NID 0x06
13308 static hda_nid_t alc861vd_dac_nids[4] = {
13309 /* front, surr, clfe, side surr */
13310 0x02, 0x03, 0x04, 0x05
13313 /* dac_nids for ALC660vd are in a different order - according to
13314 * Realtek's driver.
13315 * This should probably tesult in a different mixer for 6stack models
13316 * of ALC660vd codecs, but for now there is only 3stack mixer
13317 * - and it is the same as in 861vd.
13318 * adc_nids in ALC660vd are (is) the same as in 861vd
13320 static hda_nid_t alc660vd_dac_nids[3] = {
13321 /* front, rear, clfe, rear_surr */
13325 static hda_nid_t alc861vd_adc_nids[1] = {
13330 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13333 /* FIXME: should be a matrix-type input source selection */
13334 static struct hda_input_mux alc861vd_capture_source = {
13338 { "Front Mic", 0x1 },
13344 static struct hda_input_mux alc861vd_dallas_capture_source = {
13347 { "Ext Mic", 0x0 },
13348 { "Int Mic", 0x1 },
13352 static struct hda_input_mux alc861vd_hp_capture_source = {
13355 { "Front Mic", 0x0 },
13356 { "ATAPI Mic", 0x1 },
13363 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13370 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13371 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13372 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13373 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13374 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13381 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13382 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13383 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13384 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13385 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13389 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13390 { 6, alc861vd_6stack_ch6_init },
13391 { 8, alc861vd_6stack_ch8_init },
13394 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13396 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13397 .name = "Channel Mode",
13398 .info = alc_ch_mode_info,
13399 .get = alc_ch_mode_get,
13400 .put = alc_ch_mode_put,
13405 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13406 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13408 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13409 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13410 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13412 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13413 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13415 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13417 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13419 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13420 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13422 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13423 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13427 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13431 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13432 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13435 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13436 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13438 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13439 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13441 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13442 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13447 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13448 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13449 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13451 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13453 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13457 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13458 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13459 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13461 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13462 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13464 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13465 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13467 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13468 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13473 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
13474 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13475 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13476 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13478 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13480 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13481 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13482 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13484 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13485 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13486 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13488 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13489 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13494 /* Pin assignment: Speaker=0x14, HP = 0x15,
13495 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
13497 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
13498 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13499 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
13500 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13501 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13502 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13503 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13504 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13505 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13506 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13507 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13508 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
13509 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
13513 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
13514 * Front Mic=0x18, ATAPI Mic = 0x19,
13516 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
13517 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13518 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13520 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13521 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13522 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13523 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13524 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13530 * generic initialization of ADC, input mixers and output mixers
13532 static struct hda_verb alc861vd_volume_init_verbs[] = {
13534 * Unmute ADC0 and set the default input to mic-in
13536 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13537 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13539 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13540 * the analog-loopback mixer widget
13542 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13549 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13556 * Set up output mixers (0x02 - 0x05)
13558 /* set vol=0 to output mixers */
13559 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13560 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13561 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13562 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13564 /* set up input amps for analog loopback */
13565 /* Amp Indices: DAC = 0, mixer = 1 */
13566 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13567 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13568 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13569 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13570 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13571 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13572 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13573 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13579 * 3-stack pin configuration:
13580 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13582 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13584 * Set pin mode and muting
13586 /* set front pin widgets 0x14 for output */
13587 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13588 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13589 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13591 /* Mic (rear) pin: input vref at 80% */
13592 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13593 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13594 /* Front Mic pin: input vref at 80% */
13595 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13596 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13597 /* Line In pin: input */
13598 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13599 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13600 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13601 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13602 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13603 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13604 /* CD pin widget for input */
13605 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13611 * 6-stack pin configuration:
13613 static struct hda_verb alc861vd_6stack_init_verbs[] = {
13615 * Set pin mode and muting
13617 /* set front pin widgets 0x14 for output */
13618 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13619 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13620 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13622 /* Rear Pin: output 1 (0x0d) */
13623 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13625 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13626 /* CLFE Pin: output 2 (0x0e) */
13627 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13628 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13629 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13630 /* Side Pin: output 3 (0x0f) */
13631 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13632 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13633 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13635 /* Mic (rear) pin: input vref at 80% */
13636 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13637 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13638 /* Front Mic pin: input vref at 80% */
13639 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13640 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13641 /* Line In pin: input */
13642 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13643 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13644 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13645 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13646 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13647 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13648 /* CD pin widget for input */
13649 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13654 static struct hda_verb alc861vd_eapd_verbs[] = {
13655 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13659 static struct hda_verb alc660vd_eapd_verbs[] = {
13660 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13661 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13665 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13668 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13669 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13670 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13674 /* toggle speaker-output according to the hp-jack state */
13675 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
13677 unsigned int present;
13678 unsigned char bits;
13680 present = snd_hda_codec_read(codec, 0x1b, 0,
13681 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13682 bits = present ? HDA_AMP_MUTE : 0;
13683 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13684 HDA_AMP_MUTE, bits);
13687 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
13689 unsigned int present;
13690 unsigned char bits;
13692 present = snd_hda_codec_read(codec, 0x18, 0,
13693 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13694 bits = present ? HDA_AMP_MUTE : 0;
13695 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
13696 HDA_AMP_MUTE, bits);
13699 static void alc861vd_lenovo_automute(struct hda_codec *codec)
13701 alc861vd_lenovo_hp_automute(codec);
13702 alc861vd_lenovo_mic_automute(codec);
13705 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
13708 switch (res >> 26) {
13709 case ALC880_HP_EVENT:
13710 alc861vd_lenovo_hp_automute(codec);
13712 case ALC880_MIC_EVENT:
13713 alc861vd_lenovo_mic_automute(codec);
13718 static struct hda_verb alc861vd_dallas_verbs[] = {
13719 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13720 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13721 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13722 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13726 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13728 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13731 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13734 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13738 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13739 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13740 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13742 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13743 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13744 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13745 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13746 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13747 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13748 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13749 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13752 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13753 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13754 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13756 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13757 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13758 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13763 /* toggle speaker-output according to the hp-jack state */
13764 static void alc861vd_dallas_automute(struct hda_codec *codec)
13766 unsigned int present;
13768 present = snd_hda_codec_read(codec, 0x15, 0,
13769 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13770 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13771 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13774 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
13776 if ((res >> 26) == ALC880_HP_EVENT)
13777 alc861vd_dallas_automute(codec);
13780 #ifdef CONFIG_SND_HDA_POWER_SAVE
13781 #define alc861vd_loopbacks alc880_loopbacks
13784 /* pcm configuration: identiacal with ALC880 */
13785 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
13786 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
13787 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
13788 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
13791 * configuration and preset
13793 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
13794 [ALC660VD_3ST] = "3stack-660",
13795 [ALC660VD_3ST_DIG] = "3stack-660-digout",
13796 [ALC861VD_3ST] = "3stack",
13797 [ALC861VD_3ST_DIG] = "3stack-digout",
13798 [ALC861VD_6ST_DIG] = "6stack-digout",
13799 [ALC861VD_LENOVO] = "lenovo",
13800 [ALC861VD_DALLAS] = "dallas",
13801 [ALC861VD_HP] = "hp",
13802 [ALC861VD_AUTO] = "auto",
13805 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
13806 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
13807 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
13808 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
13809 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
13810 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO),
13811 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
13812 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
13813 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
13814 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
13815 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
13816 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
13817 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
13818 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
13819 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
13820 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
13821 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
13822 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
13826 static struct alc_config_preset alc861vd_presets[] = {
13828 .mixers = { alc861vd_3st_mixer },
13829 .init_verbs = { alc861vd_volume_init_verbs,
13830 alc861vd_3stack_init_verbs },
13831 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13832 .dac_nids = alc660vd_dac_nids,
13833 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13834 .channel_mode = alc861vd_3stack_2ch_modes,
13835 .input_mux = &alc861vd_capture_source,
13837 [ALC660VD_3ST_DIG] = {
13838 .mixers = { alc861vd_3st_mixer },
13839 .init_verbs = { alc861vd_volume_init_verbs,
13840 alc861vd_3stack_init_verbs },
13841 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13842 .dac_nids = alc660vd_dac_nids,
13843 .dig_out_nid = ALC861VD_DIGOUT_NID,
13844 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13845 .channel_mode = alc861vd_3stack_2ch_modes,
13846 .input_mux = &alc861vd_capture_source,
13849 .mixers = { alc861vd_3st_mixer },
13850 .init_verbs = { alc861vd_volume_init_verbs,
13851 alc861vd_3stack_init_verbs },
13852 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13853 .dac_nids = alc861vd_dac_nids,
13854 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13855 .channel_mode = alc861vd_3stack_2ch_modes,
13856 .input_mux = &alc861vd_capture_source,
13858 [ALC861VD_3ST_DIG] = {
13859 .mixers = { alc861vd_3st_mixer },
13860 .init_verbs = { alc861vd_volume_init_verbs,
13861 alc861vd_3stack_init_verbs },
13862 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13863 .dac_nids = alc861vd_dac_nids,
13864 .dig_out_nid = ALC861VD_DIGOUT_NID,
13865 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13866 .channel_mode = alc861vd_3stack_2ch_modes,
13867 .input_mux = &alc861vd_capture_source,
13869 [ALC861VD_6ST_DIG] = {
13870 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
13871 .init_verbs = { alc861vd_volume_init_verbs,
13872 alc861vd_6stack_init_verbs },
13873 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13874 .dac_nids = alc861vd_dac_nids,
13875 .dig_out_nid = ALC861VD_DIGOUT_NID,
13876 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
13877 .channel_mode = alc861vd_6stack_modes,
13878 .input_mux = &alc861vd_capture_source,
13880 [ALC861VD_LENOVO] = {
13881 .mixers = { alc861vd_lenovo_mixer },
13882 .init_verbs = { alc861vd_volume_init_verbs,
13883 alc861vd_3stack_init_verbs,
13884 alc861vd_eapd_verbs,
13885 alc861vd_lenovo_unsol_verbs },
13886 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13887 .dac_nids = alc660vd_dac_nids,
13888 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13889 .channel_mode = alc861vd_3stack_2ch_modes,
13890 .input_mux = &alc861vd_capture_source,
13891 .unsol_event = alc861vd_lenovo_unsol_event,
13892 .init_hook = alc861vd_lenovo_automute,
13894 [ALC861VD_DALLAS] = {
13895 .mixers = { alc861vd_dallas_mixer },
13896 .init_verbs = { alc861vd_dallas_verbs },
13897 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13898 .dac_nids = alc861vd_dac_nids,
13899 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13900 .channel_mode = alc861vd_3stack_2ch_modes,
13901 .input_mux = &alc861vd_dallas_capture_source,
13902 .unsol_event = alc861vd_dallas_unsol_event,
13903 .init_hook = alc861vd_dallas_automute,
13906 .mixers = { alc861vd_hp_mixer },
13907 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
13908 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13909 .dac_nids = alc861vd_dac_nids,
13910 .dig_out_nid = ALC861VD_DIGOUT_NID,
13911 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13912 .channel_mode = alc861vd_3stack_2ch_modes,
13913 .input_mux = &alc861vd_hp_capture_source,
13914 .unsol_event = alc861vd_dallas_unsol_event,
13915 .init_hook = alc861vd_dallas_automute,
13920 * BIOS auto configuration
13922 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
13923 hda_nid_t nid, int pin_type, int dac_idx)
13925 alc_set_pin_output(codec, nid, pin_type);
13928 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
13930 struct alc_spec *spec = codec->spec;
13933 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13934 for (i = 0; i <= HDA_SIDE; i++) {
13935 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13936 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13938 alc861vd_auto_set_output_and_unmute(codec, nid,
13944 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
13946 struct alc_spec *spec = codec->spec;
13949 pin = spec->autocfg.hp_pins[0];
13950 if (pin) /* connect to front and use dac 0 */
13951 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13952 pin = spec->autocfg.speaker_pins[0];
13954 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13957 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13958 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13960 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
13962 struct alc_spec *spec = codec->spec;
13965 for (i = 0; i < AUTO_PIN_LAST; i++) {
13966 hda_nid_t nid = spec->autocfg.input_pins[i];
13967 if (alc861vd_is_input_pin(nid)) {
13968 snd_hda_codec_write(codec, nid, 0,
13969 AC_VERB_SET_PIN_WIDGET_CONTROL,
13970 i <= AUTO_PIN_FRONT_MIC ?
13971 PIN_VREF80 : PIN_IN);
13972 if (nid != ALC861VD_PIN_CD_NID)
13973 snd_hda_codec_write(codec, nid, 0,
13974 AC_VERB_SET_AMP_GAIN_MUTE,
13980 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
13982 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13983 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13985 /* add playback controls from the parsed DAC table */
13986 /* Based on ALC880 version. But ALC861VD has separate,
13987 * different NIDs for mute/unmute switch and volume control */
13988 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
13989 const struct auto_pin_cfg *cfg)
13992 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
13993 hda_nid_t nid_v, nid_s;
13996 for (i = 0; i < cfg->line_outs; i++) {
13997 if (!spec->multiout.dac_nids[i])
13999 nid_v = alc861vd_idx_to_mixer_vol(
14001 spec->multiout.dac_nids[i]));
14002 nid_s = alc861vd_idx_to_mixer_switch(
14004 spec->multiout.dac_nids[i]));
14008 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14009 "Center Playback Volume",
14010 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14014 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14015 "LFE Playback Volume",
14016 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14020 err = add_control(spec, ALC_CTL_BIND_MUTE,
14021 "Center Playback Switch",
14022 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14026 err = add_control(spec, ALC_CTL_BIND_MUTE,
14027 "LFE Playback Switch",
14028 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14033 sprintf(name, "%s Playback Volume", chname[i]);
14034 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14035 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14039 sprintf(name, "%s Playback Switch", chname[i]);
14040 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14041 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14050 /* add playback controls for speaker and HP outputs */
14051 /* Based on ALC880 version. But ALC861VD has separate,
14052 * different NIDs for mute/unmute switch and volume control */
14053 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14054 hda_nid_t pin, const char *pfx)
14056 hda_nid_t nid_v, nid_s;
14063 if (alc880_is_fixed_pin(pin)) {
14064 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14065 /* specify the DAC as the extra output */
14066 if (!spec->multiout.hp_nid)
14067 spec->multiout.hp_nid = nid_v;
14069 spec->multiout.extra_out_nid[0] = nid_v;
14070 /* control HP volume/switch on the output mixer amp */
14071 nid_v = alc861vd_idx_to_mixer_vol(
14072 alc880_fixed_pin_idx(pin));
14073 nid_s = alc861vd_idx_to_mixer_switch(
14074 alc880_fixed_pin_idx(pin));
14076 sprintf(name, "%s Playback Volume", pfx);
14077 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14078 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14081 sprintf(name, "%s Playback Switch", pfx);
14082 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14083 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14086 } else if (alc880_is_multi_pin(pin)) {
14087 /* set manual connection */
14088 /* we have only a switch on HP-out PIN */
14089 sprintf(name, "%s Playback Switch", pfx);
14090 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14091 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14098 /* parse the BIOS configuration and set up the alc_spec
14099 * return 1 if successful, 0 if the proper config is not found,
14100 * or a negative error code
14101 * Based on ALC880 version - had to change it to override
14102 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14103 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14105 struct alc_spec *spec = codec->spec;
14107 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14109 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14113 if (!spec->autocfg.line_outs)
14114 return 0; /* can't find valid BIOS pin config */
14116 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14119 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14122 err = alc861vd_auto_create_extra_out(spec,
14123 spec->autocfg.speaker_pins[0],
14127 err = alc861vd_auto_create_extra_out(spec,
14128 spec->autocfg.hp_pins[0],
14132 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14136 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14138 if (spec->autocfg.dig_out_pin)
14139 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14141 if (spec->kctls.list)
14142 add_mixer(spec, spec->kctls.list);
14144 add_verb(spec, alc861vd_volume_init_verbs);
14146 spec->num_mux_defs = 1;
14147 spec->input_mux = &spec->private_imux;
14149 err = alc_auto_add_mic_boost(codec);
14153 store_pin_configs(codec);
14157 /* additional initialization for auto-configuration model */
14158 static void alc861vd_auto_init(struct hda_codec *codec)
14160 struct alc_spec *spec = codec->spec;
14161 alc861vd_auto_init_multi_out(codec);
14162 alc861vd_auto_init_hp_out(codec);
14163 alc861vd_auto_init_analog_input(codec);
14164 alc861vd_auto_init_input_src(codec);
14165 if (spec->unsol_event)
14166 alc_inithook(codec);
14169 static int patch_alc861vd(struct hda_codec *codec)
14171 struct alc_spec *spec;
14172 int err, board_config;
14174 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14178 codec->spec = spec;
14180 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14184 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14185 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14186 "ALC861VD, trying auto-probe from BIOS...\n");
14187 board_config = ALC861VD_AUTO;
14190 if (board_config == ALC861VD_AUTO) {
14191 /* automatic parse from the BIOS config */
14192 err = alc861vd_parse_auto_config(codec);
14198 "hda_codec: Cannot set up configuration "
14199 "from BIOS. Using base mode...\n");
14200 board_config = ALC861VD_3ST;
14204 if (board_config != ALC861VD_AUTO)
14205 setup_preset(spec, &alc861vd_presets[board_config]);
14207 if (codec->vendor_id == 0x10ec0660) {
14208 spec->stream_name_analog = "ALC660-VD Analog";
14209 spec->stream_name_digital = "ALC660-VD Digital";
14210 /* always turn on EAPD */
14211 add_verb(spec, alc660vd_eapd_verbs);
14213 spec->stream_name_analog = "ALC861VD Analog";
14214 spec->stream_name_digital = "ALC861VD Digital";
14217 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14218 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14220 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14221 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14223 spec->adc_nids = alc861vd_adc_nids;
14224 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14225 spec->capsrc_nids = alc861vd_capsrc_nids;
14226 spec->is_mix_capture = 1;
14228 set_capture_mixer(spec);
14230 spec->vmaster_nid = 0x02;
14232 codec->patch_ops = alc_patch_ops;
14234 if (board_config == ALC861VD_AUTO)
14235 spec->init_hook = alc861vd_auto_init;
14236 #ifdef CONFIG_SND_HDA_POWER_SAVE
14237 if (!spec->loopback.amplist)
14238 spec->loopback.amplist = alc861vd_loopbacks;
14247 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14248 * configuration. Each pin widget can choose any input DACs and a mixer.
14249 * Each ADC is connected from a mixer of all inputs. This makes possible
14250 * 6-channel independent captures.
14252 * In addition, an independent DAC for the multi-playback (not used in this
14255 #define ALC662_DIGOUT_NID 0x06
14256 #define ALC662_DIGIN_NID 0x0a
14258 static hda_nid_t alc662_dac_nids[4] = {
14259 /* front, rear, clfe, rear_surr */
14263 static hda_nid_t alc662_adc_nids[1] = {
14268 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14271 /* FIXME: should be a matrix-type input source selection */
14272 static struct hda_input_mux alc662_capture_source = {
14276 { "Front Mic", 0x1 },
14282 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14290 static struct hda_input_mux alc662_eeepc_capture_source = {
14298 static struct hda_input_mux alc663_capture_source = {
14302 { "Front Mic", 0x1 },
14307 static struct hda_input_mux alc663_m51va_capture_source = {
14310 { "Ext-Mic", 0x0 },
14318 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14325 static struct hda_verb alc662_3ST_ch2_init[] = {
14326 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14327 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14328 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14329 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14336 static struct hda_verb alc662_3ST_ch6_init[] = {
14337 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14338 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14339 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14340 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14341 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14342 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14346 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14347 { 2, alc662_3ST_ch2_init },
14348 { 6, alc662_3ST_ch6_init },
14354 static struct hda_verb alc662_sixstack_ch6_init[] = {
14355 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14356 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14357 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14364 static struct hda_verb alc662_sixstack_ch8_init[] = {
14365 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14366 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14367 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14371 static struct hda_channel_mode alc662_5stack_modes[2] = {
14372 { 2, alc662_sixstack_ch6_init },
14373 { 6, alc662_sixstack_ch8_init },
14376 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14377 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14380 static struct snd_kcontrol_new alc662_base_mixer[] = {
14381 /* output mixer control */
14382 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14383 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14384 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14385 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14386 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14387 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14388 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14389 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14390 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14392 /*Input mixer control */
14393 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14394 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14395 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14396 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14397 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14398 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14399 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14400 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14404 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14405 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14406 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14407 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14408 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14409 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14410 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14411 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14413 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14414 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14415 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14416 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14417 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14421 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14422 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14423 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14424 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14425 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14426 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14427 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14428 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14429 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14430 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14431 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14432 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14433 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14434 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14437 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14438 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14439 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14440 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14444 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
14445 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14446 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
14447 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14448 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
14449 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14450 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14451 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14452 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14453 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14457 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
14458 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14460 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14461 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14463 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
14464 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14465 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14467 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
14468 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14469 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14473 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
14474 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14475 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14476 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14477 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
14478 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14479 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14480 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
14481 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
14482 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14483 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
14484 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14485 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14487 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14491 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14492 .ops = &snd_hda_bind_vol,
14494 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14495 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14500 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14501 .ops = &snd_hda_bind_sw,
14503 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14504 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14509 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14510 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14511 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14517 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14518 .ops = &snd_hda_bind_sw,
14520 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14521 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14522 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14527 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14528 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14529 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14530 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14531 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14532 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14533 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14538 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14539 .ops = &snd_hda_bind_sw,
14541 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14542 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14543 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14548 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14549 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14550 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14553 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14554 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14558 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
14559 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14560 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14563 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14564 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14565 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14569 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14570 .ops = &snd_hda_bind_vol,
14572 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14573 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14578 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14579 .ops = &snd_hda_bind_sw,
14581 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14582 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14587 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14588 HDA_BIND_VOL("Master Playback Volume",
14589 &alc663_asus_two_bind_master_vol),
14590 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14591 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14598 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14599 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14600 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14601 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14602 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14608 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
14609 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14610 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14611 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14612 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14617 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14618 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14622 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
14623 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14624 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14627 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14629 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14630 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14631 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14632 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14636 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
14638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14639 .name = "Channel Mode",
14640 .info = alc_ch_mode_info,
14641 .get = alc_ch_mode_get,
14642 .put = alc_ch_mode_put,
14647 static struct hda_verb alc662_init_verbs[] = {
14648 /* ADC: mute amp left and right */
14649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14650 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14651 /* Front mixer: unmute input/output amp left and right (volume = 0) */
14653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14655 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14656 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14657 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14666 /* Front Pin: output 0 (0x0c) */
14667 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14668 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14670 /* Rear Pin: output 1 (0x0d) */
14671 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14672 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14674 /* CLFE Pin: output 2 (0x0e) */
14675 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14676 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14678 /* Mic (rear) pin: input vref at 80% */
14679 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14680 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14681 /* Front Mic pin: input vref at 80% */
14682 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14684 /* Line In pin: input */
14685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14687 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14689 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14690 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14691 /* CD pin widget for input */
14692 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14694 /* FIXME: use matrix-type input source selection */
14695 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14697 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14699 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14700 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14702 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14707 /* always trun on EAPD */
14708 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14709 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14714 static struct hda_verb alc662_sue_init_verbs[] = {
14715 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14716 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14720 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
14721 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14722 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14726 /* Set Unsolicited Event*/
14727 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
14728 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14729 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14734 * generic initialization of ADC, input mixers and output mixers
14736 static struct hda_verb alc662_auto_init_verbs[] = {
14738 * Unmute ADC and set the default input to mic-in
14740 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14743 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
14745 * Note: PASD motherboards uses the Line In 2 as the input for front
14746 * panel mic (mic 2)
14748 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14749 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14750 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14751 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14752 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14753 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14756 * Set up output mixers (0x0c - 0x0f)
14758 /* set vol=0 to output mixers */
14759 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14760 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14761 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14763 /* set up input amps for analog loopback */
14764 /* Amp Indices: DAC = 0, mixer = 1 */
14765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14767 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14768 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14769 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14770 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14773 /* FIXME: use matrix-type input source selection */
14774 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14777 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14781 /* additional verbs for ALC663 */
14782 static struct hda_verb alc663_auto_init_verbs[] = {
14783 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14784 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14788 static struct hda_verb alc663_m51va_init_verbs[] = {
14789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14790 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14791 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14792 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14793 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14794 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14795 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
14796 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14797 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14801 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
14802 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14803 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14804 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14805 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14806 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14807 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14808 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14812 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
14813 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14814 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14815 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14816 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14819 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14820 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14824 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
14825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14826 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14827 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14830 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14831 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14835 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
14836 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14837 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14838 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14839 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
14840 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14841 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
14843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14845 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14846 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14847 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14851 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
14852 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14853 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14854 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14855 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14856 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14857 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14858 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14861 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14862 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14863 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14867 static struct hda_verb alc663_g71v_init_verbs[] = {
14868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14869 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
14870 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
14872 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14873 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14874 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14876 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14877 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
14878 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14882 static struct hda_verb alc663_g50v_init_verbs[] = {
14883 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14884 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14885 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14887 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14888 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14892 static struct hda_verb alc662_ecs_init_verbs[] = {
14893 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
14894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14895 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14896 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14900 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
14901 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14902 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14906 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
14908 unsigned int present;
14909 unsigned char bits;
14911 present = snd_hda_codec_read(codec, 0x14, 0,
14912 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14913 bits = present ? HDA_AMP_MUTE : 0;
14914 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14915 HDA_AMP_MUTE, bits);
14918 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
14920 unsigned int present;
14921 unsigned char bits;
14923 present = snd_hda_codec_read(codec, 0x1b, 0,
14924 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14925 bits = present ? HDA_AMP_MUTE : 0;
14926 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14927 HDA_AMP_MUTE, bits);
14928 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14929 HDA_AMP_MUTE, bits);
14932 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
14935 if ((res >> 26) == ALC880_HP_EVENT)
14936 alc662_lenovo_101e_all_automute(codec);
14937 if ((res >> 26) == ALC880_FRONT_EVENT)
14938 alc662_lenovo_101e_ispeaker_automute(codec);
14941 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
14943 unsigned int present;
14945 present = snd_hda_codec_read(codec, 0x18, 0,
14946 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14947 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14948 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14949 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14950 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14951 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14952 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
14953 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14954 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
14957 /* unsolicited event for HP jack sensing */
14958 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
14961 if ((res >> 26) == ALC880_HP_EVENT)
14962 alc262_hippo1_automute( codec );
14964 if ((res >> 26) == ALC880_MIC_EVENT)
14965 alc662_eeepc_mic_automute(codec);
14968 static void alc662_eeepc_inithook(struct hda_codec *codec)
14970 alc262_hippo1_automute( codec );
14971 alc662_eeepc_mic_automute(codec);
14974 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
14977 unsigned int present;
14979 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
14980 present = snd_hda_codec_read(codec, 0x14, 0,
14981 AC_VERB_GET_PIN_SENSE, 0);
14982 present = (present & 0x80000000) != 0;
14984 /* mute internal speaker */
14985 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14986 HDA_AMP_MUTE, HDA_AMP_MUTE);
14988 /* unmute internal speaker if necessary */
14989 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
14990 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14991 HDA_AMP_MUTE, mute);
14995 /* unsolicited event for HP jack sensing */
14996 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
14999 if ((res >> 26) == ALC880_HP_EVENT)
15000 alc662_eeepc_ep20_automute(codec);
15003 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15005 alc662_eeepc_ep20_automute(codec);
15008 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15010 unsigned int present;
15011 unsigned char bits;
15013 present = snd_hda_codec_read(codec, 0x21, 0,
15014 AC_VERB_GET_PIN_SENSE, 0)
15015 & AC_PINSENSE_PRESENCE;
15016 bits = present ? HDA_AMP_MUTE : 0;
15017 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15018 AMP_IN_MUTE(0), bits);
15019 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15020 AMP_IN_MUTE(0), bits);
15023 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15025 unsigned int present;
15026 unsigned char bits;
15028 present = snd_hda_codec_read(codec, 0x21, 0,
15029 AC_VERB_GET_PIN_SENSE, 0)
15030 & AC_PINSENSE_PRESENCE;
15031 bits = present ? HDA_AMP_MUTE : 0;
15032 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15033 AMP_IN_MUTE(0), bits);
15034 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15035 AMP_IN_MUTE(0), bits);
15036 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15037 AMP_IN_MUTE(0), bits);
15038 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15039 AMP_IN_MUTE(0), bits);
15042 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15044 unsigned int present;
15045 unsigned char bits;
15047 present = snd_hda_codec_read(codec, 0x15, 0,
15048 AC_VERB_GET_PIN_SENSE, 0)
15049 & AC_PINSENSE_PRESENCE;
15050 bits = present ? HDA_AMP_MUTE : 0;
15051 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15052 AMP_IN_MUTE(0), bits);
15053 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15054 AMP_IN_MUTE(0), bits);
15055 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15056 AMP_IN_MUTE(0), bits);
15057 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15058 AMP_IN_MUTE(0), bits);
15061 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15063 unsigned int present;
15064 unsigned char bits;
15066 present = snd_hda_codec_read(codec, 0x1b, 0,
15067 AC_VERB_GET_PIN_SENSE, 0)
15068 & AC_PINSENSE_PRESENCE;
15069 bits = present ? 0 : PIN_OUT;
15070 snd_hda_codec_write(codec, 0x14, 0,
15071 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15074 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15076 unsigned int present1, present2;
15078 present1 = snd_hda_codec_read(codec, 0x21, 0,
15079 AC_VERB_GET_PIN_SENSE, 0)
15080 & AC_PINSENSE_PRESENCE;
15081 present2 = snd_hda_codec_read(codec, 0x15, 0,
15082 AC_VERB_GET_PIN_SENSE, 0)
15083 & AC_PINSENSE_PRESENCE;
15085 if (present1 || present2) {
15086 snd_hda_codec_write_cache(codec, 0x14, 0,
15087 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15089 snd_hda_codec_write_cache(codec, 0x14, 0,
15090 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15094 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15096 unsigned int present1, present2;
15098 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15099 AC_VERB_GET_PIN_SENSE, 0)
15100 & AC_PINSENSE_PRESENCE;
15101 present2 = snd_hda_codec_read(codec, 0x15, 0,
15102 AC_VERB_GET_PIN_SENSE, 0)
15103 & AC_PINSENSE_PRESENCE;
15105 if (present1 || present2) {
15106 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15107 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15108 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15109 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15111 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15112 AMP_IN_MUTE(0), 0);
15113 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15114 AMP_IN_MUTE(0), 0);
15118 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15120 unsigned int present;
15122 present = snd_hda_codec_read(codec, 0x18, 0,
15123 AC_VERB_GET_PIN_SENSE, 0)
15124 & AC_PINSENSE_PRESENCE;
15125 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15126 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15127 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15128 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15129 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15130 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15131 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15132 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15135 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15138 switch (res >> 26) {
15139 case ALC880_HP_EVENT:
15140 alc663_m51va_speaker_automute(codec);
15142 case ALC880_MIC_EVENT:
15143 alc663_m51va_mic_automute(codec);
15148 static void alc663_m51va_inithook(struct hda_codec *codec)
15150 alc663_m51va_speaker_automute(codec);
15151 alc663_m51va_mic_automute(codec);
15154 /* ***************** Mode1 ******************************/
15155 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15158 switch (res >> 26) {
15159 case ALC880_HP_EVENT:
15160 alc663_m51va_speaker_automute(codec);
15162 case ALC880_MIC_EVENT:
15163 alc662_eeepc_mic_automute(codec);
15168 static void alc663_mode1_inithook(struct hda_codec *codec)
15170 alc663_m51va_speaker_automute(codec);
15171 alc662_eeepc_mic_automute(codec);
15173 /* ***************** Mode2 ******************************/
15174 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15177 switch (res >> 26) {
15178 case ALC880_HP_EVENT:
15179 alc662_f5z_speaker_automute(codec);
15181 case ALC880_MIC_EVENT:
15182 alc662_eeepc_mic_automute(codec);
15187 static void alc662_mode2_inithook(struct hda_codec *codec)
15189 alc662_f5z_speaker_automute(codec);
15190 alc662_eeepc_mic_automute(codec);
15192 /* ***************** Mode3 ******************************/
15193 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15196 switch (res >> 26) {
15197 case ALC880_HP_EVENT:
15198 alc663_two_hp_m1_speaker_automute(codec);
15200 case ALC880_MIC_EVENT:
15201 alc662_eeepc_mic_automute(codec);
15206 static void alc663_mode3_inithook(struct hda_codec *codec)
15208 alc663_two_hp_m1_speaker_automute(codec);
15209 alc662_eeepc_mic_automute(codec);
15211 /* ***************** Mode4 ******************************/
15212 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15215 switch (res >> 26) {
15216 case ALC880_HP_EVENT:
15217 alc663_21jd_two_speaker_automute(codec);
15219 case ALC880_MIC_EVENT:
15220 alc662_eeepc_mic_automute(codec);
15225 static void alc663_mode4_inithook(struct hda_codec *codec)
15227 alc663_21jd_two_speaker_automute(codec);
15228 alc662_eeepc_mic_automute(codec);
15230 /* ***************** Mode5 ******************************/
15231 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15234 switch (res >> 26) {
15235 case ALC880_HP_EVENT:
15236 alc663_15jd_two_speaker_automute(codec);
15238 case ALC880_MIC_EVENT:
15239 alc662_eeepc_mic_automute(codec);
15244 static void alc663_mode5_inithook(struct hda_codec *codec)
15246 alc663_15jd_two_speaker_automute(codec);
15247 alc662_eeepc_mic_automute(codec);
15249 /* ***************** Mode6 ******************************/
15250 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15253 switch (res >> 26) {
15254 case ALC880_HP_EVENT:
15255 alc663_two_hp_m2_speaker_automute(codec);
15257 case ALC880_MIC_EVENT:
15258 alc662_eeepc_mic_automute(codec);
15263 static void alc663_mode6_inithook(struct hda_codec *codec)
15265 alc663_two_hp_m2_speaker_automute(codec);
15266 alc662_eeepc_mic_automute(codec);
15269 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15271 unsigned int present;
15272 unsigned char bits;
15274 present = snd_hda_codec_read(codec, 0x21, 0,
15275 AC_VERB_GET_PIN_SENSE, 0)
15276 & AC_PINSENSE_PRESENCE;
15277 bits = present ? HDA_AMP_MUTE : 0;
15278 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15279 HDA_AMP_MUTE, bits);
15280 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15281 HDA_AMP_MUTE, bits);
15284 static void alc663_g71v_front_automute(struct hda_codec *codec)
15286 unsigned int present;
15287 unsigned char bits;
15289 present = snd_hda_codec_read(codec, 0x15, 0,
15290 AC_VERB_GET_PIN_SENSE, 0)
15291 & AC_PINSENSE_PRESENCE;
15292 bits = present ? HDA_AMP_MUTE : 0;
15293 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15294 HDA_AMP_MUTE, bits);
15297 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15300 switch (res >> 26) {
15301 case ALC880_HP_EVENT:
15302 alc663_g71v_hp_automute(codec);
15304 case ALC880_FRONT_EVENT:
15305 alc663_g71v_front_automute(codec);
15307 case ALC880_MIC_EVENT:
15308 alc662_eeepc_mic_automute(codec);
15313 static void alc663_g71v_inithook(struct hda_codec *codec)
15315 alc663_g71v_front_automute(codec);
15316 alc663_g71v_hp_automute(codec);
15317 alc662_eeepc_mic_automute(codec);
15320 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15323 switch (res >> 26) {
15324 case ALC880_HP_EVENT:
15325 alc663_m51va_speaker_automute(codec);
15327 case ALC880_MIC_EVENT:
15328 alc662_eeepc_mic_automute(codec);
15333 static void alc663_g50v_inithook(struct hda_codec *codec)
15335 alc663_m51va_speaker_automute(codec);
15336 alc662_eeepc_mic_automute(codec);
15339 /* bind hp and internal speaker mute (with plug check) */
15340 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15341 struct snd_ctl_elem_value *ucontrol)
15343 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15344 long *valp = ucontrol->value.integer.value;
15347 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15349 valp[0] ? 0 : HDA_AMP_MUTE);
15350 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15352 valp[1] ? 0 : HDA_AMP_MUTE);
15354 alc262_hippo1_automute(codec);
15358 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15359 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15361 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15362 .name = "Master Playback Switch",
15363 .info = snd_hda_mixer_amp_switch_info,
15364 .get = snd_hda_mixer_amp_switch_get,
15365 .put = alc662_ecs_master_sw_put,
15366 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15369 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15370 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15371 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15373 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15374 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15375 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15379 #ifdef CONFIG_SND_HDA_POWER_SAVE
15380 #define alc662_loopbacks alc880_loopbacks
15384 /* pcm configuration: identiacal with ALC880 */
15385 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15386 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15387 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15388 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15391 * configuration and preset
15393 static const char *alc662_models[ALC662_MODEL_LAST] = {
15394 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15395 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15396 [ALC662_3ST_6ch] = "3stack-6ch",
15397 [ALC662_5ST_DIG] = "6stack-dig",
15398 [ALC662_LENOVO_101E] = "lenovo-101e",
15399 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15400 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15401 [ALC662_ECS] = "ecs",
15402 [ALC663_ASUS_M51VA] = "m51va",
15403 [ALC663_ASUS_G71V] = "g71v",
15404 [ALC663_ASUS_H13] = "h13",
15405 [ALC663_ASUS_G50V] = "g50v",
15406 [ALC663_ASUS_MODE1] = "asus-mode1",
15407 [ALC662_ASUS_MODE2] = "asus-mode2",
15408 [ALC663_ASUS_MODE3] = "asus-mode3",
15409 [ALC663_ASUS_MODE4] = "asus-mode4",
15410 [ALC663_ASUS_MODE5] = "asus-mode5",
15411 [ALC663_ASUS_MODE6] = "asus-mode6",
15412 [ALC662_AUTO] = "auto",
15415 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15416 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15417 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15418 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15419 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15420 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15421 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15422 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15423 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15424 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15425 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15426 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15427 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15428 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15429 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15430 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15431 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15432 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15433 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15434 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15435 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15436 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15437 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15438 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15439 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15440 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15441 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15442 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15443 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15444 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15445 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15446 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15447 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15448 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15449 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15450 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15451 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15452 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15453 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15454 ALC662_3ST_6ch_DIG),
15455 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15456 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15457 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15458 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15459 ALC662_3ST_6ch_DIG),
15460 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15461 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15462 ALC662_3ST_6ch_DIG),
15463 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15464 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15465 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
15469 static struct alc_config_preset alc662_presets[] = {
15470 [ALC662_3ST_2ch_DIG] = {
15471 .mixers = { alc662_3ST_2ch_mixer },
15472 .init_verbs = { alc662_init_verbs },
15473 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15474 .dac_nids = alc662_dac_nids,
15475 .dig_out_nid = ALC662_DIGOUT_NID,
15476 .dig_in_nid = ALC662_DIGIN_NID,
15477 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15478 .channel_mode = alc662_3ST_2ch_modes,
15479 .input_mux = &alc662_capture_source,
15481 [ALC662_3ST_6ch_DIG] = {
15482 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
15483 .init_verbs = { alc662_init_verbs },
15484 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15485 .dac_nids = alc662_dac_nids,
15486 .dig_out_nid = ALC662_DIGOUT_NID,
15487 .dig_in_nid = ALC662_DIGIN_NID,
15488 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15489 .channel_mode = alc662_3ST_6ch_modes,
15491 .input_mux = &alc662_capture_source,
15493 [ALC662_3ST_6ch] = {
15494 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
15495 .init_verbs = { alc662_init_verbs },
15496 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15497 .dac_nids = alc662_dac_nids,
15498 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15499 .channel_mode = alc662_3ST_6ch_modes,
15501 .input_mux = &alc662_capture_source,
15503 [ALC662_5ST_DIG] = {
15504 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
15505 .init_verbs = { alc662_init_verbs },
15506 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15507 .dac_nids = alc662_dac_nids,
15508 .dig_out_nid = ALC662_DIGOUT_NID,
15509 .dig_in_nid = ALC662_DIGIN_NID,
15510 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
15511 .channel_mode = alc662_5stack_modes,
15512 .input_mux = &alc662_capture_source,
15514 [ALC662_LENOVO_101E] = {
15515 .mixers = { alc662_lenovo_101e_mixer },
15516 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
15517 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15518 .dac_nids = alc662_dac_nids,
15519 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15520 .channel_mode = alc662_3ST_2ch_modes,
15521 .input_mux = &alc662_lenovo_101e_capture_source,
15522 .unsol_event = alc662_lenovo_101e_unsol_event,
15523 .init_hook = alc662_lenovo_101e_all_automute,
15525 [ALC662_ASUS_EEEPC_P701] = {
15526 .mixers = { alc662_eeepc_p701_mixer },
15527 .init_verbs = { alc662_init_verbs,
15528 alc662_eeepc_sue_init_verbs },
15529 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15530 .dac_nids = alc662_dac_nids,
15531 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15532 .channel_mode = alc662_3ST_2ch_modes,
15533 .input_mux = &alc662_eeepc_capture_source,
15534 .unsol_event = alc662_eeepc_unsol_event,
15535 .init_hook = alc662_eeepc_inithook,
15537 [ALC662_ASUS_EEEPC_EP20] = {
15538 .mixers = { alc662_eeepc_ep20_mixer,
15539 alc662_chmode_mixer },
15540 .init_verbs = { alc662_init_verbs,
15541 alc662_eeepc_ep20_sue_init_verbs },
15542 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15543 .dac_nids = alc662_dac_nids,
15544 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15545 .channel_mode = alc662_3ST_6ch_modes,
15546 .input_mux = &alc662_lenovo_101e_capture_source,
15547 .unsol_event = alc662_eeepc_ep20_unsol_event,
15548 .init_hook = alc662_eeepc_ep20_inithook,
15551 .mixers = { alc662_ecs_mixer },
15552 .init_verbs = { alc662_init_verbs,
15553 alc662_ecs_init_verbs },
15554 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15555 .dac_nids = alc662_dac_nids,
15556 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15557 .channel_mode = alc662_3ST_2ch_modes,
15558 .input_mux = &alc662_eeepc_capture_source,
15559 .unsol_event = alc662_eeepc_unsol_event,
15560 .init_hook = alc662_eeepc_inithook,
15562 [ALC663_ASUS_M51VA] = {
15563 .mixers = { alc663_m51va_mixer },
15564 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15565 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15566 .dac_nids = alc662_dac_nids,
15567 .dig_out_nid = ALC662_DIGOUT_NID,
15568 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15569 .channel_mode = alc662_3ST_2ch_modes,
15570 .input_mux = &alc663_m51va_capture_source,
15571 .unsol_event = alc663_m51va_unsol_event,
15572 .init_hook = alc663_m51va_inithook,
15574 [ALC663_ASUS_G71V] = {
15575 .mixers = { alc663_g71v_mixer },
15576 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
15577 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15578 .dac_nids = alc662_dac_nids,
15579 .dig_out_nid = ALC662_DIGOUT_NID,
15580 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15581 .channel_mode = alc662_3ST_2ch_modes,
15582 .input_mux = &alc662_eeepc_capture_source,
15583 .unsol_event = alc663_g71v_unsol_event,
15584 .init_hook = alc663_g71v_inithook,
15586 [ALC663_ASUS_H13] = {
15587 .mixers = { alc663_m51va_mixer },
15588 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15589 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15590 .dac_nids = alc662_dac_nids,
15591 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15592 .channel_mode = alc662_3ST_2ch_modes,
15593 .input_mux = &alc663_m51va_capture_source,
15594 .unsol_event = alc663_m51va_unsol_event,
15595 .init_hook = alc663_m51va_inithook,
15597 [ALC663_ASUS_G50V] = {
15598 .mixers = { alc663_g50v_mixer },
15599 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
15600 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15601 .dac_nids = alc662_dac_nids,
15602 .dig_out_nid = ALC662_DIGOUT_NID,
15603 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15604 .channel_mode = alc662_3ST_6ch_modes,
15605 .input_mux = &alc663_capture_source,
15606 .unsol_event = alc663_g50v_unsol_event,
15607 .init_hook = alc663_g50v_inithook,
15609 [ALC663_ASUS_MODE1] = {
15610 .mixers = { alc663_m51va_mixer },
15611 .cap_mixer = alc662_auto_capture_mixer,
15612 .init_verbs = { alc662_init_verbs,
15613 alc663_21jd_amic_init_verbs },
15614 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15616 .dac_nids = alc662_dac_nids,
15617 .dig_out_nid = ALC662_DIGOUT_NID,
15618 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15619 .channel_mode = alc662_3ST_2ch_modes,
15620 .input_mux = &alc662_eeepc_capture_source,
15621 .unsol_event = alc663_mode1_unsol_event,
15622 .init_hook = alc663_mode1_inithook,
15624 [ALC662_ASUS_MODE2] = {
15625 .mixers = { alc662_1bjd_mixer },
15626 .cap_mixer = alc662_auto_capture_mixer,
15627 .init_verbs = { alc662_init_verbs,
15628 alc662_1bjd_amic_init_verbs },
15629 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15630 .dac_nids = alc662_dac_nids,
15631 .dig_out_nid = ALC662_DIGOUT_NID,
15632 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15633 .channel_mode = alc662_3ST_2ch_modes,
15634 .input_mux = &alc662_eeepc_capture_source,
15635 .unsol_event = alc662_mode2_unsol_event,
15636 .init_hook = alc662_mode2_inithook,
15638 [ALC663_ASUS_MODE3] = {
15639 .mixers = { alc663_two_hp_m1_mixer },
15640 .cap_mixer = alc662_auto_capture_mixer,
15641 .init_verbs = { alc662_init_verbs,
15642 alc663_two_hp_amic_m1_init_verbs },
15643 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15645 .dac_nids = alc662_dac_nids,
15646 .dig_out_nid = ALC662_DIGOUT_NID,
15647 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15648 .channel_mode = alc662_3ST_2ch_modes,
15649 .input_mux = &alc662_eeepc_capture_source,
15650 .unsol_event = alc663_mode3_unsol_event,
15651 .init_hook = alc663_mode3_inithook,
15653 [ALC663_ASUS_MODE4] = {
15654 .mixers = { alc663_asus_21jd_clfe_mixer },
15655 .cap_mixer = alc662_auto_capture_mixer,
15656 .init_verbs = { alc662_init_verbs,
15657 alc663_21jd_amic_init_verbs},
15658 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15660 .dac_nids = alc662_dac_nids,
15661 .dig_out_nid = ALC662_DIGOUT_NID,
15662 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15663 .channel_mode = alc662_3ST_2ch_modes,
15664 .input_mux = &alc662_eeepc_capture_source,
15665 .unsol_event = alc663_mode4_unsol_event,
15666 .init_hook = alc663_mode4_inithook,
15668 [ALC663_ASUS_MODE5] = {
15669 .mixers = { alc663_asus_15jd_clfe_mixer },
15670 .cap_mixer = alc662_auto_capture_mixer,
15671 .init_verbs = { alc662_init_verbs,
15672 alc663_15jd_amic_init_verbs },
15673 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15675 .dac_nids = alc662_dac_nids,
15676 .dig_out_nid = ALC662_DIGOUT_NID,
15677 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15678 .channel_mode = alc662_3ST_2ch_modes,
15679 .input_mux = &alc662_eeepc_capture_source,
15680 .unsol_event = alc663_mode5_unsol_event,
15681 .init_hook = alc663_mode5_inithook,
15683 [ALC663_ASUS_MODE6] = {
15684 .mixers = { alc663_two_hp_m2_mixer },
15685 .cap_mixer = alc662_auto_capture_mixer,
15686 .init_verbs = { alc662_init_verbs,
15687 alc663_two_hp_amic_m2_init_verbs },
15688 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15690 .dac_nids = alc662_dac_nids,
15691 .dig_out_nid = ALC662_DIGOUT_NID,
15692 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15693 .channel_mode = alc662_3ST_2ch_modes,
15694 .input_mux = &alc662_eeepc_capture_source,
15695 .unsol_event = alc663_mode6_unsol_event,
15696 .init_hook = alc663_mode6_inithook,
15702 * BIOS auto configuration
15705 /* add playback controls from the parsed DAC table */
15706 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
15707 const struct auto_pin_cfg *cfg)
15710 static const char *chname[4] = {
15711 "Front", "Surround", NULL /*CLFE*/, "Side"
15716 for (i = 0; i < cfg->line_outs; i++) {
15717 if (!spec->multiout.dac_nids[i])
15719 nid = alc880_idx_to_dac(i);
15722 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15723 "Center Playback Volume",
15724 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
15728 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15729 "LFE Playback Volume",
15730 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
15734 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
15735 "Center Playback Switch",
15736 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
15740 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
15741 "LFE Playback Switch",
15742 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
15747 sprintf(name, "%s Playback Volume", chname[i]);
15748 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15749 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
15753 sprintf(name, "%s Playback Switch", chname[i]);
15754 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15755 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
15764 /* add playback controls for speaker and HP outputs */
15765 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
15776 /* ALC663 has a mono output pin on 0x17 */
15777 sprintf(name, "%s Playback Switch", pfx);
15778 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15779 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
15783 if (alc880_is_fixed_pin(pin)) {
15784 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15785 /* printk("DAC nid=%x\n",nid); */
15786 /* specify the DAC as the extra output */
15787 if (!spec->multiout.hp_nid)
15788 spec->multiout.hp_nid = nid;
15790 spec->multiout.extra_out_nid[0] = nid;
15791 /* control HP volume/switch on the output mixer amp */
15792 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15793 sprintf(name, "%s Playback Volume", pfx);
15794 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15795 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
15798 sprintf(name, "%s Playback Switch", pfx);
15799 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15800 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
15803 } else if (alc880_is_multi_pin(pin)) {
15804 /* set manual connection */
15805 /* we have only a switch on HP-out PIN */
15806 sprintf(name, "%s Playback Switch", pfx);
15807 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15808 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15815 /* create playback/capture controls for input pins */
15816 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
15817 const struct auto_pin_cfg *cfg)
15819 struct hda_input_mux *imux = &spec->private_imux;
15822 for (i = 0; i < AUTO_PIN_LAST; i++) {
15823 if (alc880_is_input_pin(cfg->input_pins[i])) {
15824 idx = alc880_input_pin_idx(cfg->input_pins[i]);
15825 err = new_analog_input(spec, cfg->input_pins[i],
15826 auto_pin_cfg_labels[i],
15830 imux->items[imux->num_items].label =
15831 auto_pin_cfg_labels[i];
15832 imux->items[imux->num_items].index =
15833 alc880_input_pin_idx(cfg->input_pins[i]);
15840 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
15841 hda_nid_t nid, int pin_type,
15844 alc_set_pin_output(codec, nid, pin_type);
15845 /* need the manual connection? */
15846 if (alc880_is_multi_pin(nid)) {
15847 struct alc_spec *spec = codec->spec;
15848 int idx = alc880_multi_pin_idx(nid);
15849 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
15850 AC_VERB_SET_CONNECT_SEL,
15851 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
15855 static void alc662_auto_init_multi_out(struct hda_codec *codec)
15857 struct alc_spec *spec = codec->spec;
15860 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
15861 for (i = 0; i <= HDA_SIDE; i++) {
15862 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15863 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15865 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
15870 static void alc662_auto_init_hp_out(struct hda_codec *codec)
15872 struct alc_spec *spec = codec->spec;
15875 pin = spec->autocfg.hp_pins[0];
15876 if (pin) /* connect to front */
15878 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15879 pin = spec->autocfg.speaker_pins[0];
15881 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15884 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
15885 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
15887 static void alc662_auto_init_analog_input(struct hda_codec *codec)
15889 struct alc_spec *spec = codec->spec;
15892 for (i = 0; i < AUTO_PIN_LAST; i++) {
15893 hda_nid_t nid = spec->autocfg.input_pins[i];
15894 if (alc662_is_input_pin(nid)) {
15895 snd_hda_codec_write(codec, nid, 0,
15896 AC_VERB_SET_PIN_WIDGET_CONTROL,
15897 (i <= AUTO_PIN_FRONT_MIC ?
15898 PIN_VREF80 : PIN_IN));
15899 if (nid != ALC662_PIN_CD_NID)
15900 snd_hda_codec_write(codec, nid, 0,
15901 AC_VERB_SET_AMP_GAIN_MUTE,
15907 #define alc662_auto_init_input_src alc882_auto_init_input_src
15909 static int alc662_parse_auto_config(struct hda_codec *codec)
15911 struct alc_spec *spec = codec->spec;
15913 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
15915 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15919 if (!spec->autocfg.line_outs)
15920 return 0; /* can't find valid BIOS pin config */
15922 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15925 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
15928 err = alc662_auto_create_extra_out(spec,
15929 spec->autocfg.speaker_pins[0],
15933 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
15937 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
15941 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15943 if (spec->autocfg.dig_out_pin)
15944 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
15946 if (spec->kctls.list)
15947 add_mixer(spec, spec->kctls.list);
15949 spec->num_mux_defs = 1;
15950 spec->input_mux = &spec->private_imux;
15952 add_verb(spec, alc662_auto_init_verbs);
15953 if (codec->vendor_id == 0x10ec0663)
15954 add_verb(spec, alc663_auto_init_verbs);
15956 err = alc_auto_add_mic_boost(codec);
15960 store_pin_configs(codec);
15964 /* additional initialization for auto-configuration model */
15965 static void alc662_auto_init(struct hda_codec *codec)
15967 struct alc_spec *spec = codec->spec;
15968 alc662_auto_init_multi_out(codec);
15969 alc662_auto_init_hp_out(codec);
15970 alc662_auto_init_analog_input(codec);
15971 alc662_auto_init_input_src(codec);
15972 if (spec->unsol_event)
15973 alc_inithook(codec);
15976 static int patch_alc662(struct hda_codec *codec)
15978 struct alc_spec *spec;
15979 int err, board_config;
15981 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15985 codec->spec = spec;
15987 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15989 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
15992 if (board_config < 0) {
15993 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
15994 "trying auto-probe from BIOS...\n");
15995 board_config = ALC662_AUTO;
15998 if (board_config == ALC662_AUTO) {
15999 /* automatic parse from the BIOS config */
16000 err = alc662_parse_auto_config(codec);
16006 "hda_codec: Cannot set up configuration "
16007 "from BIOS. Using base mode...\n");
16008 board_config = ALC662_3ST_2ch_DIG;
16012 if (board_config != ALC662_AUTO)
16013 setup_preset(spec, &alc662_presets[board_config]);
16015 if (codec->vendor_id == 0x10ec0663) {
16016 spec->stream_name_analog = "ALC663 Analog";
16017 spec->stream_name_digital = "ALC663 Digital";
16018 } else if (codec->vendor_id == 0x10ec0272) {
16019 spec->stream_name_analog = "ALC272 Analog";
16020 spec->stream_name_digital = "ALC272 Digital";
16022 spec->stream_name_analog = "ALC662 Analog";
16023 spec->stream_name_digital = "ALC662 Digital";
16026 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16027 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16029 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16030 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16032 spec->adc_nids = alc662_adc_nids;
16033 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16034 spec->capsrc_nids = alc662_capsrc_nids;
16035 spec->is_mix_capture = 1;
16037 if (!spec->cap_mixer)
16038 set_capture_mixer(spec);
16040 spec->vmaster_nid = 0x02;
16042 codec->patch_ops = alc_patch_ops;
16043 if (board_config == ALC662_AUTO)
16044 spec->init_hook = alc662_auto_init;
16045 #ifdef CONFIG_SND_HDA_POWER_SAVE
16046 if (!spec->loopback.amplist)
16047 spec->loopback.amplist = alc662_loopbacks;
16056 struct hda_codec_preset snd_hda_preset_realtek[] = {
16057 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16058 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16059 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16060 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16061 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16062 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16063 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16064 .patch = patch_alc861 },
16065 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16066 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16067 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16068 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16069 .patch = patch_alc883 },
16070 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16071 .patch = patch_alc662 },
16072 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16073 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16074 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16075 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16076 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16077 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16078 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16079 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16080 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16081 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16082 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16083 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16084 .patch = patch_alc883 },
16085 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16086 {} /* terminator */