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"
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,
109 ALC262_MODEL_LAST /* last tag */
119 ALC268_ACER_ASPIRE_ONE,
122 #ifdef CONFIG_SND_DEBUG
126 ALC268_MODEL_LAST /* last tag */
133 ALC269_ASUS_EEEPC_P703,
134 ALC269_ASUS_EEEPC_P901,
138 ALC269_MODEL_LAST /* last tag */
155 /* ALC861-VD models */
177 ALC662_ASUS_EEEPC_P701,
178 ALC662_ASUS_EEEPC_EP20,
217 ALC883_TARGA_2ch_DIG,
220 ALC888_ACER_ASPIRE_4930G,
224 ALC883_LENOVO_101E_2ch,
225 ALC883_LENOVO_NB0763,
226 ALC888_LENOVO_MS7195_DIG,
233 ALC883_FUJITSU_PI2515,
234 ALC888_FUJITSU_XA3530,
235 ALC883_3ST_6ch_INTEL,
243 /* styles of capture selection */
245 CAPT_MUX = 0, /* only mux based */
246 CAPT_MIX, /* only mixer based */
247 CAPT_1MUX_MIX, /* first mux and other mixers */
251 #define GPIO_MASK 0x03
254 /* codec parameterization */
255 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
256 unsigned int num_mixers;
257 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
258 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
260 const struct hda_verb *init_verbs[5]; /* initialization verbs
264 unsigned int num_init_verbs;
266 char *stream_name_analog; /* analog PCM stream */
267 struct hda_pcm_stream *stream_analog_playback;
268 struct hda_pcm_stream *stream_analog_capture;
269 struct hda_pcm_stream *stream_analog_alt_playback;
270 struct hda_pcm_stream *stream_analog_alt_capture;
272 char *stream_name_digital; /* digital PCM stream */
273 struct hda_pcm_stream *stream_digital_playback;
274 struct hda_pcm_stream *stream_digital_capture;
277 struct hda_multi_out multiout; /* playback set-up
278 * max_channels, dacs must be set
279 * dig_out_nid and hp_nid are optional
281 hda_nid_t alt_dac_nid;
285 unsigned int num_adc_nids;
287 hda_nid_t *capsrc_nids;
288 hda_nid_t dig_in_nid; /* digital-in NID; optional */
289 int capture_style; /* capture style (CAPT_*) */
292 unsigned int num_mux_defs;
293 const struct hda_input_mux *input_mux;
294 unsigned int cur_mux[3];
297 const struct hda_channel_mode *channel_mode;
298 int num_channel_mode;
301 /* PCM information */
302 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
304 /* dynamic controls, init_verbs and input_mux */
305 struct auto_pin_cfg autocfg;
306 struct snd_array kctls;
307 struct hda_input_mux private_imux[3];
308 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
311 void (*init_hook)(struct hda_codec *codec);
312 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
314 /* for pin sensing */
315 unsigned int sense_updated: 1;
316 unsigned int jack_present: 1;
317 unsigned int master_sw: 1;
320 unsigned int no_analog :1; /* digital I/O only */
322 /* for virtual master */
323 hda_nid_t vmaster_nid;
324 #ifdef CONFIG_SND_HDA_POWER_SAVE
325 struct hda_loopback_check loopback;
330 unsigned int pll_coef_idx, pll_coef_bit;
332 #ifdef SND_HDA_NEEDS_RESUME
333 #define ALC_MAX_PINS 16
334 unsigned int num_pins;
335 hda_nid_t pin_nids[ALC_MAX_PINS];
336 unsigned int pin_cfgs[ALC_MAX_PINS];
341 * configuration template - to be copied to the spec instance
343 struct alc_config_preset {
344 struct snd_kcontrol_new *mixers[5]; /* should be identical size
347 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
348 const struct hda_verb *init_verbs[5];
349 unsigned int num_dacs;
351 hda_nid_t dig_out_nid; /* optional */
352 hda_nid_t hp_nid; /* optional */
353 hda_nid_t *slave_dig_outs;
354 unsigned int num_adc_nids;
356 hda_nid_t *capsrc_nids;
357 hda_nid_t dig_in_nid;
358 unsigned int num_channel_mode;
359 const struct hda_channel_mode *channel_mode;
361 unsigned int num_mux_defs;
362 const struct hda_input_mux *input_mux;
363 void (*unsol_event)(struct hda_codec *, unsigned int);
364 void (*init_hook)(struct hda_codec *);
365 #ifdef CONFIG_SND_HDA_POWER_SAVE
366 struct hda_amp_list *loopbacks;
374 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
375 struct snd_ctl_elem_info *uinfo)
377 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
378 struct alc_spec *spec = codec->spec;
379 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
380 if (mux_idx >= spec->num_mux_defs)
382 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
385 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
386 struct snd_ctl_elem_value *ucontrol)
388 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
389 struct alc_spec *spec = codec->spec;
390 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
392 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
396 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
397 struct snd_ctl_elem_value *ucontrol)
399 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
400 struct alc_spec *spec = codec->spec;
401 const struct hda_input_mux *imux;
402 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
403 unsigned int mux_idx;
404 hda_nid_t nid = spec->capsrc_nids ?
405 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
407 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
408 imux = &spec->input_mux[mux_idx];
410 if (spec->capture_style &&
411 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
412 /* Matrix-mixer style (e.g. ALC882) */
413 unsigned int *cur_val = &spec->cur_mux[adc_idx];
416 idx = ucontrol->value.enumerated.item[0];
417 if (idx >= imux->num_items)
418 idx = imux->num_items - 1;
421 for (i = 0; i < imux->num_items; i++) {
422 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
423 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
424 imux->items[i].index,
430 /* MUX style (e.g. ALC880) */
431 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
432 &spec->cur_mux[adc_idx]);
437 * channel mode setting
439 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
440 struct snd_ctl_elem_info *uinfo)
442 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
443 struct alc_spec *spec = codec->spec;
444 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
445 spec->num_channel_mode);
448 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
449 struct snd_ctl_elem_value *ucontrol)
451 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
452 struct alc_spec *spec = codec->spec;
453 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
454 spec->num_channel_mode,
455 spec->multiout.max_channels);
458 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_value *ucontrol)
461 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
462 struct alc_spec *spec = codec->spec;
463 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
464 spec->num_channel_mode,
465 &spec->multiout.max_channels);
466 if (err >= 0 && spec->need_dac_fix)
467 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
472 * Control the mode of pin widget settings via the mixer. "pc" is used
473 * instead of "%" to avoid consequences of accidently treating the % as
474 * being part of a format specifier. Maximum allowed length of a value is
475 * 63 characters plus NULL terminator.
477 * Note: some retasking pin complexes seem to ignore requests for input
478 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
479 * are requested. Therefore order this list so that this behaviour will not
480 * cause problems when mixer clients move through the enum sequentially.
481 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
484 static char *alc_pin_mode_names[] = {
485 "Mic 50pc bias", "Mic 80pc bias",
486 "Line in", "Line out", "Headphone out",
488 static unsigned char alc_pin_mode_values[] = {
489 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
491 /* The control can present all 5 options, or it can limit the options based
492 * in the pin being assumed to be exclusively an input or an output pin. In
493 * addition, "input" pins may or may not process the mic bias option
494 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
495 * accept requests for bias as of chip versions up to March 2006) and/or
496 * wiring in the computer.
498 #define ALC_PIN_DIR_IN 0x00
499 #define ALC_PIN_DIR_OUT 0x01
500 #define ALC_PIN_DIR_INOUT 0x02
501 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
502 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
504 /* Info about the pin modes supported by the different pin direction modes.
505 * For each direction the minimum and maximum values are given.
507 static signed char alc_pin_mode_dir_info[5][2] = {
508 { 0, 2 }, /* ALC_PIN_DIR_IN */
509 { 3, 4 }, /* ALC_PIN_DIR_OUT */
510 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
511 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
512 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
514 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
515 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
516 #define alc_pin_mode_n_items(_dir) \
517 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
519 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
520 struct snd_ctl_elem_info *uinfo)
522 unsigned int item_num = uinfo->value.enumerated.item;
523 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
525 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
527 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
529 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
530 item_num = alc_pin_mode_min(dir);
531 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
535 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
536 struct snd_ctl_elem_value *ucontrol)
539 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
540 hda_nid_t nid = kcontrol->private_value & 0xffff;
541 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
542 long *valp = ucontrol->value.integer.value;
543 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
544 AC_VERB_GET_PIN_WIDGET_CONTROL,
547 /* Find enumerated value for current pinctl setting */
548 i = alc_pin_mode_min(dir);
549 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
551 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
555 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
556 struct snd_ctl_elem_value *ucontrol)
559 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
560 hda_nid_t nid = kcontrol->private_value & 0xffff;
561 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
562 long val = *ucontrol->value.integer.value;
563 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
564 AC_VERB_GET_PIN_WIDGET_CONTROL,
567 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
568 val = alc_pin_mode_min(dir);
570 change = pinctl != alc_pin_mode_values[val];
572 /* Set pin mode to that requested */
573 snd_hda_codec_write_cache(codec, nid, 0,
574 AC_VERB_SET_PIN_WIDGET_CONTROL,
575 alc_pin_mode_values[val]);
577 /* Also enable the retasking pin's input/output as required
578 * for the requested pin mode. Enum values of 2 or less are
581 * Dynamically switching the input/output buffers probably
582 * reduces noise slightly (particularly on input) so we'll
583 * do it. However, having both input and output buffers
584 * enabled simultaneously doesn't seem to be problematic if
585 * this turns out to be necessary in the future.
588 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
589 HDA_AMP_MUTE, HDA_AMP_MUTE);
590 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
593 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
594 HDA_AMP_MUTE, HDA_AMP_MUTE);
595 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
602 #define ALC_PIN_MODE(xname, nid, dir) \
603 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
604 .info = alc_pin_mode_info, \
605 .get = alc_pin_mode_get, \
606 .put = alc_pin_mode_put, \
607 .private_value = nid | (dir<<16) }
609 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
610 * together using a mask with more than one bit set. This control is
611 * currently used only by the ALC260 test model. At this stage they are not
612 * needed for any "production" models.
614 #ifdef CONFIG_SND_DEBUG
615 #define alc_gpio_data_info snd_ctl_boolean_mono_info
617 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
618 struct snd_ctl_elem_value *ucontrol)
620 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
621 hda_nid_t nid = kcontrol->private_value & 0xffff;
622 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
623 long *valp = ucontrol->value.integer.value;
624 unsigned int val = snd_hda_codec_read(codec, nid, 0,
625 AC_VERB_GET_GPIO_DATA, 0x00);
627 *valp = (val & mask) != 0;
630 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
631 struct snd_ctl_elem_value *ucontrol)
634 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
635 hda_nid_t nid = kcontrol->private_value & 0xffff;
636 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
637 long val = *ucontrol->value.integer.value;
638 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
639 AC_VERB_GET_GPIO_DATA,
642 /* Set/unset the masked GPIO bit(s) as needed */
643 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
648 snd_hda_codec_write_cache(codec, nid, 0,
649 AC_VERB_SET_GPIO_DATA, gpio_data);
653 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
654 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
655 .info = alc_gpio_data_info, \
656 .get = alc_gpio_data_get, \
657 .put = alc_gpio_data_put, \
658 .private_value = nid | (mask<<16) }
659 #endif /* CONFIG_SND_DEBUG */
661 /* A switch control to allow the enabling of the digital IO pins on the
662 * ALC260. This is incredibly simplistic; the intention of this control is
663 * to provide something in the test model allowing digital outputs to be
664 * identified if present. If models are found which can utilise these
665 * outputs a more complete mixer control can be devised for those models if
668 #ifdef CONFIG_SND_DEBUG
669 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
671 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
672 struct snd_ctl_elem_value *ucontrol)
674 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
675 hda_nid_t nid = kcontrol->private_value & 0xffff;
676 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
677 long *valp = ucontrol->value.integer.value;
678 unsigned int val = snd_hda_codec_read(codec, nid, 0,
679 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
681 *valp = (val & mask) != 0;
684 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
685 struct snd_ctl_elem_value *ucontrol)
688 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
689 hda_nid_t nid = kcontrol->private_value & 0xffff;
690 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
691 long val = *ucontrol->value.integer.value;
692 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
693 AC_VERB_GET_DIGI_CONVERT_1,
696 /* Set/unset the masked control bit(s) as needed */
697 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
702 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
707 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
708 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
709 .info = alc_spdif_ctrl_info, \
710 .get = alc_spdif_ctrl_get, \
711 .put = alc_spdif_ctrl_put, \
712 .private_value = nid | (mask<<16) }
713 #endif /* CONFIG_SND_DEBUG */
715 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
716 * Again, this is only used in the ALC26x test models to help identify when
717 * the EAPD line must be asserted for features to work.
719 #ifdef CONFIG_SND_DEBUG
720 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
722 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
723 struct snd_ctl_elem_value *ucontrol)
725 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
726 hda_nid_t nid = kcontrol->private_value & 0xffff;
727 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
728 long *valp = ucontrol->value.integer.value;
729 unsigned int val = snd_hda_codec_read(codec, nid, 0,
730 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
732 *valp = (val & mask) != 0;
736 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
737 struct snd_ctl_elem_value *ucontrol)
740 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
741 hda_nid_t nid = kcontrol->private_value & 0xffff;
742 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
743 long val = *ucontrol->value.integer.value;
744 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
745 AC_VERB_GET_EAPD_BTLENABLE,
748 /* Set/unset the masked control bit(s) as needed */
749 change = (!val ? 0 : mask) != (ctrl_data & mask);
754 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
760 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
761 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
762 .info = alc_eapd_ctrl_info, \
763 .get = alc_eapd_ctrl_get, \
764 .put = alc_eapd_ctrl_put, \
765 .private_value = nid | (mask<<16) }
766 #endif /* CONFIG_SND_DEBUG */
770 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
772 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
774 spec->mixers[spec->num_mixers++] = mix;
777 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
779 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
781 spec->init_verbs[spec->num_init_verbs++] = verb;
784 #ifdef CONFIG_PROC_FS
788 static void print_realtek_coef(struct snd_info_buffer *buffer,
789 struct hda_codec *codec, hda_nid_t nid)
795 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
796 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
797 coeff = snd_hda_codec_read(codec, nid, 0,
798 AC_VERB_GET_COEF_INDEX, 0);
799 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
802 #define print_realtek_coef NULL
806 * set up from the preset table
808 static void setup_preset(struct alc_spec *spec,
809 const struct alc_config_preset *preset)
813 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
814 add_mixer(spec, preset->mixers[i]);
815 spec->cap_mixer = preset->cap_mixer;
816 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
818 add_verb(spec, preset->init_verbs[i]);
820 spec->channel_mode = preset->channel_mode;
821 spec->num_channel_mode = preset->num_channel_mode;
822 spec->need_dac_fix = preset->need_dac_fix;
824 spec->multiout.max_channels = spec->channel_mode[0].channels;
826 spec->multiout.num_dacs = preset->num_dacs;
827 spec->multiout.dac_nids = preset->dac_nids;
828 spec->multiout.dig_out_nid = preset->dig_out_nid;
829 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
830 spec->multiout.hp_nid = preset->hp_nid;
832 spec->num_mux_defs = preset->num_mux_defs;
833 if (!spec->num_mux_defs)
834 spec->num_mux_defs = 1;
835 spec->input_mux = preset->input_mux;
837 spec->num_adc_nids = preset->num_adc_nids;
838 spec->adc_nids = preset->adc_nids;
839 spec->capsrc_nids = preset->capsrc_nids;
840 spec->dig_in_nid = preset->dig_in_nid;
842 spec->unsol_event = preset->unsol_event;
843 spec->init_hook = preset->init_hook;
844 #ifdef CONFIG_SND_HDA_POWER_SAVE
845 spec->loopback.amplist = preset->loopbacks;
849 /* Enable GPIO mask and set output */
850 static struct hda_verb alc_gpio1_init_verbs[] = {
851 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
852 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
853 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
857 static struct hda_verb alc_gpio2_init_verbs[] = {
858 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
859 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
860 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
864 static struct hda_verb alc_gpio3_init_verbs[] = {
865 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
866 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
867 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
872 * Fix hardware PLL issue
873 * On some codecs, the analog PLL gating control must be off while
874 * the default value is 1.
876 static void alc_fix_pll(struct hda_codec *codec)
878 struct alc_spec *spec = codec->spec;
883 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
885 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
886 AC_VERB_GET_PROC_COEF, 0);
887 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
889 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
890 val & ~(1 << spec->pll_coef_bit));
893 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
894 unsigned int coef_idx, unsigned int coef_bit)
896 struct alc_spec *spec = codec->spec;
898 spec->pll_coef_idx = coef_idx;
899 spec->pll_coef_bit = coef_bit;
903 static void alc_sku_automute(struct hda_codec *codec)
905 struct alc_spec *spec = codec->spec;
906 unsigned int present;
907 unsigned int hp_nid = spec->autocfg.hp_pins[0];
908 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
910 /* need to execute and sync at first */
911 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
912 present = snd_hda_codec_read(codec, hp_nid, 0,
913 AC_VERB_GET_PIN_SENSE, 0);
914 spec->jack_present = (present & 0x80000000) != 0;
915 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
916 spec->jack_present ? 0 : PIN_OUT);
919 #if 0 /* it's broken in some acses -- temporarily disabled */
920 static void alc_mic_automute(struct hda_codec *codec)
922 struct alc_spec *spec = codec->spec;
923 unsigned int present;
924 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
925 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
926 unsigned int mix_nid = spec->capsrc_nids[0];
927 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
929 capsrc_idx_mic = mic_nid - 0x18;
930 capsrc_idx_fmic = fmic_nid - 0x18;
931 present = snd_hda_codec_read(codec, mic_nid, 0,
932 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
933 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
934 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
935 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
936 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
937 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
938 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
941 #define alc_mic_automute(codec) do {} while(0) /* NOP */
942 #endif /* disabled */
944 /* unsolicited event for HP jack sensing */
945 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
947 if (codec->vendor_id == 0x10ec0880)
951 if (res == ALC880_HP_EVENT)
952 alc_sku_automute(codec);
954 if (res == ALC880_MIC_EVENT)
955 alc_mic_automute(codec);
958 static void alc_inithook(struct hda_codec *codec)
960 alc_sku_automute(codec);
961 alc_mic_automute(codec);
964 /* additional initialization for ALC888 variants */
965 static void alc888_coef_init(struct hda_codec *codec)
969 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
970 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
971 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
972 if ((tmp & 0xf0) == 2)
974 snd_hda_codec_read(codec, 0x20, 0,
975 AC_VERB_SET_PROC_COEF, 0x830);
978 snd_hda_codec_read(codec, 0x20, 0,
979 AC_VERB_SET_PROC_COEF, 0x3030);
982 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
983 * 31 ~ 16 : Manufacture ID
985 * 7 ~ 0 : Assembly ID
986 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
988 static void alc_subsystem_id(struct hda_codec *codec,
989 unsigned int porta, unsigned int porte,
992 unsigned int ass, tmp, i;
994 struct alc_spec *spec = codec->spec;
996 ass = codec->subsystem_id & 0xffff;
997 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1001 * 31~30 : port conetcivity
1004 * 19~16 : Check sum (15:1)
1009 if (codec->vendor_id == 0x10ec0260)
1011 ass = snd_hda_codec_read(codec, nid, 0,
1012 AC_VERB_GET_CONFIG_DEFAULT, 0);
1013 if (!(ass & 1) && !(ass & 0x100000))
1015 if ((ass >> 30) != 1) /* no physical connection */
1020 for (i = 1; i < 16; i++) {
1024 if (((ass >> 16) & 0xf) != tmp)
1030 * 2 : 0 --> Desktop, 1 --> Laptop
1031 * 3~5 : External Amplifier control
1034 tmp = (ass & 0x38) >> 3; /* external Amp control */
1037 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1040 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1043 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1045 case 5: /* set EAPD output high */
1046 switch (codec->vendor_id) {
1048 snd_hda_codec_write(codec, 0x0f, 0,
1049 AC_VERB_SET_EAPD_BTLENABLE, 2);
1050 snd_hda_codec_write(codec, 0x10, 0,
1051 AC_VERB_SET_EAPD_BTLENABLE, 2);
1063 snd_hda_codec_write(codec, 0x14, 0,
1064 AC_VERB_SET_EAPD_BTLENABLE, 2);
1065 snd_hda_codec_write(codec, 0x15, 0,
1066 AC_VERB_SET_EAPD_BTLENABLE, 2);
1069 switch (codec->vendor_id) {
1071 snd_hda_codec_write(codec, 0x1a, 0,
1072 AC_VERB_SET_COEF_INDEX, 7);
1073 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1074 AC_VERB_GET_PROC_COEF, 0);
1075 snd_hda_codec_write(codec, 0x1a, 0,
1076 AC_VERB_SET_COEF_INDEX, 7);
1077 snd_hda_codec_write(codec, 0x1a, 0,
1078 AC_VERB_SET_PROC_COEF,
1088 snd_hda_codec_write(codec, 0x20, 0,
1089 AC_VERB_SET_COEF_INDEX, 7);
1090 tmp = snd_hda_codec_read(codec, 0x20, 0,
1091 AC_VERB_GET_PROC_COEF, 0);
1092 snd_hda_codec_write(codec, 0x20, 0,
1093 AC_VERB_SET_COEF_INDEX, 7);
1094 snd_hda_codec_write(codec, 0x20, 0,
1095 AC_VERB_SET_PROC_COEF,
1099 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1103 snd_hda_codec_write(codec, 0x20, 0,
1104 AC_VERB_SET_COEF_INDEX, 7);
1105 tmp = snd_hda_codec_read(codec, 0x20, 0,
1106 AC_VERB_GET_PROC_COEF, 0);
1107 snd_hda_codec_write(codec, 0x20, 0,
1108 AC_VERB_SET_COEF_INDEX, 7);
1109 snd_hda_codec_write(codec, 0x20, 0,
1110 AC_VERB_SET_PROC_COEF,
1118 /* is laptop or Desktop and enable the function "Mute internal speaker
1119 * when the external headphone out jack is plugged"
1121 if (!(ass & 0x8000))
1124 * 10~8 : Jack location
1125 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1127 * 15 : 1 --> enable the function "Mute internal speaker
1128 * when the external headphone out jack is plugged"
1130 if (!spec->autocfg.speaker_pins[0]) {
1131 if (spec->autocfg.line_out_pins[0])
1132 spec->autocfg.speaker_pins[0] =
1133 spec->autocfg.line_out_pins[0];
1138 if (!spec->autocfg.hp_pins[0]) {
1139 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1141 spec->autocfg.hp_pins[0] = porta;
1143 spec->autocfg.hp_pins[0] = porte;
1145 spec->autocfg.hp_pins[0] = portd;
1149 if (spec->autocfg.hp_pins[0])
1150 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1151 AC_VERB_SET_UNSOLICITED_ENABLE,
1152 AC_USRSP_EN | ALC880_HP_EVENT);
1154 #if 0 /* it's broken in some acses -- temporarily disabled */
1155 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1156 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1157 snd_hda_codec_write(codec,
1158 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1159 AC_VERB_SET_UNSOLICITED_ENABLE,
1160 AC_USRSP_EN | ALC880_MIC_EVENT);
1161 #endif /* disabled */
1163 spec->unsol_event = alc_sku_unsol_event;
1167 * Fix-up pin default configurations
1175 static void alc_fix_pincfg(struct hda_codec *codec,
1176 const struct snd_pci_quirk *quirk,
1177 const struct alc_pincfg **pinfix)
1179 const struct alc_pincfg *cfg;
1181 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1185 cfg = pinfix[quirk->value];
1186 for (; cfg->nid; cfg++) {
1189 for (i = 0; i < 4; i++) {
1190 snd_hda_codec_write(codec, cfg->nid, 0,
1191 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1205 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1206 /* Mic-in jack as mic in */
1207 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1208 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1209 /* Line-in jack as Line in */
1210 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1211 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1212 /* Line-Out as Front */
1213 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1220 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1221 /* Mic-in jack as mic in */
1222 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1223 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1224 /* Line-in jack as Surround */
1225 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1226 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1227 /* Line-Out as Front */
1228 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1235 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1236 /* Mic-in jack as CLFE */
1237 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1238 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1239 /* Line-in jack as Surround */
1240 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1241 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1242 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1243 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1250 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1251 /* Mic-in jack as CLFE */
1252 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1253 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1254 /* Line-in jack as Surround */
1255 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1256 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1257 /* Line-Out as Side */
1258 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1262 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1263 { 2, alc888_4ST_ch2_intel_init },
1264 { 4, alc888_4ST_ch4_intel_init },
1265 { 6, alc888_4ST_ch6_intel_init },
1266 { 8, alc888_4ST_ch8_intel_init },
1270 * ALC888 Fujitsu Siemens Amillo xa3530
1273 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1274 /* Front Mic: set to PIN_IN (empty by default) */
1275 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1276 /* Connect Internal HP to Front */
1277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1278 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1279 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1280 /* Connect Bass HP to Front */
1281 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1283 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1284 /* Connect Line-Out side jack (SPDIF) to Side */
1285 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1286 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1287 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1288 /* Connect Mic jack to CLFE */
1289 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1290 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1291 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1292 /* Connect Line-in jack to Surround */
1293 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1294 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1295 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1296 /* Connect HP out jack to Front */
1297 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1298 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1299 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1300 /* Enable unsolicited event for HP jack and Line-out jack */
1301 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1302 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1306 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1308 unsigned int present;
1310 /* Line out presence */
1311 present = snd_hda_codec_read(codec, 0x17, 0,
1312 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1313 /* HP out presence */
1314 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1315 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1316 bits = present ? HDA_AMP_MUTE : 0;
1317 /* Toggle internal speakers muting */
1318 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1319 HDA_AMP_MUTE, bits);
1320 /* Toggle internal bass muting */
1321 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1322 HDA_AMP_MUTE, bits);
1325 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1328 if (res >> 26 == ALC880_HP_EVENT)
1329 alc888_fujitsu_xa3530_automute(codec);
1334 * ALC888 Acer Aspire 4930G model
1337 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1338 /* Front Mic: set to PIN_IN (empty by default) */
1339 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1340 /* Unselect Front Mic by default in input mixer 3 */
1341 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1342 /* Enable unsolicited event for HP jack */
1343 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1344 /* Connect Internal HP to front */
1345 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1346 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1347 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1348 /* Connect HP out to front */
1349 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1351 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1355 static struct hda_input_mux alc888_2_capture_sources[2] = {
1356 /* Front mic only available on one ADC */
1363 { "Front Mic", 0xb },
1376 static struct snd_kcontrol_new alc888_base_mixer[] = {
1377 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1378 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1379 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1380 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1381 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1383 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1384 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1385 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1386 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1387 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1388 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1389 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1390 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1391 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1393 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1394 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1398 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1400 unsigned int present;
1402 present = snd_hda_codec_read(codec, 0x15, 0,
1403 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1404 bits = present ? HDA_AMP_MUTE : 0;
1405 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1406 HDA_AMP_MUTE, bits);
1409 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1412 if (res >> 26 == ALC880_HP_EVENT)
1413 alc888_acer_aspire_4930g_automute(codec);
1417 * ALC880 3-stack model
1419 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1420 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1421 * F-Mic = 0x1b, HP = 0x19
1424 static hda_nid_t alc880_dac_nids[4] = {
1425 /* front, rear, clfe, rear_surr */
1426 0x02, 0x05, 0x04, 0x03
1429 static hda_nid_t alc880_adc_nids[3] = {
1434 /* The datasheet says the node 0x07 is connected from inputs,
1435 * but it shows zero connection in the real implementation on some devices.
1436 * Note: this is a 915GAV bug, fixed on 915GLV
1438 static hda_nid_t alc880_adc_nids_alt[2] = {
1443 #define ALC880_DIGOUT_NID 0x06
1444 #define ALC880_DIGIN_NID 0x0a
1446 static struct hda_input_mux alc880_capture_source = {
1450 { "Front Mic", 0x3 },
1456 /* channel source setting (2/6 channel selection for 3-stack) */
1458 static struct hda_verb alc880_threestack_ch2_init[] = {
1459 /* set line-in to input, mute it */
1460 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1461 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1462 /* set mic-in to input vref 80%, mute it */
1463 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1464 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1469 static struct hda_verb alc880_threestack_ch6_init[] = {
1470 /* set line-in to output, unmute it */
1471 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1472 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1473 /* set mic-in to output, unmute it */
1474 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1475 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1479 static struct hda_channel_mode alc880_threestack_modes[2] = {
1480 { 2, alc880_threestack_ch2_init },
1481 { 6, alc880_threestack_ch6_init },
1484 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1485 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1486 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1487 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1488 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1489 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1490 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1491 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1492 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1493 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1494 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1495 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1496 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1499 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1500 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1501 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1503 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1504 .name = "Channel Mode",
1505 .info = alc_ch_mode_info,
1506 .get = alc_ch_mode_get,
1507 .put = alc_ch_mode_put,
1512 /* capture mixer elements */
1513 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1514 struct snd_ctl_elem_info *uinfo)
1516 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1517 struct alc_spec *spec = codec->spec;
1520 mutex_lock(&codec->control_mutex);
1521 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1523 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1524 mutex_unlock(&codec->control_mutex);
1528 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1529 unsigned int size, unsigned int __user *tlv)
1531 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1532 struct alc_spec *spec = codec->spec;
1535 mutex_lock(&codec->control_mutex);
1536 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1538 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1539 mutex_unlock(&codec->control_mutex);
1543 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1544 struct snd_ctl_elem_value *ucontrol);
1546 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1547 struct snd_ctl_elem_value *ucontrol,
1550 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1551 struct alc_spec *spec = codec->spec;
1552 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1555 mutex_lock(&codec->control_mutex);
1556 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1558 err = func(kcontrol, ucontrol);
1559 mutex_unlock(&codec->control_mutex);
1563 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1564 struct snd_ctl_elem_value *ucontrol)
1566 return alc_cap_getput_caller(kcontrol, ucontrol,
1567 snd_hda_mixer_amp_volume_get);
1570 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1571 struct snd_ctl_elem_value *ucontrol)
1573 return alc_cap_getput_caller(kcontrol, ucontrol,
1574 snd_hda_mixer_amp_volume_put);
1577 /* capture mixer elements */
1578 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1580 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1581 struct snd_ctl_elem_value *ucontrol)
1583 return alc_cap_getput_caller(kcontrol, ucontrol,
1584 snd_hda_mixer_amp_switch_get);
1587 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1588 struct snd_ctl_elem_value *ucontrol)
1590 return alc_cap_getput_caller(kcontrol, ucontrol,
1591 snd_hda_mixer_amp_switch_put);
1594 #define DEFINE_CAPMIX(num) \
1595 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1597 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1598 .name = "Capture Switch", \
1599 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1601 .info = alc_cap_sw_info, \
1602 .get = alc_cap_sw_get, \
1603 .put = alc_cap_sw_put, \
1606 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1607 .name = "Capture Volume", \
1608 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1609 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1610 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1612 .info = alc_cap_vol_info, \
1613 .get = alc_cap_vol_get, \
1614 .put = alc_cap_vol_put, \
1615 .tlv = { .c = alc_cap_vol_tlv }, \
1618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1619 /* .name = "Capture Source", */ \
1620 .name = "Input Source", \
1622 .info = alc_mux_enum_info, \
1623 .get = alc_mux_enum_get, \
1624 .put = alc_mux_enum_put, \
1629 /* up to three ADCs */
1636 * ALC880 5-stack model
1638 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1640 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1641 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1644 /* additional mixers to alc880_three_stack_mixer */
1645 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1646 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1647 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1651 /* channel source setting (6/8 channel selection for 5-stack) */
1653 static struct hda_verb alc880_fivestack_ch6_init[] = {
1654 /* set line-in to input, mute it */
1655 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1656 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1661 static struct hda_verb alc880_fivestack_ch8_init[] = {
1662 /* set line-in to output, unmute it */
1663 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1664 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1668 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1669 { 6, alc880_fivestack_ch6_init },
1670 { 8, alc880_fivestack_ch8_init },
1675 * ALC880 6-stack model
1677 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1678 * Side = 0x05 (0x0f)
1679 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1680 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1683 static hda_nid_t alc880_6st_dac_nids[4] = {
1684 /* front, rear, clfe, rear_surr */
1685 0x02, 0x03, 0x04, 0x05
1688 static struct hda_input_mux alc880_6stack_capture_source = {
1692 { "Front Mic", 0x1 },
1698 /* fixed 8-channels */
1699 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1703 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1704 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1705 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1706 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1707 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1708 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1709 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1710 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1711 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1712 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1713 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1714 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1715 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1716 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1717 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1719 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1720 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1721 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1723 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1724 .name = "Channel Mode",
1725 .info = alc_ch_mode_info,
1726 .get = alc_ch_mode_get,
1727 .put = alc_ch_mode_put,
1736 * W810 has rear IO for:
1739 * Center/LFE (DAC 04)
1742 * The system also has a pair of internal speakers, and a headphone jack.
1743 * These are both connected to Line2 on the codec, hence to DAC 02.
1745 * There is a variable resistor to control the speaker or headphone
1746 * volume. This is a hardware-only device without a software API.
1748 * Plugging headphones in will disable the internal speakers. This is
1749 * implemented in hardware, not via the driver using jack sense. In
1750 * a similar fashion, plugging into the rear socket marked "front" will
1751 * disable both the speakers and headphones.
1753 * For input, there's a microphone jack, and an "audio in" jack.
1754 * These may not do anything useful with this driver yet, because I
1755 * haven't setup any initialization verbs for these yet...
1758 static hda_nid_t alc880_w810_dac_nids[3] = {
1759 /* front, rear/surround, clfe */
1763 /* fixed 6 channels */
1764 static struct hda_channel_mode alc880_w810_modes[1] = {
1768 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1769 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1770 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1772 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1773 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1774 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1775 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1776 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1777 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1786 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1787 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1791 static hda_nid_t alc880_z71v_dac_nids[1] = {
1794 #define ALC880_Z71V_HP_DAC 0x03
1796 /* fixed 2 channels */
1797 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1801 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1802 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1803 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1804 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1805 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1806 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1807 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1815 * ALC880 F1734 model
1817 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1818 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1821 static hda_nid_t alc880_f1734_dac_nids[1] = {
1824 #define ALC880_F1734_HP_DAC 0x02
1826 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1827 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1828 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1829 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1830 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1831 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1832 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1838 static struct hda_input_mux alc880_f1734_capture_source = {
1850 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1851 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1852 * Mic = 0x18, Line = 0x1a
1855 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1856 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1858 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1859 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1860 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1861 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1862 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1863 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1864 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1865 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1866 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1867 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1868 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1869 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1870 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1874 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1875 .name = "Channel Mode",
1876 .info = alc_ch_mode_info,
1877 .get = alc_ch_mode_get,
1878 .put = alc_ch_mode_put,
1884 * ALC880 ASUS W1V model
1886 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1887 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1888 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1891 /* additional mixers to alc880_asus_mixer */
1892 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1893 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1894 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1899 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1900 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1901 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1903 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1904 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1907 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1908 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1913 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1914 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1915 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1916 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1917 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1918 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1919 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1920 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1921 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1922 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1923 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1924 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1925 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1927 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1928 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1929 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1932 .name = "Channel Mode",
1933 .info = alc_ch_mode_info,
1934 .get = alc_ch_mode_get,
1935 .put = alc_ch_mode_put,
1940 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1941 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1942 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1943 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1944 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1945 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1946 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1947 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1948 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1949 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1950 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1954 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1955 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1956 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1957 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1958 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1965 * virtual master controls
1969 * slave controls for virtual master
1971 static const char *alc_slave_vols[] = {
1972 "Front Playback Volume",
1973 "Surround Playback Volume",
1974 "Center Playback Volume",
1975 "LFE Playback Volume",
1976 "Side Playback Volume",
1977 "Headphone Playback Volume",
1978 "Speaker Playback Volume",
1979 "Mono Playback Volume",
1980 "Line-Out Playback Volume",
1981 "PCM Playback Volume",
1985 static const char *alc_slave_sws[] = {
1986 "Front Playback Switch",
1987 "Surround Playback Switch",
1988 "Center Playback Switch",
1989 "LFE Playback Switch",
1990 "Side Playback Switch",
1991 "Headphone Playback Switch",
1992 "Speaker Playback Switch",
1993 "Mono Playback Switch",
1994 "IEC958 Playback Switch",
1999 * build control elements
2002 static void alc_free_kctls(struct hda_codec *codec);
2004 /* additional beep mixers; the actual parameters are overwritten at build */
2005 static struct snd_kcontrol_new alc_beep_mixer[] = {
2006 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2007 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2011 static int alc_build_controls(struct hda_codec *codec)
2013 struct alc_spec *spec = codec->spec;
2017 for (i = 0; i < spec->num_mixers; i++) {
2018 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2022 if (spec->cap_mixer) {
2023 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2027 if (spec->multiout.dig_out_nid) {
2028 err = snd_hda_create_spdif_out_ctls(codec,
2029 spec->multiout.dig_out_nid);
2032 if (!spec->no_analog) {
2033 err = snd_hda_create_spdif_share_sw(codec,
2037 spec->multiout.share_spdif = 1;
2040 if (spec->dig_in_nid) {
2041 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2046 /* create beep controls if needed */
2047 if (spec->beep_amp) {
2048 struct snd_kcontrol_new *knew;
2049 for (knew = alc_beep_mixer; knew->name; knew++) {
2050 struct snd_kcontrol *kctl;
2051 kctl = snd_ctl_new1(knew, codec);
2054 kctl->private_value = spec->beep_amp;
2055 err = snd_hda_ctl_add(codec, kctl);
2061 /* if we have no master control, let's create it */
2062 if (!spec->no_analog &&
2063 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2064 unsigned int vmaster_tlv[4];
2065 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2066 HDA_OUTPUT, vmaster_tlv);
2067 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2068 vmaster_tlv, alc_slave_vols);
2072 if (!spec->no_analog &&
2073 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2074 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2075 NULL, alc_slave_sws);
2080 alc_free_kctls(codec); /* no longer needed */
2086 * initialize the codec volumes, etc
2090 * generic initialization of ADC, input mixers and output mixers
2092 static struct hda_verb alc880_volume_init_verbs[] = {
2094 * Unmute ADC0-2 and set the default input to mic-in
2096 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2098 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2099 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2100 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2101 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2103 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2105 * Note: PASD motherboards uses the Line In 2 as the input for front
2108 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2118 * Set up output mixers (0x0c - 0x0f)
2120 /* set vol=0 to output mixers */
2121 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2122 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2123 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2124 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2125 /* set up input amps for analog loopback */
2126 /* Amp Indices: DAC = 0, mixer = 1 */
2127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2128 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2129 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2130 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2131 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2132 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2133 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2134 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2140 * 3-stack pin configuration:
2141 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2143 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2145 * preset connection lists of input pins
2146 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2148 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2149 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2150 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2153 * Set pin mode and muting
2155 /* set front pin widgets 0x14 for output */
2156 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2157 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2158 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2159 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2160 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2161 /* Mic2 (as headphone out) for HP output */
2162 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2163 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2164 /* Line In pin widget for input */
2165 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2166 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2167 /* Line2 (as front mic) pin widget for input and vref at 80% */
2168 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2169 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2170 /* CD pin widget for input */
2171 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2177 * 5-stack pin configuration:
2178 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2179 * line-in/side = 0x1a, f-mic = 0x1b
2181 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2183 * preset connection lists of input pins
2184 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2186 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2187 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2190 * Set pin mode and muting
2192 /* set pin widgets 0x14-0x17 for output */
2193 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2195 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2196 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2197 /* unmute pins for output (no gain on this amp) */
2198 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2199 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2200 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2201 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2203 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2204 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2206 /* Mic2 (as headphone out) for HP output */
2207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2209 /* Line In pin widget for input */
2210 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2211 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2212 /* Line2 (as front mic) pin widget for input and vref at 80% */
2213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2214 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2215 /* CD pin widget for input */
2216 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2222 * W810 pin configuration:
2223 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2225 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2226 /* hphone/speaker input selector: front DAC */
2227 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2229 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2230 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2231 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2232 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2233 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2234 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2243 * Z71V pin configuration:
2244 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2246 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2248 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2250 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2252 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2253 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2254 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2255 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2261 * 6-stack pin configuration:
2262 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2263 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2265 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2266 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2269 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2271 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2272 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2273 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2274 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2275 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2278 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2279 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2280 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2281 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2282 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2283 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2284 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2285 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2291 * Uniwill pin configuration:
2292 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2295 static struct hda_verb alc880_uniwill_init_verbs[] = {
2296 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2299 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2300 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2302 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2303 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2304 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2305 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2308 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2313 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2314 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2315 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2316 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2317 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2318 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2319 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2320 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2321 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2323 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2324 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2331 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2333 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2334 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2336 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2337 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2340 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2341 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2342 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2344 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2345 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2349 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2351 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2352 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2353 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2354 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2356 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2357 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2362 static struct hda_verb alc880_beep_init_verbs[] = {
2363 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2367 /* toggle speaker-output according to the hp-jack state */
2368 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2370 unsigned int present;
2373 present = snd_hda_codec_read(codec, 0x14, 0,
2374 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2375 bits = present ? HDA_AMP_MUTE : 0;
2376 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2377 HDA_AMP_MUTE, bits);
2378 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2379 HDA_AMP_MUTE, bits);
2382 /* auto-toggle front mic */
2383 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2385 unsigned int present;
2388 present = snd_hda_codec_read(codec, 0x18, 0,
2389 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2390 bits = present ? HDA_AMP_MUTE : 0;
2391 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2394 static void alc880_uniwill_automute(struct hda_codec *codec)
2396 alc880_uniwill_hp_automute(codec);
2397 alc880_uniwill_mic_automute(codec);
2400 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2403 /* Looks like the unsol event is incompatible with the standard
2404 * definition. 4bit tag is placed at 28 bit!
2406 switch (res >> 28) {
2407 case ALC880_HP_EVENT:
2408 alc880_uniwill_hp_automute(codec);
2410 case ALC880_MIC_EVENT:
2411 alc880_uniwill_mic_automute(codec);
2416 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2418 unsigned int present;
2421 present = snd_hda_codec_read(codec, 0x14, 0,
2422 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2423 bits = present ? HDA_AMP_MUTE : 0;
2424 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2427 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2429 unsigned int present;
2431 present = snd_hda_codec_read(codec, 0x21, 0,
2432 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2433 present &= HDA_AMP_VOLMASK;
2434 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2435 HDA_AMP_VOLMASK, present);
2436 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2437 HDA_AMP_VOLMASK, present);
2440 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2443 /* Looks like the unsol event is incompatible with the standard
2444 * definition. 4bit tag is placed at 28 bit!
2446 if ((res >> 28) == ALC880_HP_EVENT)
2447 alc880_uniwill_p53_hp_automute(codec);
2448 if ((res >> 28) == ALC880_DCVOL_EVENT)
2449 alc880_uniwill_p53_dcvol_automute(codec);
2453 * F1734 pin configuration:
2454 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2456 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2457 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2458 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2459 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2460 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2461 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2468 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2469 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2470 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2471 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2472 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2473 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2475 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2476 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2478 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2479 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2485 * ASUS pin configuration:
2486 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2488 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2489 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2490 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2491 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2492 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2495 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2498 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2500 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2503 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2505 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2510 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2511 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2516 /* Enable GPIO mask and set output */
2517 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2518 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2520 /* Clevo m520g init */
2521 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2522 /* headphone output */
2523 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2528 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2529 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2531 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2532 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2533 /* Mic1 (rear panel) */
2534 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2535 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2536 /* Mic2 (front panel) */
2537 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2538 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2540 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2541 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2542 /* change to EAPD mode */
2543 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2544 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2549 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2550 /* change to EAPD mode */
2551 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2552 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2554 /* Headphone output */
2555 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2557 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2558 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2560 /* Line In pin widget for input */
2561 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2562 /* CD pin widget for input */
2563 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2564 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2565 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2567 /* change to EAPD mode */
2568 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2569 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2575 * LG m1 express dual
2578 * Rear Line-In/Out (blue): 0x14
2579 * Build-in Mic-In: 0x15
2581 * HP-Out (green): 0x1b
2582 * Mic-In/Out (red): 0x19
2586 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2587 static hda_nid_t alc880_lg_dac_nids[3] = {
2591 /* seems analog CD is not working */
2592 static struct hda_input_mux alc880_lg_capture_source = {
2597 { "Internal Mic", 0x6 },
2601 /* 2,4,6 channel modes */
2602 static struct hda_verb alc880_lg_ch2_init[] = {
2603 /* set line-in and mic-in to input */
2604 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2605 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2609 static struct hda_verb alc880_lg_ch4_init[] = {
2610 /* set line-in to out and mic-in to input */
2611 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2612 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2616 static struct hda_verb alc880_lg_ch6_init[] = {
2617 /* set line-in and mic-in to output */
2618 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2619 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2623 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2624 { 2, alc880_lg_ch2_init },
2625 { 4, alc880_lg_ch4_init },
2626 { 6, alc880_lg_ch6_init },
2629 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2630 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2631 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2632 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2633 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2634 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2635 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2636 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2637 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2640 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2641 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2642 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2643 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2645 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2646 .name = "Channel Mode",
2647 .info = alc_ch_mode_info,
2648 .get = alc_ch_mode_get,
2649 .put = alc_ch_mode_put,
2654 static struct hda_verb alc880_lg_init_verbs[] = {
2655 /* set capture source to mic-in */
2656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2657 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2659 /* mute all amp mixer inputs */
2660 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2661 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2662 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2663 /* line-in to input */
2664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2670 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2671 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2672 /* mic-in to input */
2673 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2674 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2675 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2677 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2678 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2679 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2681 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2685 /* toggle speaker-output according to the hp-jack state */
2686 static void alc880_lg_automute(struct hda_codec *codec)
2688 unsigned int present;
2691 present = snd_hda_codec_read(codec, 0x1b, 0,
2692 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2693 bits = present ? HDA_AMP_MUTE : 0;
2694 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2695 HDA_AMP_MUTE, bits);
2698 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2700 /* Looks like the unsol event is incompatible with the standard
2701 * definition. 4bit tag is placed at 28 bit!
2703 if ((res >> 28) == 0x01)
2704 alc880_lg_automute(codec);
2713 * Built-in Mic-In: 0x19
2719 static struct hda_input_mux alc880_lg_lw_capture_source = {
2723 { "Internal Mic", 0x1 },
2728 #define alc880_lg_lw_modes alc880_threestack_modes
2730 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2731 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2732 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2733 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2734 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2735 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2736 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2737 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2738 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2739 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2740 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2743 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2744 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2746 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2747 .name = "Channel Mode",
2748 .info = alc_ch_mode_info,
2749 .get = alc_ch_mode_get,
2750 .put = alc_ch_mode_put,
2755 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2756 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2757 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2758 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2760 /* set capture source to mic-in */
2761 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2762 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2763 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2770 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2771 /* mic-in to input */
2772 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2775 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2778 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2782 /* toggle speaker-output according to the hp-jack state */
2783 static void alc880_lg_lw_automute(struct hda_codec *codec)
2785 unsigned int present;
2788 present = snd_hda_codec_read(codec, 0x1b, 0,
2789 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2790 bits = present ? HDA_AMP_MUTE : 0;
2791 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2792 HDA_AMP_MUTE, bits);
2795 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2797 /* Looks like the unsol event is incompatible with the standard
2798 * definition. 4bit tag is placed at 28 bit!
2800 if ((res >> 28) == 0x01)
2801 alc880_lg_lw_automute(codec);
2804 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2805 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2806 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2809 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2810 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2814 static struct hda_input_mux alc880_medion_rim_capture_source = {
2818 { "Internal Mic", 0x1 },
2822 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2823 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2825 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2826 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2828 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2829 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2830 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2831 /* Mic2 (as headphone out) for HP output */
2832 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2833 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2834 /* Internal Speaker */
2835 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2836 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2838 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2839 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2841 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2845 /* toggle speaker-output according to the hp-jack state */
2846 static void alc880_medion_rim_automute(struct hda_codec *codec)
2848 unsigned int present;
2851 present = snd_hda_codec_read(codec, 0x14, 0,
2852 AC_VERB_GET_PIN_SENSE, 0)
2853 & AC_PINSENSE_PRESENCE;
2854 bits = present ? HDA_AMP_MUTE : 0;
2855 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2856 HDA_AMP_MUTE, bits);
2858 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2860 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2863 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2866 /* Looks like the unsol event is incompatible with the standard
2867 * definition. 4bit tag is placed at 28 bit!
2869 if ((res >> 28) == ALC880_HP_EVENT)
2870 alc880_medion_rim_automute(codec);
2873 #ifdef CONFIG_SND_HDA_POWER_SAVE
2874 static struct hda_amp_list alc880_loopbacks[] = {
2875 { 0x0b, HDA_INPUT, 0 },
2876 { 0x0b, HDA_INPUT, 1 },
2877 { 0x0b, HDA_INPUT, 2 },
2878 { 0x0b, HDA_INPUT, 3 },
2879 { 0x0b, HDA_INPUT, 4 },
2883 static struct hda_amp_list alc880_lg_loopbacks[] = {
2884 { 0x0b, HDA_INPUT, 1 },
2885 { 0x0b, HDA_INPUT, 6 },
2886 { 0x0b, HDA_INPUT, 7 },
2895 static int alc_init(struct hda_codec *codec)
2897 struct alc_spec *spec = codec->spec;
2901 if (codec->vendor_id == 0x10ec0888)
2902 alc888_coef_init(codec);
2904 for (i = 0; i < spec->num_init_verbs; i++)
2905 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2907 if (spec->init_hook)
2908 spec->init_hook(codec);
2913 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2915 struct alc_spec *spec = codec->spec;
2917 if (spec->unsol_event)
2918 spec->unsol_event(codec, res);
2921 #ifdef CONFIG_SND_HDA_POWER_SAVE
2922 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2924 struct alc_spec *spec = codec->spec;
2925 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2930 * Analog playback callbacks
2932 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2933 struct hda_codec *codec,
2934 struct snd_pcm_substream *substream)
2936 struct alc_spec *spec = codec->spec;
2937 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2941 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2942 struct hda_codec *codec,
2943 unsigned int stream_tag,
2944 unsigned int format,
2945 struct snd_pcm_substream *substream)
2947 struct alc_spec *spec = codec->spec;
2948 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2949 stream_tag, format, substream);
2952 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2953 struct hda_codec *codec,
2954 struct snd_pcm_substream *substream)
2956 struct alc_spec *spec = codec->spec;
2957 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2963 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2964 struct hda_codec *codec,
2965 struct snd_pcm_substream *substream)
2967 struct alc_spec *spec = codec->spec;
2968 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2971 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2972 struct hda_codec *codec,
2973 unsigned int stream_tag,
2974 unsigned int format,
2975 struct snd_pcm_substream *substream)
2977 struct alc_spec *spec = codec->spec;
2978 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2979 stream_tag, format, substream);
2982 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2983 struct hda_codec *codec,
2984 struct snd_pcm_substream *substream)
2986 struct alc_spec *spec = codec->spec;
2987 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2993 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2994 struct hda_codec *codec,
2995 unsigned int stream_tag,
2996 unsigned int format,
2997 struct snd_pcm_substream *substream)
2999 struct alc_spec *spec = codec->spec;
3001 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3002 stream_tag, 0, format);
3006 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3007 struct hda_codec *codec,
3008 struct snd_pcm_substream *substream)
3010 struct alc_spec *spec = codec->spec;
3012 snd_hda_codec_cleanup_stream(codec,
3013 spec->adc_nids[substream->number + 1]);
3020 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3024 /* NID is set in alc_build_pcms */
3026 .open = alc880_playback_pcm_open,
3027 .prepare = alc880_playback_pcm_prepare,
3028 .cleanup = alc880_playback_pcm_cleanup
3032 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3036 /* NID is set in alc_build_pcms */
3039 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3043 /* NID is set in alc_build_pcms */
3046 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3047 .substreams = 2, /* can be overridden */
3050 /* NID is set in alc_build_pcms */
3052 .prepare = alc880_alt_capture_pcm_prepare,
3053 .cleanup = alc880_alt_capture_pcm_cleanup
3057 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3061 /* NID is set in alc_build_pcms */
3063 .open = alc880_dig_playback_pcm_open,
3064 .close = alc880_dig_playback_pcm_close,
3065 .prepare = alc880_dig_playback_pcm_prepare
3069 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3073 /* NID is set in alc_build_pcms */
3076 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3077 static struct hda_pcm_stream alc_pcm_null_stream = {
3083 static int alc_build_pcms(struct hda_codec *codec)
3085 struct alc_spec *spec = codec->spec;
3086 struct hda_pcm *info = spec->pcm_rec;
3089 codec->num_pcms = 1;
3090 codec->pcm_info = info;
3092 if (spec->no_analog)
3095 info->name = spec->stream_name_analog;
3096 if (spec->stream_analog_playback) {
3097 if (snd_BUG_ON(!spec->multiout.dac_nids))
3099 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3100 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3102 if (spec->stream_analog_capture) {
3103 if (snd_BUG_ON(!spec->adc_nids))
3105 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3106 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3109 if (spec->channel_mode) {
3110 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3111 for (i = 0; i < spec->num_channel_mode; i++) {
3112 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3113 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3119 /* SPDIF for stream index #1 */
3120 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3121 codec->num_pcms = 2;
3122 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3123 info = spec->pcm_rec + 1;
3124 info->name = spec->stream_name_digital;
3125 if (spec->dig_out_type)
3126 info->pcm_type = spec->dig_out_type;
3128 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3129 if (spec->multiout.dig_out_nid &&
3130 spec->stream_digital_playback) {
3131 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3132 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3134 if (spec->dig_in_nid &&
3135 spec->stream_digital_capture) {
3136 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3137 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3139 /* FIXME: do we need this for all Realtek codec models? */
3140 codec->spdif_status_reset = 1;
3143 if (spec->no_analog)
3146 /* If the use of more than one ADC is requested for the current
3147 * model, configure a second analog capture-only PCM.
3149 /* Additional Analaog capture for index #2 */
3150 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3151 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3152 codec->num_pcms = 3;
3153 info = spec->pcm_rec + 2;
3154 info->name = spec->stream_name_analog;
3155 if (spec->alt_dac_nid) {
3156 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3157 *spec->stream_analog_alt_playback;
3158 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3161 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3162 alc_pcm_null_stream;
3163 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3165 if (spec->num_adc_nids > 1) {
3166 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3167 *spec->stream_analog_alt_capture;
3168 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3170 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3171 spec->num_adc_nids - 1;
3173 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3174 alc_pcm_null_stream;
3175 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3182 static void alc_free_kctls(struct hda_codec *codec)
3184 struct alc_spec *spec = codec->spec;
3186 if (spec->kctls.list) {
3187 struct snd_kcontrol_new *kctl = spec->kctls.list;
3189 for (i = 0; i < spec->kctls.used; i++)
3190 kfree(kctl[i].name);
3192 snd_array_free(&spec->kctls);
3195 static void alc_free(struct hda_codec *codec)
3197 struct alc_spec *spec = codec->spec;
3202 alc_free_kctls(codec);
3204 snd_hda_detach_beep_device(codec);
3207 #ifdef SND_HDA_NEEDS_RESUME
3208 static void store_pin_configs(struct hda_codec *codec)
3210 struct alc_spec *spec = codec->spec;
3211 hda_nid_t nid, end_nid;
3213 end_nid = codec->start_nid + codec->num_nodes;
3214 for (nid = codec->start_nid; nid < end_nid; nid++) {
3215 unsigned int wid_caps = get_wcaps(codec, nid);
3216 unsigned int wid_type =
3217 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3218 if (wid_type != AC_WID_PIN)
3220 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3222 spec->pin_nids[spec->num_pins] = nid;
3223 spec->pin_cfgs[spec->num_pins] =
3224 snd_hda_codec_read(codec, nid, 0,
3225 AC_VERB_GET_CONFIG_DEFAULT, 0);
3230 static void resume_pin_configs(struct hda_codec *codec)
3232 struct alc_spec *spec = codec->spec;
3235 for (i = 0; i < spec->num_pins; i++) {
3236 hda_nid_t pin_nid = spec->pin_nids[i];
3237 unsigned int pin_config = spec->pin_cfgs[i];
3238 snd_hda_codec_write(codec, pin_nid, 0,
3239 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3240 pin_config & 0x000000ff);
3241 snd_hda_codec_write(codec, pin_nid, 0,
3242 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3243 (pin_config & 0x0000ff00) >> 8);
3244 snd_hda_codec_write(codec, pin_nid, 0,
3245 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3246 (pin_config & 0x00ff0000) >> 16);
3247 snd_hda_codec_write(codec, pin_nid, 0,
3248 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3253 static int alc_resume(struct hda_codec *codec)
3255 resume_pin_configs(codec);
3256 codec->patch_ops.init(codec);
3257 snd_hda_codec_resume_amp(codec);
3258 snd_hda_codec_resume_cache(codec);
3262 #define store_pin_configs(codec)
3267 static struct hda_codec_ops alc_patch_ops = {
3268 .build_controls = alc_build_controls,
3269 .build_pcms = alc_build_pcms,
3272 .unsol_event = alc_unsol_event,
3273 #ifdef SND_HDA_NEEDS_RESUME
3274 .resume = alc_resume,
3276 #ifdef CONFIG_SND_HDA_POWER_SAVE
3277 .check_power_status = alc_check_power_status,
3283 * Test configuration for debugging
3285 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3288 #ifdef CONFIG_SND_DEBUG
3289 static hda_nid_t alc880_test_dac_nids[4] = {
3290 0x02, 0x03, 0x04, 0x05
3293 static struct hda_input_mux alc880_test_capture_source = {
3302 { "Surround", 0x6 },
3306 static struct hda_channel_mode alc880_test_modes[4] = {
3313 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3314 struct snd_ctl_elem_info *uinfo)
3316 static char *texts[] = {
3317 "N/A", "Line Out", "HP Out",
3318 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3320 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3322 uinfo->value.enumerated.items = 8;
3323 if (uinfo->value.enumerated.item >= 8)
3324 uinfo->value.enumerated.item = 7;
3325 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3329 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3330 struct snd_ctl_elem_value *ucontrol)
3332 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3333 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3334 unsigned int pin_ctl, item = 0;
3336 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3337 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3338 if (pin_ctl & AC_PINCTL_OUT_EN) {
3339 if (pin_ctl & AC_PINCTL_HP_EN)
3343 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3344 switch (pin_ctl & AC_PINCTL_VREFEN) {
3345 case AC_PINCTL_VREF_HIZ: item = 3; break;
3346 case AC_PINCTL_VREF_50: item = 4; break;
3347 case AC_PINCTL_VREF_GRD: item = 5; break;
3348 case AC_PINCTL_VREF_80: item = 6; break;
3349 case AC_PINCTL_VREF_100: item = 7; break;
3352 ucontrol->value.enumerated.item[0] = item;
3356 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3357 struct snd_ctl_elem_value *ucontrol)
3359 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3360 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3361 static unsigned int ctls[] = {
3362 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3363 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3364 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3365 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3366 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3367 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3369 unsigned int old_ctl, new_ctl;
3371 old_ctl = snd_hda_codec_read(codec, nid, 0,
3372 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3373 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3374 if (old_ctl != new_ctl) {
3376 snd_hda_codec_write_cache(codec, nid, 0,
3377 AC_VERB_SET_PIN_WIDGET_CONTROL,
3379 val = ucontrol->value.enumerated.item[0] >= 3 ?
3381 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3388 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3389 struct snd_ctl_elem_info *uinfo)
3391 static char *texts[] = {
3392 "Front", "Surround", "CLFE", "Side"
3394 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3396 uinfo->value.enumerated.items = 4;
3397 if (uinfo->value.enumerated.item >= 4)
3398 uinfo->value.enumerated.item = 3;
3399 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3403 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3404 struct snd_ctl_elem_value *ucontrol)
3406 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3407 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3410 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3411 ucontrol->value.enumerated.item[0] = sel & 3;
3415 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3416 struct snd_ctl_elem_value *ucontrol)
3418 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3419 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3422 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3423 if (ucontrol->value.enumerated.item[0] != sel) {
3424 sel = ucontrol->value.enumerated.item[0] & 3;
3425 snd_hda_codec_write_cache(codec, nid, 0,
3426 AC_VERB_SET_CONNECT_SEL, sel);
3432 #define PIN_CTL_TEST(xname,nid) { \
3433 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3435 .info = alc_test_pin_ctl_info, \
3436 .get = alc_test_pin_ctl_get, \
3437 .put = alc_test_pin_ctl_put, \
3438 .private_value = nid \
3441 #define PIN_SRC_TEST(xname,nid) { \
3442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3444 .info = alc_test_pin_src_info, \
3445 .get = alc_test_pin_src_get, \
3446 .put = alc_test_pin_src_put, \
3447 .private_value = nid \
3450 static struct snd_kcontrol_new alc880_test_mixer[] = {
3451 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3452 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3453 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3454 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3455 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3456 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3457 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3458 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3459 PIN_CTL_TEST("Front Pin Mode", 0x14),
3460 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3461 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3462 PIN_CTL_TEST("Side Pin Mode", 0x17),
3463 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3464 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3465 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3466 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3467 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3468 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3469 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3470 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3471 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3472 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3473 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3474 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3475 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3476 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3477 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3478 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3482 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3483 .name = "Channel Mode",
3484 .info = alc_ch_mode_info,
3485 .get = alc_ch_mode_get,
3486 .put = alc_ch_mode_put,
3491 static struct hda_verb alc880_test_init_verbs[] = {
3492 /* Unmute inputs of 0x0c - 0x0f */
3493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3495 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3496 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3497 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3498 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3499 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3500 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3501 /* Vol output for 0x0c-0x0f */
3502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3503 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3505 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3506 /* Set output pins 0x14-0x17 */
3507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3509 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3510 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3511 /* Unmute output pins 0x14-0x17 */
3512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3513 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3514 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3515 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3516 /* Set input pins 0x18-0x1c */
3517 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3518 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3519 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3520 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3521 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3522 /* Mute input pins 0x18-0x1b */
3523 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3524 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3526 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3529 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3530 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3531 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3532 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3533 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3534 /* Analog input/passthru */
3535 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3536 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3538 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3539 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3547 static const char *alc880_models[ALC880_MODEL_LAST] = {
3548 [ALC880_3ST] = "3stack",
3549 [ALC880_TCL_S700] = "tcl",
3550 [ALC880_3ST_DIG] = "3stack-digout",
3551 [ALC880_CLEVO] = "clevo",
3552 [ALC880_5ST] = "5stack",
3553 [ALC880_5ST_DIG] = "5stack-digout",
3554 [ALC880_W810] = "w810",
3555 [ALC880_Z71V] = "z71v",
3556 [ALC880_6ST] = "6stack",
3557 [ALC880_6ST_DIG] = "6stack-digout",
3558 [ALC880_ASUS] = "asus",
3559 [ALC880_ASUS_W1V] = "asus-w1v",
3560 [ALC880_ASUS_DIG] = "asus-dig",
3561 [ALC880_ASUS_DIG2] = "asus-dig2",
3562 [ALC880_UNIWILL_DIG] = "uniwill",
3563 [ALC880_UNIWILL_P53] = "uniwill-p53",
3564 [ALC880_FUJITSU] = "fujitsu",
3565 [ALC880_F1734] = "F1734",
3567 [ALC880_LG_LW] = "lg-lw",
3568 [ALC880_MEDION_RIM] = "medion",
3569 #ifdef CONFIG_SND_DEBUG
3570 [ALC880_TEST] = "test",
3572 [ALC880_AUTO] = "auto",
3575 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3576 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3577 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3578 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3579 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3580 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3581 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3582 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3583 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3584 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3585 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3586 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3587 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3588 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3589 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3590 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3591 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3592 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3593 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3594 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3595 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3596 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3597 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3598 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3599 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3600 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3601 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3602 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3603 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3604 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3605 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3606 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3607 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3608 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3609 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3610 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3611 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3612 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3613 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3614 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3615 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3616 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3617 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3618 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3619 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3620 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3621 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3622 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3623 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3624 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3625 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3626 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3627 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3628 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3629 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3630 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3631 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3632 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3633 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3634 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3635 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3636 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3637 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3638 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3639 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3640 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3641 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3642 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3643 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3644 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3645 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3646 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3651 * ALC880 codec presets
3653 static struct alc_config_preset alc880_presets[] = {
3655 .mixers = { alc880_three_stack_mixer },
3656 .init_verbs = { alc880_volume_init_verbs,
3657 alc880_pin_3stack_init_verbs },
3658 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3659 .dac_nids = alc880_dac_nids,
3660 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3661 .channel_mode = alc880_threestack_modes,
3663 .input_mux = &alc880_capture_source,
3665 [ALC880_3ST_DIG] = {
3666 .mixers = { alc880_three_stack_mixer },
3667 .init_verbs = { alc880_volume_init_verbs,
3668 alc880_pin_3stack_init_verbs },
3669 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3670 .dac_nids = alc880_dac_nids,
3671 .dig_out_nid = ALC880_DIGOUT_NID,
3672 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3673 .channel_mode = alc880_threestack_modes,
3675 .input_mux = &alc880_capture_source,
3677 [ALC880_TCL_S700] = {
3678 .mixers = { alc880_tcl_s700_mixer },
3679 .init_verbs = { alc880_volume_init_verbs,
3680 alc880_pin_tcl_S700_init_verbs,
3681 alc880_gpio2_init_verbs },
3682 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3683 .dac_nids = alc880_dac_nids,
3684 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3685 .num_adc_nids = 1, /* single ADC */
3687 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3688 .channel_mode = alc880_2_jack_modes,
3689 .input_mux = &alc880_capture_source,
3692 .mixers = { alc880_three_stack_mixer,
3693 alc880_five_stack_mixer},
3694 .init_verbs = { alc880_volume_init_verbs,
3695 alc880_pin_5stack_init_verbs },
3696 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3697 .dac_nids = alc880_dac_nids,
3698 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3699 .channel_mode = alc880_fivestack_modes,
3700 .input_mux = &alc880_capture_source,
3702 [ALC880_5ST_DIG] = {
3703 .mixers = { alc880_three_stack_mixer,
3704 alc880_five_stack_mixer },
3705 .init_verbs = { alc880_volume_init_verbs,
3706 alc880_pin_5stack_init_verbs },
3707 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3708 .dac_nids = alc880_dac_nids,
3709 .dig_out_nid = ALC880_DIGOUT_NID,
3710 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3711 .channel_mode = alc880_fivestack_modes,
3712 .input_mux = &alc880_capture_source,
3715 .mixers = { alc880_six_stack_mixer },
3716 .init_verbs = { alc880_volume_init_verbs,
3717 alc880_pin_6stack_init_verbs },
3718 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3719 .dac_nids = alc880_6st_dac_nids,
3720 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3721 .channel_mode = alc880_sixstack_modes,
3722 .input_mux = &alc880_6stack_capture_source,
3724 [ALC880_6ST_DIG] = {
3725 .mixers = { alc880_six_stack_mixer },
3726 .init_verbs = { alc880_volume_init_verbs,
3727 alc880_pin_6stack_init_verbs },
3728 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3729 .dac_nids = alc880_6st_dac_nids,
3730 .dig_out_nid = ALC880_DIGOUT_NID,
3731 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3732 .channel_mode = alc880_sixstack_modes,
3733 .input_mux = &alc880_6stack_capture_source,
3736 .mixers = { alc880_w810_base_mixer },
3737 .init_verbs = { alc880_volume_init_verbs,
3738 alc880_pin_w810_init_verbs,
3739 alc880_gpio2_init_verbs },
3740 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3741 .dac_nids = alc880_w810_dac_nids,
3742 .dig_out_nid = ALC880_DIGOUT_NID,
3743 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3744 .channel_mode = alc880_w810_modes,
3745 .input_mux = &alc880_capture_source,
3748 .mixers = { alc880_z71v_mixer },
3749 .init_verbs = { alc880_volume_init_verbs,
3750 alc880_pin_z71v_init_verbs },
3751 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3752 .dac_nids = alc880_z71v_dac_nids,
3753 .dig_out_nid = ALC880_DIGOUT_NID,
3755 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3756 .channel_mode = alc880_2_jack_modes,
3757 .input_mux = &alc880_capture_source,
3760 .mixers = { alc880_f1734_mixer },
3761 .init_verbs = { alc880_volume_init_verbs,
3762 alc880_pin_f1734_init_verbs },
3763 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3764 .dac_nids = alc880_f1734_dac_nids,
3766 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3767 .channel_mode = alc880_2_jack_modes,
3768 .input_mux = &alc880_f1734_capture_source,
3769 .unsol_event = alc880_uniwill_p53_unsol_event,
3770 .init_hook = alc880_uniwill_p53_hp_automute,
3773 .mixers = { alc880_asus_mixer },
3774 .init_verbs = { alc880_volume_init_verbs,
3775 alc880_pin_asus_init_verbs,
3776 alc880_gpio1_init_verbs },
3777 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3778 .dac_nids = alc880_asus_dac_nids,
3779 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3780 .channel_mode = alc880_asus_modes,
3782 .input_mux = &alc880_capture_source,
3784 [ALC880_ASUS_DIG] = {
3785 .mixers = { alc880_asus_mixer },
3786 .init_verbs = { alc880_volume_init_verbs,
3787 alc880_pin_asus_init_verbs,
3788 alc880_gpio1_init_verbs },
3789 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3790 .dac_nids = alc880_asus_dac_nids,
3791 .dig_out_nid = ALC880_DIGOUT_NID,
3792 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3793 .channel_mode = alc880_asus_modes,
3795 .input_mux = &alc880_capture_source,
3797 [ALC880_ASUS_DIG2] = {
3798 .mixers = { alc880_asus_mixer },
3799 .init_verbs = { alc880_volume_init_verbs,
3800 alc880_pin_asus_init_verbs,
3801 alc880_gpio2_init_verbs }, /* use GPIO2 */
3802 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3803 .dac_nids = alc880_asus_dac_nids,
3804 .dig_out_nid = ALC880_DIGOUT_NID,
3805 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3806 .channel_mode = alc880_asus_modes,
3808 .input_mux = &alc880_capture_source,
3810 [ALC880_ASUS_W1V] = {
3811 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3812 .init_verbs = { alc880_volume_init_verbs,
3813 alc880_pin_asus_init_verbs,
3814 alc880_gpio1_init_verbs },
3815 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3816 .dac_nids = alc880_asus_dac_nids,
3817 .dig_out_nid = ALC880_DIGOUT_NID,
3818 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3819 .channel_mode = alc880_asus_modes,
3821 .input_mux = &alc880_capture_source,
3823 [ALC880_UNIWILL_DIG] = {
3824 .mixers = { alc880_asus_mixer },
3825 .init_verbs = { alc880_volume_init_verbs,
3826 alc880_pin_asus_init_verbs },
3827 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3828 .dac_nids = alc880_asus_dac_nids,
3829 .dig_out_nid = ALC880_DIGOUT_NID,
3830 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3831 .channel_mode = alc880_asus_modes,
3833 .input_mux = &alc880_capture_source,
3835 [ALC880_UNIWILL] = {
3836 .mixers = { alc880_uniwill_mixer },
3837 .init_verbs = { alc880_volume_init_verbs,
3838 alc880_uniwill_init_verbs },
3839 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3840 .dac_nids = alc880_asus_dac_nids,
3841 .dig_out_nid = ALC880_DIGOUT_NID,
3842 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3843 .channel_mode = alc880_threestack_modes,
3845 .input_mux = &alc880_capture_source,
3846 .unsol_event = alc880_uniwill_unsol_event,
3847 .init_hook = alc880_uniwill_automute,
3849 [ALC880_UNIWILL_P53] = {
3850 .mixers = { alc880_uniwill_p53_mixer },
3851 .init_verbs = { alc880_volume_init_verbs,
3852 alc880_uniwill_p53_init_verbs },
3853 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3854 .dac_nids = alc880_asus_dac_nids,
3855 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3856 .channel_mode = alc880_threestack_modes,
3857 .input_mux = &alc880_capture_source,
3858 .unsol_event = alc880_uniwill_p53_unsol_event,
3859 .init_hook = alc880_uniwill_p53_hp_automute,
3861 [ALC880_FUJITSU] = {
3862 .mixers = { alc880_fujitsu_mixer },
3863 .init_verbs = { alc880_volume_init_verbs,
3864 alc880_uniwill_p53_init_verbs,
3865 alc880_beep_init_verbs },
3866 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3867 .dac_nids = alc880_dac_nids,
3868 .dig_out_nid = ALC880_DIGOUT_NID,
3869 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3870 .channel_mode = alc880_2_jack_modes,
3871 .input_mux = &alc880_capture_source,
3872 .unsol_event = alc880_uniwill_p53_unsol_event,
3873 .init_hook = alc880_uniwill_p53_hp_automute,
3876 .mixers = { alc880_three_stack_mixer },
3877 .init_verbs = { alc880_volume_init_verbs,
3878 alc880_pin_clevo_init_verbs },
3879 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3880 .dac_nids = alc880_dac_nids,
3882 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3883 .channel_mode = alc880_threestack_modes,
3885 .input_mux = &alc880_capture_source,
3888 .mixers = { alc880_lg_mixer },
3889 .init_verbs = { alc880_volume_init_verbs,
3890 alc880_lg_init_verbs },
3891 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3892 .dac_nids = alc880_lg_dac_nids,
3893 .dig_out_nid = ALC880_DIGOUT_NID,
3894 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3895 .channel_mode = alc880_lg_ch_modes,
3897 .input_mux = &alc880_lg_capture_source,
3898 .unsol_event = alc880_lg_unsol_event,
3899 .init_hook = alc880_lg_automute,
3900 #ifdef CONFIG_SND_HDA_POWER_SAVE
3901 .loopbacks = alc880_lg_loopbacks,
3905 .mixers = { alc880_lg_lw_mixer },
3906 .init_verbs = { alc880_volume_init_verbs,
3907 alc880_lg_lw_init_verbs },
3908 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3909 .dac_nids = alc880_dac_nids,
3910 .dig_out_nid = ALC880_DIGOUT_NID,
3911 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3912 .channel_mode = alc880_lg_lw_modes,
3913 .input_mux = &alc880_lg_lw_capture_source,
3914 .unsol_event = alc880_lg_lw_unsol_event,
3915 .init_hook = alc880_lg_lw_automute,
3917 [ALC880_MEDION_RIM] = {
3918 .mixers = { alc880_medion_rim_mixer },
3919 .init_verbs = { alc880_volume_init_verbs,
3920 alc880_medion_rim_init_verbs,
3921 alc_gpio2_init_verbs },
3922 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3923 .dac_nids = alc880_dac_nids,
3924 .dig_out_nid = ALC880_DIGOUT_NID,
3925 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3926 .channel_mode = alc880_2_jack_modes,
3927 .input_mux = &alc880_medion_rim_capture_source,
3928 .unsol_event = alc880_medion_rim_unsol_event,
3929 .init_hook = alc880_medion_rim_automute,
3931 #ifdef CONFIG_SND_DEBUG
3933 .mixers = { alc880_test_mixer },
3934 .init_verbs = { alc880_test_init_verbs },
3935 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3936 .dac_nids = alc880_test_dac_nids,
3937 .dig_out_nid = ALC880_DIGOUT_NID,
3938 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3939 .channel_mode = alc880_test_modes,
3940 .input_mux = &alc880_test_capture_source,
3946 * Automatic parse of I/O pins from the BIOS configuration
3951 ALC_CTL_WIDGET_MUTE,
3954 static struct snd_kcontrol_new alc880_control_templates[] = {
3955 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3956 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3957 HDA_BIND_MUTE(NULL, 0, 0, 0),
3960 /* add dynamic controls */
3961 static int add_control(struct alc_spec *spec, int type, const char *name,
3964 struct snd_kcontrol_new *knew;
3966 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3967 knew = snd_array_new(&spec->kctls);
3970 *knew = alc880_control_templates[type];
3971 knew->name = kstrdup(name, GFP_KERNEL);
3974 knew->private_value = val;
3978 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3979 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3980 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3981 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3982 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3983 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3984 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3985 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3986 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3987 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3988 #define ALC880_PIN_CD_NID 0x1c
3990 /* fill in the dac_nids table from the parsed pin configuration */
3991 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3992 const struct auto_pin_cfg *cfg)
3998 memset(assigned, 0, sizeof(assigned));
3999 spec->multiout.dac_nids = spec->private_dac_nids;
4001 /* check the pins hardwired to audio widget */
4002 for (i = 0; i < cfg->line_outs; i++) {
4003 nid = cfg->line_out_pins[i];
4004 if (alc880_is_fixed_pin(nid)) {
4005 int idx = alc880_fixed_pin_idx(nid);
4006 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4010 /* left pins can be connect to any audio widget */
4011 for (i = 0; i < cfg->line_outs; i++) {
4012 nid = cfg->line_out_pins[i];
4013 if (alc880_is_fixed_pin(nid))
4015 /* search for an empty channel */
4016 for (j = 0; j < cfg->line_outs; j++) {
4018 spec->multiout.dac_nids[i] =
4019 alc880_idx_to_dac(j);
4025 spec->multiout.num_dacs = cfg->line_outs;
4029 /* add playback controls from the parsed DAC table */
4030 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4031 const struct auto_pin_cfg *cfg)
4034 static const char *chname[4] = {
4035 "Front", "Surround", NULL /*CLFE*/, "Side"
4040 for (i = 0; i < cfg->line_outs; i++) {
4041 if (!spec->multiout.dac_nids[i])
4043 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4046 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4047 "Center Playback Volume",
4048 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4052 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4053 "LFE Playback Volume",
4054 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4058 err = add_control(spec, ALC_CTL_BIND_MUTE,
4059 "Center Playback Switch",
4060 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4064 err = add_control(spec, ALC_CTL_BIND_MUTE,
4065 "LFE Playback Switch",
4066 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4071 sprintf(name, "%s Playback Volume", chname[i]);
4072 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4073 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4077 sprintf(name, "%s Playback Switch", chname[i]);
4078 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4079 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4088 /* add playback controls for speaker and HP outputs */
4089 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4099 if (alc880_is_fixed_pin(pin)) {
4100 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4101 /* specify the DAC as the extra output */
4102 if (!spec->multiout.hp_nid)
4103 spec->multiout.hp_nid = nid;
4105 spec->multiout.extra_out_nid[0] = nid;
4106 /* control HP volume/switch on the output mixer amp */
4107 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4108 sprintf(name, "%s Playback Volume", pfx);
4109 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4110 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4113 sprintf(name, "%s Playback Switch", pfx);
4114 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4115 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4118 } else if (alc880_is_multi_pin(pin)) {
4119 /* set manual connection */
4120 /* we have only a switch on HP-out PIN */
4121 sprintf(name, "%s Playback Switch", pfx);
4122 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4123 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4130 /* create input playback/capture controls for the given pin */
4131 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4132 const char *ctlname,
4133 int idx, hda_nid_t mix_nid)
4138 sprintf(name, "%s Playback Volume", ctlname);
4139 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4140 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4143 sprintf(name, "%s Playback Switch", ctlname);
4144 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4145 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4151 /* create playback/capture controls for input pins */
4152 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4153 const struct auto_pin_cfg *cfg)
4155 struct hda_input_mux *imux = &spec->private_imux[0];
4158 for (i = 0; i < AUTO_PIN_LAST; i++) {
4159 if (alc880_is_input_pin(cfg->input_pins[i])) {
4160 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4161 err = new_analog_input(spec, cfg->input_pins[i],
4162 auto_pin_cfg_labels[i],
4166 imux->items[imux->num_items].label =
4167 auto_pin_cfg_labels[i];
4168 imux->items[imux->num_items].index =
4169 alc880_input_pin_idx(cfg->input_pins[i]);
4176 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4177 unsigned int pin_type)
4179 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4182 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4186 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4187 hda_nid_t nid, int pin_type,
4190 alc_set_pin_output(codec, nid, pin_type);
4191 /* need the manual connection? */
4192 if (alc880_is_multi_pin(nid)) {
4193 struct alc_spec *spec = codec->spec;
4194 int idx = alc880_multi_pin_idx(nid);
4195 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4196 AC_VERB_SET_CONNECT_SEL,
4197 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4201 static int get_pin_type(int line_out_type)
4203 if (line_out_type == AUTO_PIN_HP_OUT)
4209 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4211 struct alc_spec *spec = codec->spec;
4214 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4215 for (i = 0; i < spec->autocfg.line_outs; i++) {
4216 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4217 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4218 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4222 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4224 struct alc_spec *spec = codec->spec;
4227 pin = spec->autocfg.speaker_pins[0];
4228 if (pin) /* connect to front */
4229 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4230 pin = spec->autocfg.hp_pins[0];
4231 if (pin) /* connect to front */
4232 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4235 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4237 struct alc_spec *spec = codec->spec;
4240 for (i = 0; i < AUTO_PIN_LAST; i++) {
4241 hda_nid_t nid = spec->autocfg.input_pins[i];
4242 if (alc880_is_input_pin(nid)) {
4243 snd_hda_codec_write(codec, nid, 0,
4244 AC_VERB_SET_PIN_WIDGET_CONTROL,
4245 i <= AUTO_PIN_FRONT_MIC ?
4246 PIN_VREF80 : PIN_IN);
4247 if (nid != ALC880_PIN_CD_NID)
4248 snd_hda_codec_write(codec, nid, 0,
4249 AC_VERB_SET_AMP_GAIN_MUTE,
4255 /* parse the BIOS configuration and set up the alc_spec */
4256 /* return 1 if successful, 0 if the proper config is not found,
4257 * or a negative error code
4259 static int alc880_parse_auto_config(struct hda_codec *codec)
4261 struct alc_spec *spec = codec->spec;
4263 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4265 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4269 if (!spec->autocfg.line_outs)
4270 return 0; /* can't find valid BIOS pin config */
4272 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4275 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4278 err = alc880_auto_create_extra_out(spec,
4279 spec->autocfg.speaker_pins[0],
4283 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4287 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4291 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4293 if (spec->autocfg.dig_out_pin)
4294 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4295 if (spec->autocfg.dig_in_pin)
4296 spec->dig_in_nid = ALC880_DIGIN_NID;
4298 if (spec->kctls.list)
4299 add_mixer(spec, spec->kctls.list);
4301 add_verb(spec, alc880_volume_init_verbs);
4303 spec->num_mux_defs = 1;
4304 spec->input_mux = &spec->private_imux[0];
4306 store_pin_configs(codec);
4310 /* additional initialization for auto-configuration model */
4311 static void alc880_auto_init(struct hda_codec *codec)
4313 struct alc_spec *spec = codec->spec;
4314 alc880_auto_init_multi_out(codec);
4315 alc880_auto_init_extra_out(codec);
4316 alc880_auto_init_analog_input(codec);
4317 if (spec->unsol_event)
4318 alc_inithook(codec);
4321 static void set_capture_mixer(struct alc_spec *spec)
4323 static struct snd_kcontrol_new *caps[3] = {
4328 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4329 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4332 #define set_beep_amp(spec, nid, idx, dir) \
4333 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4336 * OK, here we have finally the patch for ALC880
4339 static int patch_alc880(struct hda_codec *codec)
4341 struct alc_spec *spec;
4345 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4351 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4354 if (board_config < 0) {
4355 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4356 "trying auto-probe from BIOS...\n");
4357 board_config = ALC880_AUTO;
4360 if (board_config == ALC880_AUTO) {
4361 /* automatic parse from the BIOS config */
4362 err = alc880_parse_auto_config(codec);
4368 "hda_codec: Cannot set up configuration "
4369 "from BIOS. Using 3-stack mode...\n");
4370 board_config = ALC880_3ST;
4374 err = snd_hda_attach_beep_device(codec, 0x1);
4380 if (board_config != ALC880_AUTO)
4381 setup_preset(spec, &alc880_presets[board_config]);
4383 spec->stream_name_analog = "ALC880 Analog";
4384 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4385 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4386 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4388 spec->stream_name_digital = "ALC880 Digital";
4389 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4390 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4392 if (!spec->adc_nids && spec->input_mux) {
4393 /* check whether NID 0x07 is valid */
4394 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4396 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4397 if (wcap != AC_WID_AUD_IN) {
4398 spec->adc_nids = alc880_adc_nids_alt;
4399 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4401 spec->adc_nids = alc880_adc_nids;
4402 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4405 set_capture_mixer(spec);
4406 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4408 spec->vmaster_nid = 0x0c;
4410 codec->patch_ops = alc_patch_ops;
4411 if (board_config == ALC880_AUTO)
4412 spec->init_hook = alc880_auto_init;
4413 #ifdef CONFIG_SND_HDA_POWER_SAVE
4414 if (!spec->loopback.amplist)
4415 spec->loopback.amplist = alc880_loopbacks;
4417 codec->proc_widget_hook = print_realtek_coef;
4427 static hda_nid_t alc260_dac_nids[1] = {
4432 static hda_nid_t alc260_adc_nids[1] = {
4437 static hda_nid_t alc260_adc_nids_alt[1] = {
4442 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4443 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4445 static hda_nid_t alc260_dual_adc_nids[2] = {
4450 #define ALC260_DIGOUT_NID 0x03
4451 #define ALC260_DIGIN_NID 0x06
4453 static struct hda_input_mux alc260_capture_source = {
4457 { "Front Mic", 0x1 },
4463 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4464 * headphone jack and the internal CD lines since these are the only pins at
4465 * which audio can appear. For flexibility, also allow the option of
4466 * recording the mixer output on the second ADC (ADC0 doesn't have a
4467 * connection to the mixer output).
4469 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4473 { "Mic/Line", 0x0 },
4475 { "Headphone", 0x2 },
4481 { "Mic/Line", 0x0 },
4483 { "Headphone", 0x2 },
4490 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4491 * the Fujitsu S702x, but jacks are marked differently.
4493 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4500 { "Headphone", 0x5 },
4509 { "Headphone", 0x6 },
4515 * This is just place-holder, so there's something for alc_build_pcms to look
4516 * at when it calculates the maximum number of channels. ALC260 has no mixer
4517 * element which allows changing the channel mode, so the verb list is
4520 static struct hda_channel_mode alc260_modes[1] = {
4525 /* Mixer combinations
4527 * basic: base_output + input + pc_beep + capture
4528 * HP: base_output + input + capture_alt
4529 * HP_3013: hp_3013 + input + capture
4530 * fujitsu: fujitsu + capture
4531 * acer: acer + capture
4534 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4535 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4536 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4537 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4538 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4539 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4540 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4544 static struct snd_kcontrol_new alc260_input_mixer[] = {
4545 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4546 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4547 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4548 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4549 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4550 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4551 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4552 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4556 /* update HP, line and mono out pins according to the master switch */
4557 static void alc260_hp_master_update(struct hda_codec *codec,
4558 hda_nid_t hp, hda_nid_t line,
4561 struct alc_spec *spec = codec->spec;
4562 unsigned int val = spec->master_sw ? PIN_HP : 0;
4563 /* change HP and line-out pins */
4564 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4566 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4568 /* mono (speaker) depending on the HP jack sense */
4569 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4570 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4574 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4575 struct snd_ctl_elem_value *ucontrol)
4577 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4578 struct alc_spec *spec = codec->spec;
4579 *ucontrol->value.integer.value = spec->master_sw;
4583 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4584 struct snd_ctl_elem_value *ucontrol)
4586 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4587 struct alc_spec *spec = codec->spec;
4588 int val = !!*ucontrol->value.integer.value;
4589 hda_nid_t hp, line, mono;
4591 if (val == spec->master_sw)
4593 spec->master_sw = val;
4594 hp = (kcontrol->private_value >> 16) & 0xff;
4595 line = (kcontrol->private_value >> 8) & 0xff;
4596 mono = kcontrol->private_value & 0xff;
4597 alc260_hp_master_update(codec, hp, line, mono);
4601 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4603 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4604 .name = "Master Playback Switch",
4605 .info = snd_ctl_boolean_mono_info,
4606 .get = alc260_hp_master_sw_get,
4607 .put = alc260_hp_master_sw_put,
4608 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4610 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4611 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4612 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4613 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4614 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4616 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4620 static struct hda_verb alc260_hp_unsol_verbs[] = {
4621 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4625 static void alc260_hp_automute(struct hda_codec *codec)
4627 struct alc_spec *spec = codec->spec;
4628 unsigned int present;
4630 present = snd_hda_codec_read(codec, 0x10, 0,
4631 AC_VERB_GET_PIN_SENSE, 0);
4632 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4633 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4636 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4638 if ((res >> 26) == ALC880_HP_EVENT)
4639 alc260_hp_automute(codec);
4642 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4644 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4645 .name = "Master Playback Switch",
4646 .info = snd_ctl_boolean_mono_info,
4647 .get = alc260_hp_master_sw_get,
4648 .put = alc260_hp_master_sw_put,
4649 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4651 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4652 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4653 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4654 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4655 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4656 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4657 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4658 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4662 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4663 .ops = &snd_hda_bind_vol,
4665 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4666 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4667 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4672 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4673 .ops = &snd_hda_bind_sw,
4675 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4676 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4681 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4682 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4683 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4684 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4685 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4689 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4690 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4694 static void alc260_hp_3013_automute(struct hda_codec *codec)
4696 struct alc_spec *spec = codec->spec;
4697 unsigned int present;
4699 present = snd_hda_codec_read(codec, 0x15, 0,
4700 AC_VERB_GET_PIN_SENSE, 0);
4701 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4702 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4705 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4708 if ((res >> 26) == ALC880_HP_EVENT)
4709 alc260_hp_3013_automute(codec);
4712 static void alc260_hp_3012_automute(struct hda_codec *codec)
4714 unsigned int present, bits;
4716 present = snd_hda_codec_read(codec, 0x10, 0,
4717 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4719 bits = present ? 0 : PIN_OUT;
4720 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4722 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4724 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4728 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4731 if ((res >> 26) == ALC880_HP_EVENT)
4732 alc260_hp_3012_automute(codec);
4735 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4736 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4738 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4739 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4740 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4741 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4742 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4743 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4744 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4745 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4746 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4747 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4748 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4752 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4753 * versions of the ALC260 don't act on requests to enable mic bias from NID
4754 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4755 * datasheet doesn't mention this restriction. At this stage it's not clear
4756 * whether this behaviour is intentional or is a hardware bug in chip
4757 * revisions available in early 2006. Therefore for now allow the
4758 * "Headphone Jack Mode" control to span all choices, but if it turns out
4759 * that the lack of mic bias for this NID is intentional we could change the
4760 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4762 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4763 * don't appear to make the mic bias available from the "line" jack, even
4764 * though the NID used for this jack (0x14) can supply it. The theory is
4765 * that perhaps Acer have included blocking capacitors between the ALC260
4766 * and the output jack. If this turns out to be the case for all such
4767 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4768 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4770 * The C20x Tablet series have a mono internal speaker which is controlled
4771 * via the chip's Mono sum widget and pin complex, so include the necessary
4772 * controls for such models. On models without a "mono speaker" the control
4773 * won't do anything.
4775 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4776 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4777 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4778 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4779 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4781 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4783 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4784 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4786 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4787 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4788 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4789 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4790 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4794 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4795 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4797 static struct snd_kcontrol_new alc260_will_mixer[] = {
4798 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4799 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4801 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4802 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4803 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4804 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4805 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4806 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4807 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4811 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4812 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4814 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4815 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4816 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4818 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4819 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4820 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4821 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4822 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4823 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4824 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4829 * initialization verbs
4831 static struct hda_verb alc260_init_verbs[] = {
4832 /* Line In pin widget for input */
4833 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4834 /* CD pin widget for input */
4835 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4836 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4837 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4838 /* Mic2 (front panel) pin widget for input and vref at 80% */
4839 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4840 /* LINE-2 is used for line-out in rear */
4841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4842 /* select line-out */
4843 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4845 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4847 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4849 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4850 /* mute capture amp left and right */
4851 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4852 /* set connection select to line in (default select for this ADC) */
4853 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4854 /* mute capture amp left and right */
4855 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4856 /* set connection select to line in (default select for this ADC) */
4857 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4858 /* set vol=0 Line-Out mixer amp left and right */
4859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4860 /* unmute pin widget amp left and right (no gain on this amp) */
4861 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4862 /* set vol=0 HP mixer amp left and right */
4863 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4864 /* unmute pin widget amp left and right (no gain on this amp) */
4865 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4866 /* set vol=0 Mono mixer amp left and right */
4867 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4868 /* unmute pin widget amp left and right (no gain on this amp) */
4869 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4870 /* unmute LINE-2 out pin */
4871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4872 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4875 /* mute analog inputs */
4876 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4877 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4878 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4879 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4880 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4881 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4882 /* mute Front out path */
4883 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4884 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4885 /* mute Headphone out path */
4886 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4887 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4888 /* mute Mono out path */
4889 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4890 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4894 #if 0 /* should be identical with alc260_init_verbs? */
4895 static struct hda_verb alc260_hp_init_verbs[] = {
4896 /* Headphone and output */
4897 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4899 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4900 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4901 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4902 /* Mic2 (front panel) pin widget for input and vref at 80% */
4903 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4904 /* Line In pin widget for input */
4905 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4906 /* Line-2 pin widget for output */
4907 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4908 /* CD pin widget for input */
4909 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4910 /* unmute amp left and right */
4911 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4912 /* set connection select to line in (default select for this ADC) */
4913 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4914 /* unmute Line-Out mixer amp left and right (volume = 0) */
4915 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4916 /* mute pin widget amp left and right (no gain on this amp) */
4917 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4918 /* unmute HP mixer amp left and right (volume = 0) */
4919 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4920 /* mute pin widget amp left and right (no gain on this amp) */
4921 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4922 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4925 /* mute analog inputs */
4926 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4931 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4932 /* Unmute Front out path */
4933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4935 /* Unmute Headphone out path */
4936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4938 /* Unmute Mono out path */
4939 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4940 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4945 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4946 /* Line out and output */
4947 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4949 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4950 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4951 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4952 /* Mic2 (front panel) pin widget for input and vref at 80% */
4953 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4954 /* Line In pin widget for input */
4955 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4956 /* Headphone pin widget for output */
4957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4958 /* CD pin widget for input */
4959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4960 /* unmute amp left and right */
4961 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4962 /* set connection select to line in (default select for this ADC) */
4963 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4964 /* unmute Line-Out mixer amp left and right (volume = 0) */
4965 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4966 /* mute pin widget amp left and right (no gain on this amp) */
4967 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4968 /* unmute HP mixer amp left and right (volume = 0) */
4969 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4970 /* mute pin widget amp left and right (no gain on this amp) */
4971 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4972 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4975 /* mute analog inputs */
4976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4980 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4981 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4982 /* Unmute Front out path */
4983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4985 /* Unmute Headphone out path */
4986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4988 /* Unmute Mono out path */
4989 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4994 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4995 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4996 * audio = 0x16, internal speaker = 0x10.
4998 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4999 /* Disable all GPIOs */
5000 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5001 /* Internal speaker is connected to headphone pin */
5002 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5003 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5004 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5005 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5006 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5007 /* Ensure all other unused pins are disabled and muted. */
5008 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5009 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5010 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5011 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5012 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5013 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5014 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5017 /* Disable digital (SPDIF) pins */
5018 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5019 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5021 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5022 * when acting as an output.
5024 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5026 /* Start with output sum widgets muted and their output gains at min */
5027 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5028 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5029 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5030 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5031 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5032 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5033 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5034 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5035 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5037 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5038 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5039 /* Unmute Line1 pin widget output buffer since it starts as an output.
5040 * If the pin mode is changed by the user the pin mode control will
5041 * take care of enabling the pin's input/output buffers as needed.
5042 * Therefore there's no need to enable the input buffer at this
5045 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5046 /* Unmute input buffer of pin widget used for Line-in (no equiv
5049 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5051 /* Mute capture amp left and right */
5052 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5053 /* Set ADC connection select to match default mixer setting - line
5056 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5058 /* Do the same for the second ADC: mute capture input amp and
5059 * set ADC connection to line in (on mic1 pin)
5061 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5062 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5064 /* Mute all inputs to mixer widget (even unconnected ones) */
5065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5069 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5070 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5071 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5072 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5077 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5078 * similar laptops (adapted from Fujitsu init verbs).
5080 static struct hda_verb alc260_acer_init_verbs[] = {
5081 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5082 * the headphone jack. Turn this on and rely on the standard mute
5083 * methods whenever the user wants to turn these outputs off.
5085 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5086 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5087 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5088 /* Internal speaker/Headphone jack is connected to Line-out pin */
5089 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5090 /* Internal microphone/Mic jack is connected to Mic1 pin */
5091 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5092 /* Line In jack is connected to Line1 pin */
5093 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5094 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5095 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5096 /* Ensure all other unused pins are disabled and muted. */
5097 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5098 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5099 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5100 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5101 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5102 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5103 /* Disable digital (SPDIF) pins */
5104 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5105 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5107 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5108 * bus when acting as outputs.
5110 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5111 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5113 /* Start with output sum widgets muted and their output gains at min */
5114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5116 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5117 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5118 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5120 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5121 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5122 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5124 /* Unmute Line-out pin widget amp left and right
5125 * (no equiv mixer ctrl)
5127 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5128 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5129 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5130 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5131 * inputs. If the pin mode is changed by the user the pin mode control
5132 * will take care of enabling the pin's input/output buffers as needed.
5133 * Therefore there's no need to enable the input buffer at this
5136 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5137 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5139 /* Mute capture amp left and right */
5140 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5141 /* Set ADC connection select to match default mixer setting - mic
5144 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5146 /* Do similar with the second ADC: mute capture input amp and
5147 * set ADC connection to mic to match ALSA's default state.
5149 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5150 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5152 /* Mute all inputs to mixer widget (even unconnected ones) */
5153 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5165 static struct hda_verb alc260_will_verbs[] = {
5166 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5167 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5168 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5169 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5170 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5171 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5175 static struct hda_verb alc260_replacer_672v_verbs[] = {
5176 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5177 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5178 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5180 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5181 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5182 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5184 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5188 /* toggle speaker-output according to the hp-jack state */
5189 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5191 unsigned int present;
5193 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5194 present = snd_hda_codec_read(codec, 0x0f, 0,
5195 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5197 snd_hda_codec_write_cache(codec, 0x01, 0,
5198 AC_VERB_SET_GPIO_DATA, 1);
5199 snd_hda_codec_write_cache(codec, 0x0f, 0,
5200 AC_VERB_SET_PIN_WIDGET_CONTROL,
5203 snd_hda_codec_write_cache(codec, 0x01, 0,
5204 AC_VERB_SET_GPIO_DATA, 0);
5205 snd_hda_codec_write_cache(codec, 0x0f, 0,
5206 AC_VERB_SET_PIN_WIDGET_CONTROL,
5211 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5214 if ((res >> 26) == ALC880_HP_EVENT)
5215 alc260_replacer_672v_automute(codec);
5218 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5219 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5220 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5221 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5222 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5223 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5224 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5225 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5226 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5227 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5228 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5232 /* Test configuration for debugging, modelled after the ALC880 test
5235 #ifdef CONFIG_SND_DEBUG
5236 static hda_nid_t alc260_test_dac_nids[1] = {
5239 static hda_nid_t alc260_test_adc_nids[2] = {
5242 /* For testing the ALC260, each input MUX needs its own definition since
5243 * the signal assignments are different. This assumes that the first ADC
5246 static struct hda_input_mux alc260_test_capture_sources[2] = {
5250 { "MIC1 pin", 0x0 },
5251 { "MIC2 pin", 0x1 },
5252 { "LINE1 pin", 0x2 },
5253 { "LINE2 pin", 0x3 },
5255 { "LINE-OUT pin", 0x5 },
5256 { "HP-OUT pin", 0x6 },
5262 { "MIC1 pin", 0x0 },
5263 { "MIC2 pin", 0x1 },
5264 { "LINE1 pin", 0x2 },
5265 { "LINE2 pin", 0x3 },
5268 { "LINE-OUT pin", 0x6 },
5269 { "HP-OUT pin", 0x7 },
5273 static struct snd_kcontrol_new alc260_test_mixer[] = {
5274 /* Output driver widgets */
5275 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5276 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5277 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5278 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5279 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5280 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5282 /* Modes for retasking pin widgets
5283 * Note: the ALC260 doesn't seem to act on requests to enable mic
5284 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5285 * mention this restriction. At this stage it's not clear whether
5286 * this behaviour is intentional or is a hardware bug in chip
5287 * revisions available at least up until early 2006. Therefore for
5288 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5289 * choices, but if it turns out that the lack of mic bias for these
5290 * NIDs is intentional we could change their modes from
5291 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5293 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5294 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5295 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5296 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5297 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5298 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5300 /* Loopback mixer controls */
5301 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5302 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5303 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5304 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5305 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5306 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5307 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5308 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5309 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5310 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5311 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5312 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5313 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5314 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5316 /* Controls for GPIO pins, assuming they are configured as outputs */
5317 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5318 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5319 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5320 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5322 /* Switches to allow the digital IO pins to be enabled. The datasheet
5323 * is ambigious as to which NID is which; testing on laptops which
5324 * make this output available should provide clarification.
5326 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5327 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5329 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5330 * this output to turn on an external amplifier.
5332 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5333 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5337 static struct hda_verb alc260_test_init_verbs[] = {
5338 /* Enable all GPIOs as outputs with an initial value of 0 */
5339 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5340 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5341 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5343 /* Enable retasking pins as output, initially without power amp */
5344 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5345 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5347 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5348 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5349 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5351 /* Disable digital (SPDIF) pins initially, but users can enable
5352 * them via a mixer switch. In the case of SPDIF-out, this initverb
5353 * payload also sets the generation to 0, output to be in "consumer"
5354 * PCM format, copyright asserted, no pre-emphasis and no validity
5357 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5358 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5360 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5361 * OUT1 sum bus when acting as an output.
5363 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5364 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5365 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5366 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5368 /* Start with output sum widgets muted and their output gains at min */
5369 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5372 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5375 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5376 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5377 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5379 /* Unmute retasking pin widget output buffers since the default
5380 * state appears to be output. As the pin mode is changed by the
5381 * user the pin mode control will take care of enabling the pin's
5382 * input/output buffers as needed.
5384 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5385 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5386 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5388 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5389 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5390 /* Also unmute the mono-out pin widget */
5391 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5393 /* Mute capture amp left and right */
5394 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5395 /* Set ADC connection select to match default mixer setting (mic1
5398 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5400 /* Do the same for the second ADC: mute capture input amp and
5401 * set ADC connection to mic1 pin
5403 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5404 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5406 /* Mute all inputs to mixer widget (even unconnected ones) */
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5420 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5421 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5423 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5424 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5427 * for BIOS auto-configuration
5430 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5431 const char *pfx, int *vol_bits)
5434 unsigned long vol_val, sw_val;
5438 if (nid >= 0x0f && nid < 0x11) {
5439 nid_vol = nid - 0x7;
5440 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5441 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5442 } else if (nid == 0x11) {
5443 nid_vol = nid - 0x7;
5444 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5445 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5446 } else if (nid >= 0x12 && nid <= 0x15) {
5448 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5449 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5453 if (!(*vol_bits & (1 << nid_vol))) {
5454 /* first control for the volume widget */
5455 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5456 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5459 *vol_bits |= (1 << nid_vol);
5461 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5462 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5468 /* add playback controls from the parsed DAC table */
5469 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5470 const struct auto_pin_cfg *cfg)
5476 spec->multiout.num_dacs = 1;
5477 spec->multiout.dac_nids = spec->private_dac_nids;
5478 spec->multiout.dac_nids[0] = 0x02;
5480 nid = cfg->line_out_pins[0];
5482 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5487 nid = cfg->speaker_pins[0];
5489 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5494 nid = cfg->hp_pins[0];
5496 err = alc260_add_playback_controls(spec, nid, "Headphone",
5504 /* create playback/capture controls for input pins */
5505 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5506 const struct auto_pin_cfg *cfg)
5508 struct hda_input_mux *imux = &spec->private_imux[0];
5511 for (i = 0; i < AUTO_PIN_LAST; i++) {
5512 if (cfg->input_pins[i] >= 0x12) {
5513 idx = cfg->input_pins[i] - 0x12;
5514 err = new_analog_input(spec, cfg->input_pins[i],
5515 auto_pin_cfg_labels[i], idx,
5519 imux->items[imux->num_items].label =
5520 auto_pin_cfg_labels[i];
5521 imux->items[imux->num_items].index = idx;
5524 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5525 idx = cfg->input_pins[i] - 0x09;
5526 err = new_analog_input(spec, cfg->input_pins[i],
5527 auto_pin_cfg_labels[i], idx,
5531 imux->items[imux->num_items].label =
5532 auto_pin_cfg_labels[i];
5533 imux->items[imux->num_items].index = idx;
5540 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5541 hda_nid_t nid, int pin_type,
5544 alc_set_pin_output(codec, nid, pin_type);
5545 /* need the manual connection? */
5547 int idx = nid - 0x12;
5548 snd_hda_codec_write(codec, idx + 0x0b, 0,
5549 AC_VERB_SET_CONNECT_SEL, sel_idx);
5553 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5555 struct alc_spec *spec = codec->spec;
5558 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5559 nid = spec->autocfg.line_out_pins[0];
5561 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5562 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5565 nid = spec->autocfg.speaker_pins[0];
5567 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5569 nid = spec->autocfg.hp_pins[0];
5571 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5574 #define ALC260_PIN_CD_NID 0x16
5575 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5577 struct alc_spec *spec = codec->spec;
5580 for (i = 0; i < AUTO_PIN_LAST; i++) {
5581 hda_nid_t nid = spec->autocfg.input_pins[i];
5583 snd_hda_codec_write(codec, nid, 0,
5584 AC_VERB_SET_PIN_WIDGET_CONTROL,
5585 i <= AUTO_PIN_FRONT_MIC ?
5586 PIN_VREF80 : PIN_IN);
5587 if (nid != ALC260_PIN_CD_NID)
5588 snd_hda_codec_write(codec, nid, 0,
5589 AC_VERB_SET_AMP_GAIN_MUTE,
5596 * generic initialization of ADC, input mixers and output mixers
5598 static struct hda_verb alc260_volume_init_verbs[] = {
5600 * Unmute ADC0-1 and set the default input to mic-in
5602 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5603 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5604 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5605 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5607 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5609 * Note: PASD motherboards uses the Line In 2 as the input for
5610 * front panel mic (mic 2)
5612 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5613 /* mute analog inputs */
5614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5621 * Set up output mixers (0x08 - 0x0a)
5623 /* set vol=0 to output mixers */
5624 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5626 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5627 /* set up input amps for analog loopback */
5628 /* Amp Indices: DAC = 0, mixer = 1 */
5629 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5633 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5634 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5639 static int alc260_parse_auto_config(struct hda_codec *codec)
5641 struct alc_spec *spec = codec->spec;
5643 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5645 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5649 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5652 if (!spec->kctls.list)
5653 return 0; /* can't find valid BIOS pin config */
5654 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5658 spec->multiout.max_channels = 2;
5660 if (spec->autocfg.dig_out_pin)
5661 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5662 if (spec->kctls.list)
5663 add_mixer(spec, spec->kctls.list);
5665 add_verb(spec, alc260_volume_init_verbs);
5667 spec->num_mux_defs = 1;
5668 spec->input_mux = &spec->private_imux[0];
5670 store_pin_configs(codec);
5674 /* additional initialization for auto-configuration model */
5675 static void alc260_auto_init(struct hda_codec *codec)
5677 struct alc_spec *spec = codec->spec;
5678 alc260_auto_init_multi_out(codec);
5679 alc260_auto_init_analog_input(codec);
5680 if (spec->unsol_event)
5681 alc_inithook(codec);
5684 #ifdef CONFIG_SND_HDA_POWER_SAVE
5685 static struct hda_amp_list alc260_loopbacks[] = {
5686 { 0x07, HDA_INPUT, 0 },
5687 { 0x07, HDA_INPUT, 1 },
5688 { 0x07, HDA_INPUT, 2 },
5689 { 0x07, HDA_INPUT, 3 },
5690 { 0x07, HDA_INPUT, 4 },
5696 * ALC260 configurations
5698 static const char *alc260_models[ALC260_MODEL_LAST] = {
5699 [ALC260_BASIC] = "basic",
5701 [ALC260_HP_3013] = "hp-3013",
5702 [ALC260_HP_DC7600] = "hp-dc7600",
5703 [ALC260_FUJITSU_S702X] = "fujitsu",
5704 [ALC260_ACER] = "acer",
5705 [ALC260_WILL] = "will",
5706 [ALC260_REPLACER_672V] = "replacer",
5707 #ifdef CONFIG_SND_DEBUG
5708 [ALC260_TEST] = "test",
5710 [ALC260_AUTO] = "auto",
5713 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5714 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5715 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5716 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5717 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5718 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5719 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5720 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5721 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5722 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5723 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5724 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5725 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5726 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5727 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5728 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5729 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5730 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5731 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5735 static struct alc_config_preset alc260_presets[] = {
5737 .mixers = { alc260_base_output_mixer,
5738 alc260_input_mixer },
5739 .init_verbs = { alc260_init_verbs },
5740 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5741 .dac_nids = alc260_dac_nids,
5742 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5743 .adc_nids = alc260_adc_nids,
5744 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5745 .channel_mode = alc260_modes,
5746 .input_mux = &alc260_capture_source,
5749 .mixers = { alc260_hp_output_mixer,
5750 alc260_input_mixer },
5751 .init_verbs = { alc260_init_verbs,
5752 alc260_hp_unsol_verbs },
5753 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5754 .dac_nids = alc260_dac_nids,
5755 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5756 .adc_nids = alc260_adc_nids_alt,
5757 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5758 .channel_mode = alc260_modes,
5759 .input_mux = &alc260_capture_source,
5760 .unsol_event = alc260_hp_unsol_event,
5761 .init_hook = alc260_hp_automute,
5763 [ALC260_HP_DC7600] = {
5764 .mixers = { alc260_hp_dc7600_mixer,
5765 alc260_input_mixer },
5766 .init_verbs = { alc260_init_verbs,
5767 alc260_hp_dc7600_verbs },
5768 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5769 .dac_nids = alc260_dac_nids,
5770 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5771 .adc_nids = alc260_adc_nids_alt,
5772 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5773 .channel_mode = alc260_modes,
5774 .input_mux = &alc260_capture_source,
5775 .unsol_event = alc260_hp_3012_unsol_event,
5776 .init_hook = alc260_hp_3012_automute,
5778 [ALC260_HP_3013] = {
5779 .mixers = { alc260_hp_3013_mixer,
5780 alc260_input_mixer },
5781 .init_verbs = { alc260_hp_3013_init_verbs,
5782 alc260_hp_3013_unsol_verbs },
5783 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5784 .dac_nids = alc260_dac_nids,
5785 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5786 .adc_nids = alc260_adc_nids_alt,
5787 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5788 .channel_mode = alc260_modes,
5789 .input_mux = &alc260_capture_source,
5790 .unsol_event = alc260_hp_3013_unsol_event,
5791 .init_hook = alc260_hp_3013_automute,
5793 [ALC260_FUJITSU_S702X] = {
5794 .mixers = { alc260_fujitsu_mixer },
5795 .init_verbs = { alc260_fujitsu_init_verbs },
5796 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5797 .dac_nids = alc260_dac_nids,
5798 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5799 .adc_nids = alc260_dual_adc_nids,
5800 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5801 .channel_mode = alc260_modes,
5802 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5803 .input_mux = alc260_fujitsu_capture_sources,
5806 .mixers = { alc260_acer_mixer },
5807 .init_verbs = { alc260_acer_init_verbs },
5808 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5809 .dac_nids = alc260_dac_nids,
5810 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5811 .adc_nids = alc260_dual_adc_nids,
5812 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5813 .channel_mode = alc260_modes,
5814 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5815 .input_mux = alc260_acer_capture_sources,
5818 .mixers = { alc260_will_mixer },
5819 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5820 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5821 .dac_nids = alc260_dac_nids,
5822 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5823 .adc_nids = alc260_adc_nids,
5824 .dig_out_nid = ALC260_DIGOUT_NID,
5825 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5826 .channel_mode = alc260_modes,
5827 .input_mux = &alc260_capture_source,
5829 [ALC260_REPLACER_672V] = {
5830 .mixers = { alc260_replacer_672v_mixer },
5831 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5832 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5833 .dac_nids = alc260_dac_nids,
5834 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5835 .adc_nids = alc260_adc_nids,
5836 .dig_out_nid = ALC260_DIGOUT_NID,
5837 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5838 .channel_mode = alc260_modes,
5839 .input_mux = &alc260_capture_source,
5840 .unsol_event = alc260_replacer_672v_unsol_event,
5841 .init_hook = alc260_replacer_672v_automute,
5843 #ifdef CONFIG_SND_DEBUG
5845 .mixers = { alc260_test_mixer },
5846 .init_verbs = { alc260_test_init_verbs },
5847 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5848 .dac_nids = alc260_test_dac_nids,
5849 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5850 .adc_nids = alc260_test_adc_nids,
5851 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5852 .channel_mode = alc260_modes,
5853 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5854 .input_mux = alc260_test_capture_sources,
5859 static int patch_alc260(struct hda_codec *codec)
5861 struct alc_spec *spec;
5862 int err, board_config;
5864 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5870 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5873 if (board_config < 0) {
5874 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5875 "trying auto-probe from BIOS...\n");
5876 board_config = ALC260_AUTO;
5879 if (board_config == ALC260_AUTO) {
5880 /* automatic parse from the BIOS config */
5881 err = alc260_parse_auto_config(codec);
5887 "hda_codec: Cannot set up configuration "
5888 "from BIOS. Using base mode...\n");
5889 board_config = ALC260_BASIC;
5893 err = snd_hda_attach_beep_device(codec, 0x1);
5899 if (board_config != ALC260_AUTO)
5900 setup_preset(spec, &alc260_presets[board_config]);
5902 spec->stream_name_analog = "ALC260 Analog";
5903 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5904 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5906 spec->stream_name_digital = "ALC260 Digital";
5907 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5908 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5910 if (!spec->adc_nids && spec->input_mux) {
5911 /* check whether NID 0x04 is valid */
5912 unsigned int wcap = get_wcaps(codec, 0x04);
5913 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5915 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5916 spec->adc_nids = alc260_adc_nids_alt;
5917 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5919 spec->adc_nids = alc260_adc_nids;
5920 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5923 set_capture_mixer(spec);
5924 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
5926 spec->vmaster_nid = 0x08;
5928 codec->patch_ops = alc_patch_ops;
5929 if (board_config == ALC260_AUTO)
5930 spec->init_hook = alc260_auto_init;
5931 #ifdef CONFIG_SND_HDA_POWER_SAVE
5932 if (!spec->loopback.amplist)
5933 spec->loopback.amplist = alc260_loopbacks;
5935 codec->proc_widget_hook = print_realtek_coef;
5944 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5945 * configuration. Each pin widget can choose any input DACs and a mixer.
5946 * Each ADC is connected from a mixer of all inputs. This makes possible
5947 * 6-channel independent captures.
5949 * In addition, an independent DAC for the multi-playback (not used in this
5952 #define ALC882_DIGOUT_NID 0x06
5953 #define ALC882_DIGIN_NID 0x0a
5955 static struct hda_channel_mode alc882_ch_modes[1] = {
5959 static hda_nid_t alc882_dac_nids[4] = {
5960 /* front, rear, clfe, rear_surr */
5961 0x02, 0x03, 0x04, 0x05
5964 /* identical with ALC880 */
5965 #define alc882_adc_nids alc880_adc_nids
5966 #define alc882_adc_nids_alt alc880_adc_nids_alt
5968 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5969 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5972 /* FIXME: should be a matrix-type input source selection */
5974 static struct hda_input_mux alc882_capture_source = {
5978 { "Front Mic", 0x1 },
5986 static struct hda_verb alc882_3ST_ch2_init[] = {
5987 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5988 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5989 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5990 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5997 static struct hda_verb alc882_3ST_ch6_init[] = {
5998 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5999 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6000 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6001 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6002 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6003 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6007 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6008 { 2, alc882_3ST_ch2_init },
6009 { 6, alc882_3ST_ch6_init },
6015 static struct hda_verb alc882_sixstack_ch6_init[] = {
6016 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6017 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6018 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6019 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6026 static struct hda_verb alc882_sixstack_ch8_init[] = {
6027 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6028 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6029 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6030 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6034 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6035 { 6, alc882_sixstack_ch6_init },
6036 { 8, alc882_sixstack_ch8_init },
6040 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6046 static struct hda_verb alc885_mbp_ch2_init[] = {
6047 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6048 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6049 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6056 static struct hda_verb alc885_mbp_ch6_init[] = {
6057 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6058 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6059 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6060 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6061 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6065 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6066 { 2, alc885_mbp_ch2_init },
6067 { 6, alc885_mbp_ch6_init },
6071 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6072 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6074 static struct snd_kcontrol_new alc882_base_mixer[] = {
6075 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6076 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6077 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6078 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6079 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6080 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6081 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6082 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6083 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6084 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6085 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6086 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6087 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6088 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6089 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6090 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6091 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6093 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6094 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6095 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6099 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6101 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6102 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6103 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6104 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6105 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6107 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6108 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6109 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6112 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6113 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6114 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6115 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6116 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6117 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6118 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6120 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6125 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6127 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6136 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6137 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6138 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6142 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6143 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6145 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6147 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6148 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6149 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6152 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6153 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6154 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6155 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6158 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6162 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6163 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6164 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6166 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6167 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6168 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6169 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6171 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6176 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6178 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6179 .name = "Channel Mode",
6180 .info = alc_ch_mode_info,
6181 .get = alc_ch_mode_get,
6182 .put = alc_ch_mode_put,
6187 static struct hda_verb alc882_init_verbs[] = {
6188 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6193 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6194 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6195 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6197 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6198 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6201 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6202 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6203 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6205 /* Front Pin: output 0 (0x0c) */
6206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6208 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6209 /* Rear Pin: output 1 (0x0d) */
6210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6211 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6212 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6213 /* CLFE Pin: output 2 (0x0e) */
6214 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6215 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6216 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6217 /* Side Pin: output 3 (0x0f) */
6218 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6219 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6220 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6221 /* Mic (rear) pin: input vref at 80% */
6222 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6223 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6224 /* Front Mic pin: input vref at 80% */
6225 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6226 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6227 /* Line In pin: input */
6228 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6229 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6230 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6231 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6232 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6233 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6234 /* CD pin widget for input */
6235 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6237 /* FIXME: use matrix-type input source selection */
6238 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6239 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6240 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6242 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6254 /* ADC1: mute amp left and right */
6255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6256 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6257 /* ADC2: mute amp left and right */
6258 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6259 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6260 /* ADC3: mute amp left and right */
6261 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6262 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6267 static struct hda_verb alc882_eapd_verbs[] = {
6268 /* change to EAPD mode */
6269 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6270 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6275 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6276 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6277 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6278 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6279 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6280 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6281 /* FIXME: this looks suspicious...
6282 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6283 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6288 static struct hda_verb alc882_macpro_init_verbs[] = {
6289 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6293 /* Front Pin: output 0 (0x0c) */
6294 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6295 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6296 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6297 /* Front Mic pin: input vref at 80% */
6298 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6299 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6300 /* Speaker: output */
6301 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6302 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6303 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6304 /* Headphone output (output 0 - 0x0c) */
6305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6307 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6309 /* FIXME: use matrix-type input source selection */
6310 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6311 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6320 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6325 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6326 /* ADC1: mute amp left and right */
6327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6328 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6329 /* ADC2: mute amp left and right */
6330 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6331 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6332 /* ADC3: mute amp left and right */
6333 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6334 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6339 /* Macbook Pro rev3 */
6340 static struct hda_verb alc885_mbp3_init_verbs[] = {
6341 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6342 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6349 /* Front Pin: output 0 (0x0c) */
6350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6351 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6352 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6353 /* HP Pin: output 0 (0x0d) */
6354 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6355 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6356 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6357 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6358 /* Mic (rear) pin: input vref at 80% */
6359 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6360 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6361 /* Front Mic pin: input vref at 80% */
6362 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6363 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6364 /* Line In pin: use output 1 when in LineOut mode */
6365 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6366 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6367 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6369 /* FIXME: use matrix-type input source selection */
6370 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6371 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6386 /* ADC1: mute amp left and right */
6387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6388 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6389 /* ADC2: mute amp left and right */
6390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6391 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6392 /* ADC3: mute amp left and right */
6393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6394 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6399 /* iMac 24 mixer. */
6400 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6401 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6402 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6406 /* iMac 24 init verbs. */
6407 static struct hda_verb alc885_imac24_init_verbs[] = {
6408 /* Internal speakers: output 0 (0x0c) */
6409 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6410 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6411 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6412 /* Internal speakers: output 0 (0x0c) */
6413 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6415 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6416 /* Headphone: output 0 (0x0c) */
6417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6418 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6419 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6420 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6421 /* Front Mic: input vref at 80% */
6422 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6423 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6427 /* Toggle speaker-output according to the hp-jack state */
6428 static void alc885_imac24_automute(struct hda_codec *codec)
6430 unsigned int present;
6432 present = snd_hda_codec_read(codec, 0x14, 0,
6433 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6434 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6435 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6436 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6437 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6440 /* Processes unsolicited events. */
6441 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6444 /* Headphone insertion or removal. */
6445 if ((res >> 26) == ALC880_HP_EVENT)
6446 alc885_imac24_automute(codec);
6449 static void alc885_mbp3_automute(struct hda_codec *codec)
6451 unsigned int present;
6453 present = snd_hda_codec_read(codec, 0x15, 0,
6454 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6455 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6456 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6457 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6458 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6461 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6464 /* Headphone insertion or removal. */
6465 if ((res >> 26) == ALC880_HP_EVENT)
6466 alc885_mbp3_automute(codec);
6470 static struct hda_verb alc882_targa_verbs[] = {
6471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6477 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6478 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6479 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6481 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6482 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6483 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6484 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6488 /* toggle speaker-output according to the hp-jack state */
6489 static void alc882_targa_automute(struct hda_codec *codec)
6491 unsigned int present;
6493 present = snd_hda_codec_read(codec, 0x14, 0,
6494 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6495 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6496 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6497 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6501 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6503 /* Looks like the unsol event is incompatible with the standard
6504 * definition. 4bit tag is placed at 26 bit!
6506 if (((res >> 26) == ALC880_HP_EVENT)) {
6507 alc882_targa_automute(codec);
6511 static struct hda_verb alc882_asus_a7j_verbs[] = {
6512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6516 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6517 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6519 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6521 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6523 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6524 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6525 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6529 static struct hda_verb alc882_asus_a7m_verbs[] = {
6530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6535 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6537 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6538 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6539 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6541 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6542 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6543 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6547 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6549 unsigned int gpiostate, gpiomask, gpiodir;
6551 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6552 AC_VERB_GET_GPIO_DATA, 0);
6555 gpiostate |= (1 << pin);
6557 gpiostate &= ~(1 << pin);
6559 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6560 AC_VERB_GET_GPIO_MASK, 0);
6561 gpiomask |= (1 << pin);
6563 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6564 AC_VERB_GET_GPIO_DIRECTION, 0);
6565 gpiodir |= (1 << pin);
6568 snd_hda_codec_write(codec, codec->afg, 0,
6569 AC_VERB_SET_GPIO_MASK, gpiomask);
6570 snd_hda_codec_write(codec, codec->afg, 0,
6571 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6575 snd_hda_codec_write(codec, codec->afg, 0,
6576 AC_VERB_SET_GPIO_DATA, gpiostate);
6579 /* set up GPIO at initialization */
6580 static void alc885_macpro_init_hook(struct hda_codec *codec)
6582 alc882_gpio_mute(codec, 0, 0);
6583 alc882_gpio_mute(codec, 1, 0);
6586 /* set up GPIO and update auto-muting at initialization */
6587 static void alc885_imac24_init_hook(struct hda_codec *codec)
6589 alc885_macpro_init_hook(codec);
6590 alc885_imac24_automute(codec);
6594 * generic initialization of ADC, input mixers and output mixers
6596 static struct hda_verb alc882_auto_init_verbs[] = {
6598 * Unmute ADC0-2 and set the default input to mic-in
6600 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6602 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6604 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6605 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6607 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6609 * Note: PASD motherboards uses the Line In 2 as the input for
6610 * front panel mic (mic 2)
6612 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6616 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6617 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6620 * Set up output mixers (0x0c - 0x0f)
6622 /* set vol=0 to output mixers */
6623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6624 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6626 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6627 /* set up input amps for analog loopback */
6628 /* Amp Indices: DAC = 0, mixer = 1 */
6629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6630 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6631 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6632 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6633 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6634 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6635 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6636 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6637 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6638 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6640 /* FIXME: use matrix-type input source selection */
6641 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6642 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6648 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6661 #ifdef CONFIG_SND_HDA_POWER_SAVE
6662 #define alc882_loopbacks alc880_loopbacks
6665 /* pcm configuration: identiacal with ALC880 */
6666 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6667 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6668 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6669 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6672 * configuration and preset
6674 static const char *alc882_models[ALC882_MODEL_LAST] = {
6675 [ALC882_3ST_DIG] = "3stack-dig",
6676 [ALC882_6ST_DIG] = "6stack-dig",
6677 [ALC882_ARIMA] = "arima",
6678 [ALC882_W2JC] = "w2jc",
6679 [ALC882_TARGA] = "targa",
6680 [ALC882_ASUS_A7J] = "asus-a7j",
6681 [ALC882_ASUS_A7M] = "asus-a7m",
6682 [ALC885_MACPRO] = "macpro",
6683 [ALC885_MBP3] = "mbp3",
6684 [ALC885_IMAC24] = "imac24",
6685 [ALC882_AUTO] = "auto",
6688 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6689 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6690 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6691 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6692 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6693 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6694 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6695 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6696 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6697 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6698 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6699 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6700 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6704 static struct alc_config_preset alc882_presets[] = {
6705 [ALC882_3ST_DIG] = {
6706 .mixers = { alc882_base_mixer },
6707 .init_verbs = { alc882_init_verbs },
6708 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6709 .dac_nids = alc882_dac_nids,
6710 .dig_out_nid = ALC882_DIGOUT_NID,
6711 .dig_in_nid = ALC882_DIGIN_NID,
6712 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6713 .channel_mode = alc882_ch_modes,
6715 .input_mux = &alc882_capture_source,
6717 [ALC882_6ST_DIG] = {
6718 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6719 .init_verbs = { alc882_init_verbs },
6720 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6721 .dac_nids = alc882_dac_nids,
6722 .dig_out_nid = ALC882_DIGOUT_NID,
6723 .dig_in_nid = ALC882_DIGIN_NID,
6724 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6725 .channel_mode = alc882_sixstack_modes,
6726 .input_mux = &alc882_capture_source,
6729 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6730 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6731 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6732 .dac_nids = alc882_dac_nids,
6733 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6734 .channel_mode = alc882_sixstack_modes,
6735 .input_mux = &alc882_capture_source,
6738 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6739 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6740 alc880_gpio1_init_verbs },
6741 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6742 .dac_nids = alc882_dac_nids,
6743 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6744 .channel_mode = alc880_threestack_modes,
6746 .input_mux = &alc882_capture_source,
6747 .dig_out_nid = ALC882_DIGOUT_NID,
6750 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6751 .init_verbs = { alc885_mbp3_init_verbs,
6752 alc880_gpio1_init_verbs },
6753 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6754 .dac_nids = alc882_dac_nids,
6755 .channel_mode = alc885_mbp_6ch_modes,
6756 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6757 .input_mux = &alc882_capture_source,
6758 .dig_out_nid = ALC882_DIGOUT_NID,
6759 .dig_in_nid = ALC882_DIGIN_NID,
6760 .unsol_event = alc885_mbp3_unsol_event,
6761 .init_hook = alc885_mbp3_automute,
6764 .mixers = { alc882_macpro_mixer },
6765 .init_verbs = { alc882_macpro_init_verbs },
6766 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6767 .dac_nids = alc882_dac_nids,
6768 .dig_out_nid = ALC882_DIGOUT_NID,
6769 .dig_in_nid = ALC882_DIGIN_NID,
6770 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6771 .channel_mode = alc882_ch_modes,
6772 .input_mux = &alc882_capture_source,
6773 .init_hook = alc885_macpro_init_hook,
6776 .mixers = { alc885_imac24_mixer },
6777 .init_verbs = { alc885_imac24_init_verbs },
6778 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6779 .dac_nids = alc882_dac_nids,
6780 .dig_out_nid = ALC882_DIGOUT_NID,
6781 .dig_in_nid = ALC882_DIGIN_NID,
6782 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6783 .channel_mode = alc882_ch_modes,
6784 .input_mux = &alc882_capture_source,
6785 .unsol_event = alc885_imac24_unsol_event,
6786 .init_hook = alc885_imac24_init_hook,
6789 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6790 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6791 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6792 .dac_nids = alc882_dac_nids,
6793 .dig_out_nid = ALC882_DIGOUT_NID,
6794 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6795 .adc_nids = alc882_adc_nids,
6796 .capsrc_nids = alc882_capsrc_nids,
6797 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6798 .channel_mode = alc882_3ST_6ch_modes,
6800 .input_mux = &alc882_capture_source,
6801 .unsol_event = alc882_targa_unsol_event,
6802 .init_hook = alc882_targa_automute,
6804 [ALC882_ASUS_A7J] = {
6805 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6806 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6807 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6808 .dac_nids = alc882_dac_nids,
6809 .dig_out_nid = ALC882_DIGOUT_NID,
6810 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6811 .adc_nids = alc882_adc_nids,
6812 .capsrc_nids = alc882_capsrc_nids,
6813 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6814 .channel_mode = alc882_3ST_6ch_modes,
6816 .input_mux = &alc882_capture_source,
6818 [ALC882_ASUS_A7M] = {
6819 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6820 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6821 alc880_gpio1_init_verbs,
6822 alc882_asus_a7m_verbs },
6823 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6824 .dac_nids = alc882_dac_nids,
6825 .dig_out_nid = ALC882_DIGOUT_NID,
6826 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6827 .channel_mode = alc880_threestack_modes,
6829 .input_mux = &alc882_capture_source,
6838 PINFIX_ABIT_AW9D_MAX
6841 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6842 { 0x15, 0x01080104 }, /* side */
6843 { 0x16, 0x01011012 }, /* rear */
6844 { 0x17, 0x01016011 }, /* clfe */
6848 static const struct alc_pincfg *alc882_pin_fixes[] = {
6849 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6852 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6853 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6858 * BIOS auto configuration
6860 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6861 hda_nid_t nid, int pin_type,
6865 struct alc_spec *spec = codec->spec;
6868 alc_set_pin_output(codec, nid, pin_type);
6869 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6872 idx = spec->multiout.dac_nids[dac_idx] - 2;
6873 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6877 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6879 struct alc_spec *spec = codec->spec;
6882 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6883 for (i = 0; i <= HDA_SIDE; i++) {
6884 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6885 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6887 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6892 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6894 struct alc_spec *spec = codec->spec;
6897 pin = spec->autocfg.hp_pins[0];
6898 if (pin) /* connect to front */
6900 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6901 pin = spec->autocfg.speaker_pins[0];
6903 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6906 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6907 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6909 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6911 struct alc_spec *spec = codec->spec;
6914 for (i = 0; i < AUTO_PIN_LAST; i++) {
6915 hda_nid_t nid = spec->autocfg.input_pins[i];
6920 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6921 unsigned int pincap;
6922 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6923 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6927 snd_hda_codec_write(codec, nid, 0,
6928 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6929 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6930 snd_hda_codec_write(codec, nid, 0,
6931 AC_VERB_SET_AMP_GAIN_MUTE,
6936 static void alc882_auto_init_input_src(struct hda_codec *codec)
6938 struct alc_spec *spec = codec->spec;
6941 for (c = 0; c < spec->num_adc_nids; c++) {
6942 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6943 hda_nid_t nid = spec->capsrc_nids[c];
6944 unsigned int mux_idx;
6945 const struct hda_input_mux *imux;
6946 int conns, mute, idx, item;
6948 conns = snd_hda_get_connections(codec, nid, conn_list,
6949 ARRAY_SIZE(conn_list));
6952 mux_idx = c >= spec->num_mux_defs ? 0 : c;
6953 imux = &spec->input_mux[mux_idx];
6954 for (idx = 0; idx < conns; idx++) {
6955 /* if the current connection is the selected one,
6956 * unmute it as default - otherwise mute it
6958 mute = AMP_IN_MUTE(idx);
6959 for (item = 0; item < imux->num_items; item++) {
6960 if (imux->items[item].index == idx) {
6961 if (spec->cur_mux[c] == item)
6962 mute = AMP_IN_UNMUTE(idx);
6966 /* check if we have a selector or mixer
6967 * we could check for the widget type instead, but
6968 * just check for Amp-In presence (in case of mixer
6969 * without amp-in there is something wrong, this
6970 * function shouldn't be used or capsrc nid is wrong)
6972 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
6973 snd_hda_codec_write(codec, nid, 0,
6974 AC_VERB_SET_AMP_GAIN_MUTE,
6976 else if (mute != AMP_IN_MUTE(idx))
6977 snd_hda_codec_write(codec, nid, 0,
6978 AC_VERB_SET_CONNECT_SEL,
6984 /* add mic boosts if needed */
6985 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6987 struct alc_spec *spec = codec->spec;
6991 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6992 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6993 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6995 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6999 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7000 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7001 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7003 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7010 /* almost identical with ALC880 parser... */
7011 static int alc882_parse_auto_config(struct hda_codec *codec)
7013 struct alc_spec *spec = codec->spec;
7014 int err = alc880_parse_auto_config(codec);
7019 return 0; /* no config found */
7021 err = alc_auto_add_mic_boost(codec);
7025 /* hack - override the init verbs */
7026 spec->init_verbs[0] = alc882_auto_init_verbs;
7028 return 1; /* config found */
7031 /* additional initialization for auto-configuration model */
7032 static void alc882_auto_init(struct hda_codec *codec)
7034 struct alc_spec *spec = codec->spec;
7035 alc882_auto_init_multi_out(codec);
7036 alc882_auto_init_hp_out(codec);
7037 alc882_auto_init_analog_input(codec);
7038 alc882_auto_init_input_src(codec);
7039 if (spec->unsol_event)
7040 alc_inithook(codec);
7043 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7045 static int patch_alc882(struct hda_codec *codec)
7047 struct alc_spec *spec;
7048 int err, board_config;
7050 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7056 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7060 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7061 /* Pick up systems that don't supply PCI SSID */
7062 switch (codec->subsystem_id) {
7063 case 0x106b0c00: /* Mac Pro */
7064 board_config = ALC885_MACPRO;
7066 case 0x106b1000: /* iMac 24 */
7067 case 0x106b2800: /* AppleTV */
7068 case 0x106b3e00: /* iMac 24 Aluminium */
7069 board_config = ALC885_IMAC24;
7071 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7072 case 0x106b00a4: /* MacbookPro4,1 */
7073 case 0x106b2c00: /* Macbook Pro rev3 */
7074 case 0x106b3600: /* Macbook 3.1 */
7075 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7076 board_config = ALC885_MBP3;
7079 /* ALC889A is handled better as ALC888-compatible */
7080 if (codec->revision_id == 0x100101 ||
7081 codec->revision_id == 0x100103) {
7083 return patch_alc883(codec);
7085 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7086 "trying auto-probe from BIOS...\n");
7087 board_config = ALC882_AUTO;
7091 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7093 if (board_config == ALC882_AUTO) {
7094 /* automatic parse from the BIOS config */
7095 err = alc882_parse_auto_config(codec);
7101 "hda_codec: Cannot set up configuration "
7102 "from BIOS. Using base mode...\n");
7103 board_config = ALC882_3ST_DIG;
7107 err = snd_hda_attach_beep_device(codec, 0x1);
7113 if (board_config != ALC882_AUTO)
7114 setup_preset(spec, &alc882_presets[board_config]);
7116 if (codec->vendor_id == 0x10ec0885) {
7117 spec->stream_name_analog = "ALC885 Analog";
7118 spec->stream_name_digital = "ALC885 Digital";
7120 spec->stream_name_analog = "ALC882 Analog";
7121 spec->stream_name_digital = "ALC882 Digital";
7124 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7125 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7126 /* FIXME: setup DAC5 */
7127 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7128 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7130 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7131 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7133 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7134 if (!spec->adc_nids && spec->input_mux) {
7135 /* check whether NID 0x07 is valid */
7136 unsigned int wcap = get_wcaps(codec, 0x07);
7138 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7139 if (wcap != AC_WID_AUD_IN) {
7140 spec->adc_nids = alc882_adc_nids_alt;
7141 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7142 spec->capsrc_nids = alc882_capsrc_nids_alt;
7144 spec->adc_nids = alc882_adc_nids;
7145 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7146 spec->capsrc_nids = alc882_capsrc_nids;
7149 set_capture_mixer(spec);
7150 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7152 spec->vmaster_nid = 0x0c;
7154 codec->patch_ops = alc_patch_ops;
7155 if (board_config == ALC882_AUTO)
7156 spec->init_hook = alc882_auto_init;
7157 #ifdef CONFIG_SND_HDA_POWER_SAVE
7158 if (!spec->loopback.amplist)
7159 spec->loopback.amplist = alc882_loopbacks;
7161 codec->proc_widget_hook = print_realtek_coef;
7169 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7170 * configuration. Each pin widget can choose any input DACs and a mixer.
7171 * Each ADC is connected from a mixer of all inputs. This makes possible
7172 * 6-channel independent captures.
7174 * In addition, an independent DAC for the multi-playback (not used in this
7177 #define ALC883_DIGOUT_NID 0x06
7178 #define ALC883_DIGIN_NID 0x0a
7180 #define ALC1200_DIGOUT_NID 0x10
7182 static hda_nid_t alc883_dac_nids[4] = {
7183 /* front, rear, clfe, rear_surr */
7184 0x02, 0x03, 0x04, 0x05
7187 static hda_nid_t alc883_adc_nids[2] = {
7192 static hda_nid_t alc883_adc_nids_alt[1] = {
7197 static hda_nid_t alc883_adc_nids_rev[2] = {
7202 #define alc889_adc_nids alc880_adc_nids
7204 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7206 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7208 #define alc889_capsrc_nids alc882_capsrc_nids
7211 /* FIXME: should be a matrix-type input source selection */
7213 static struct hda_input_mux alc883_capture_source = {
7217 { "Front Mic", 0x1 },
7223 static struct hda_input_mux alc883_3stack_6ch_intel = {
7227 { "Front Mic", 0x0 },
7233 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7241 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7251 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7259 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7263 { "Front Mic", 0x1 },
7268 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7279 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7286 static struct hda_verb alc883_3ST_ch2_init[] = {
7287 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7288 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7289 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7290 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7297 static struct hda_verb alc883_3ST_ch4_init[] = {
7298 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7299 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7300 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7301 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7302 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7309 static struct hda_verb alc883_3ST_ch6_init[] = {
7310 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7311 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7312 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7313 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7314 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7315 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7319 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7320 { 2, alc883_3ST_ch2_init },
7321 { 4, alc883_3ST_ch4_init },
7322 { 6, alc883_3ST_ch6_init },
7328 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7329 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7330 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7331 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7332 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7339 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7340 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7341 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7342 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7343 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7344 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7351 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7352 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7353 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7354 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7355 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7356 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7357 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7361 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7362 { 2, alc883_3ST_ch2_intel_init },
7363 { 4, alc883_3ST_ch4_intel_init },
7364 { 6, alc883_3ST_ch6_intel_init },
7370 static struct hda_verb alc883_sixstack_ch6_init[] = {
7371 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7372 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7373 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7374 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7381 static struct hda_verb alc883_sixstack_ch8_init[] = {
7382 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7383 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7384 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7385 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7389 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7390 { 6, alc883_sixstack_ch6_init },
7391 { 8, alc883_sixstack_ch8_init },
7394 static struct hda_verb alc883_medion_eapd_verbs[] = {
7395 /* eanable EAPD on medion laptop */
7396 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7397 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7401 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7402 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7405 static struct snd_kcontrol_new alc883_base_mixer[] = {
7406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7407 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7408 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7409 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7410 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7411 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7412 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7413 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7414 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7415 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7416 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7419 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7420 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7425 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7426 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7430 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7431 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7432 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7433 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7434 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7435 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7436 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7439 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7441 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7442 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7443 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7447 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7448 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7449 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7450 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7451 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7452 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7453 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7455 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7456 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7457 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7461 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7462 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7463 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7464 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7465 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7466 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7467 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7469 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7471 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7475 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7476 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7478 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7484 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7486 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7487 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7488 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7492 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7493 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7494 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7496 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7497 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7498 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7499 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7500 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7501 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7502 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7503 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7504 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7505 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7507 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7508 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7509 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7510 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7511 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7515 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7516 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7517 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7518 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7519 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7520 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7522 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7523 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7524 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7525 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7526 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7527 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7528 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7529 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7530 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7531 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7533 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7534 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7535 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7539 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7540 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7541 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7542 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7543 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7544 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7545 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7546 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7547 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7548 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7549 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7550 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7551 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7552 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7553 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7554 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7555 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7556 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7557 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7558 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7562 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7563 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7564 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7565 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7566 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7567 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7568 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7569 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7570 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7571 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7572 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7573 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7574 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7575 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7576 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7577 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7578 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7582 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7583 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7585 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7586 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7587 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7590 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7591 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7592 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7593 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7597 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7598 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7599 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7600 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7601 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7602 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7604 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7605 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7609 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7610 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7611 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7613 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7614 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7617 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7618 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7622 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7623 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7624 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7625 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7626 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7627 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7631 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7635 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7636 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7637 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7647 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7648 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7649 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7650 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7651 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7652 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7653 0x0d, 1, 0x0, HDA_OUTPUT),
7654 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7655 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7656 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7657 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7658 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7660 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7661 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7662 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7663 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7664 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7665 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7666 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7669 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7670 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7674 static struct hda_bind_ctls alc883_bind_cap_vol = {
7675 .ops = &snd_hda_bind_vol,
7677 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7678 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7683 static struct hda_bind_ctls alc883_bind_cap_switch = {
7684 .ops = &snd_hda_bind_sw,
7686 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7687 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7692 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7693 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7694 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7695 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7696 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7697 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7698 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7699 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7700 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7704 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7705 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7706 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7708 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7709 /* .name = "Capture Source", */
7710 .name = "Input Source",
7712 .info = alc_mux_enum_info,
7713 .get = alc_mux_enum_get,
7714 .put = alc_mux_enum_put,
7719 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7721 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7722 .name = "Channel Mode",
7723 .info = alc_ch_mode_info,
7724 .get = alc_ch_mode_get,
7725 .put = alc_ch_mode_put,
7730 static struct hda_verb alc883_init_verbs[] = {
7731 /* ADC1: mute amp left and right */
7732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7733 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7734 /* ADC2: mute amp left and right */
7735 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7736 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7737 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7746 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7750 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7751 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7752 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7754 /* mute analog input loopbacks */
7755 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7756 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7757 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7761 /* Front Pin: output 0 (0x0c) */
7762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7764 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7765 /* Rear Pin: output 1 (0x0d) */
7766 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7767 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7768 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7769 /* CLFE Pin: output 2 (0x0e) */
7770 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7772 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7773 /* Side Pin: output 3 (0x0f) */
7774 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7775 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7776 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7777 /* Mic (rear) pin: input vref at 80% */
7778 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7779 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7780 /* Front Mic pin: input vref at 80% */
7781 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7782 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7783 /* Line In pin: input */
7784 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7785 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7786 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7787 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7788 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7789 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7790 /* CD pin widget for input */
7791 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7793 /* FIXME: use matrix-type input source selection */
7794 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7796 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7797 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7798 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7799 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7803 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7804 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7808 /* toggle speaker-output according to the hp-jack state */
7809 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7811 unsigned int present;
7813 present = snd_hda_codec_read(codec, 0x15, 0,
7814 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7815 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7816 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7817 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7818 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7821 /* auto-toggle front mic */
7823 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7825 unsigned int present;
7828 present = snd_hda_codec_read(codec, 0x18, 0,
7829 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7830 bits = present ? HDA_AMP_MUTE : 0;
7831 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7835 static void alc883_mitac_automute(struct hda_codec *codec)
7837 alc883_mitac_hp_automute(codec);
7838 /* alc883_mitac_mic_automute(codec); */
7841 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7844 switch (res >> 26) {
7845 case ALC880_HP_EVENT:
7846 alc883_mitac_hp_automute(codec);
7848 case ALC880_MIC_EVENT:
7849 /* alc883_mitac_mic_automute(codec); */
7854 static struct hda_verb alc883_mitac_verbs[] = {
7856 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7857 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7859 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7860 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7862 /* enable unsolicited event */
7863 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7864 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7869 static struct hda_verb alc883_clevo_m720_verbs[] = {
7871 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7874 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7877 /* enable unsolicited event */
7878 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7879 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7884 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7886 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7889 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7892 /* enable unsolicited event */
7893 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7898 static struct hda_verb alc883_tagra_verbs[] = {
7899 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7902 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7903 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7905 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7906 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7907 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7909 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7910 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7911 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7912 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7917 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7918 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7919 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7920 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7924 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7925 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7927 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7928 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7932 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7933 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7935 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7936 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7937 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7941 static struct hda_verb alc883_haier_w66_verbs[] = {
7942 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7945 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7947 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7948 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7949 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7950 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7954 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7957 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7959 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7960 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7961 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7962 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7966 static struct hda_verb alc888_3st_hp_verbs[] = {
7967 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7968 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7969 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7973 static struct hda_verb alc888_6st_dell_verbs[] = {
7974 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7978 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7979 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7980 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7981 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7982 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7986 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7987 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7988 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7989 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7990 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7994 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7995 { 2, alc888_3st_hp_2ch_init },
7996 { 6, alc888_3st_hp_6ch_init },
7999 /* toggle front-jack and RCA according to the hp-jack state */
8000 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8002 unsigned int present;
8004 present = snd_hda_codec_read(codec, 0x1b, 0,
8005 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8006 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8007 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8008 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8009 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8012 /* toggle RCA according to the front-jack state */
8013 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8015 unsigned int present;
8017 present = snd_hda_codec_read(codec, 0x14, 0,
8018 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8019 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8020 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8023 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8026 if ((res >> 26) == ALC880_HP_EVENT)
8027 alc888_lenovo_ms7195_front_automute(codec);
8028 if ((res >> 26) == ALC880_FRONT_EVENT)
8029 alc888_lenovo_ms7195_rca_automute(codec);
8032 static struct hda_verb alc883_medion_md2_verbs[] = {
8033 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8038 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8042 /* toggle speaker-output according to the hp-jack state */
8043 static void alc883_medion_md2_automute(struct hda_codec *codec)
8045 unsigned int present;
8047 present = snd_hda_codec_read(codec, 0x14, 0,
8048 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8049 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8050 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8053 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8056 if ((res >> 26) == ALC880_HP_EVENT)
8057 alc883_medion_md2_automute(codec);
8060 /* toggle speaker-output according to the hp-jack state */
8061 static void alc883_tagra_automute(struct hda_codec *codec)
8063 unsigned int present;
8066 present = snd_hda_codec_read(codec, 0x14, 0,
8067 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8068 bits = present ? HDA_AMP_MUTE : 0;
8069 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8070 HDA_AMP_MUTE, bits);
8071 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8075 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8077 if ((res >> 26) == ALC880_HP_EVENT)
8078 alc883_tagra_automute(codec);
8081 /* toggle speaker-output according to the hp-jack state */
8082 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8084 unsigned int present;
8087 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8088 & AC_PINSENSE_PRESENCE;
8089 bits = present ? HDA_AMP_MUTE : 0;
8090 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8091 HDA_AMP_MUTE, bits);
8094 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8096 unsigned int present;
8098 present = snd_hda_codec_read(codec, 0x18, 0,
8099 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8100 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8101 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8104 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8106 alc883_clevo_m720_hp_automute(codec);
8107 alc883_clevo_m720_mic_automute(codec);
8110 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8113 switch (res >> 26) {
8114 case ALC880_HP_EVENT:
8115 alc883_clevo_m720_hp_automute(codec);
8117 case ALC880_MIC_EVENT:
8118 alc883_clevo_m720_mic_automute(codec);
8123 /* toggle speaker-output according to the hp-jack state */
8124 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8126 unsigned int present;
8129 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8130 & AC_PINSENSE_PRESENCE;
8131 bits = present ? HDA_AMP_MUTE : 0;
8132 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8133 HDA_AMP_MUTE, bits);
8136 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8139 if ((res >> 26) == ALC880_HP_EVENT)
8140 alc883_2ch_fujitsu_pi2515_automute(codec);
8143 static void alc883_haier_w66_automute(struct hda_codec *codec)
8145 unsigned int present;
8148 present = snd_hda_codec_read(codec, 0x1b, 0,
8149 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8150 bits = present ? 0x80 : 0;
8151 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8155 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8158 if ((res >> 26) == ALC880_HP_EVENT)
8159 alc883_haier_w66_automute(codec);
8162 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8164 unsigned int present;
8167 present = snd_hda_codec_read(codec, 0x14, 0,
8168 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8169 bits = present ? HDA_AMP_MUTE : 0;
8170 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8171 HDA_AMP_MUTE, bits);
8174 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8176 unsigned int present;
8179 present = snd_hda_codec_read(codec, 0x1b, 0,
8180 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8181 bits = present ? HDA_AMP_MUTE : 0;
8182 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8183 HDA_AMP_MUTE, bits);
8184 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8185 HDA_AMP_MUTE, bits);
8188 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8191 if ((res >> 26) == ALC880_HP_EVENT)
8192 alc883_lenovo_101e_all_automute(codec);
8193 if ((res >> 26) == ALC880_FRONT_EVENT)
8194 alc883_lenovo_101e_ispeaker_automute(codec);
8197 /* toggle speaker-output according to the hp-jack state */
8198 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8200 unsigned int present;
8202 present = snd_hda_codec_read(codec, 0x14, 0,
8203 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8204 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8205 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8206 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8207 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8210 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8213 if ((res >> 26) == ALC880_HP_EVENT)
8214 alc883_acer_aspire_automute(codec);
8217 static struct hda_verb alc883_acer_eapd_verbs[] = {
8218 /* HP Pin: output 0 (0x0c) */
8219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8221 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8222 /* Front Pin: output 0 (0x0c) */
8223 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8224 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8225 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8226 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8227 /* eanable EAPD on medion laptop */
8228 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8229 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8230 /* enable unsolicited event */
8231 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8235 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8237 unsigned int present;
8239 present = snd_hda_codec_read(codec, 0x1b, 0,
8240 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8241 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8242 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8243 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8244 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8245 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8246 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8247 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8248 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8251 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8254 switch (res >> 26) {
8255 case ALC880_HP_EVENT:
8256 /* printk(KERN_DEBUG "hp_event\n"); */
8257 alc888_6st_dell_front_automute(codec);
8262 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8265 unsigned int present;
8267 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8268 present = snd_hda_codec_read(codec, 0x1b, 0,
8269 AC_VERB_GET_PIN_SENSE, 0);
8270 present = (present & 0x80000000) != 0;
8272 /* mute internal speaker */
8273 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8274 HDA_AMP_MUTE, HDA_AMP_MUTE);
8275 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8276 HDA_AMP_MUTE, HDA_AMP_MUTE);
8277 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8278 HDA_AMP_MUTE, HDA_AMP_MUTE);
8279 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8280 HDA_AMP_MUTE, HDA_AMP_MUTE);
8281 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8282 HDA_AMP_MUTE, HDA_AMP_MUTE);
8284 /* unmute internal speaker if necessary */
8285 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8286 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8287 HDA_AMP_MUTE, mute);
8288 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8289 HDA_AMP_MUTE, mute);
8290 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8291 HDA_AMP_MUTE, mute);
8292 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8293 HDA_AMP_MUTE, mute);
8294 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8295 HDA_AMP_MUTE, mute);
8299 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8302 if ((res >> 26) == ALC880_HP_EVENT)
8303 alc888_lenovo_sky_front_automute(codec);
8307 * generic initialization of ADC, input mixers and output mixers
8309 static struct hda_verb alc883_auto_init_verbs[] = {
8311 * Unmute ADC0-2 and set the default input to mic-in
8313 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8314 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8315 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8318 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8320 * Note: PASD motherboards uses the Line In 2 as the input for
8321 * front panel mic (mic 2)
8323 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8331 * Set up output mixers (0x0c - 0x0f)
8333 /* set vol=0 to output mixers */
8334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8337 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8338 /* set up input amps for analog loopback */
8339 /* Amp Indices: DAC = 0, mixer = 1 */
8340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8341 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8346 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8348 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8349 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8351 /* FIXME: use matrix-type input source selection */
8352 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8354 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8355 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8357 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8360 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8363 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8369 static struct hda_verb alc888_asus_m90v_verbs[] = {
8370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8373 /* enable unsolicited event */
8374 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8375 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8379 static void alc883_nb_mic_automute(struct hda_codec *codec)
8381 unsigned int present;
8383 present = snd_hda_codec_read(codec, 0x18, 0,
8384 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8385 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8386 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8387 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8388 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8391 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8393 unsigned int present;
8396 present = snd_hda_codec_read(codec, 0x1b, 0,
8397 AC_VERB_GET_PIN_SENSE, 0)
8398 & AC_PINSENSE_PRESENCE;
8399 bits = present ? 0 : PIN_OUT;
8400 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8402 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8404 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8408 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8411 switch (res >> 26) {
8412 case ALC880_HP_EVENT:
8413 alc883_M90V_speaker_automute(codec);
8415 case ALC880_MIC_EVENT:
8416 alc883_nb_mic_automute(codec);
8421 static void alc883_mode2_inithook(struct hda_codec *codec)
8423 alc883_M90V_speaker_automute(codec);
8424 alc883_nb_mic_automute(codec);
8427 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8429 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8431 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8432 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8433 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8434 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8435 /* enable unsolicited event */
8436 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8440 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8442 unsigned int present;
8445 present = snd_hda_codec_read(codec, 0x14, 0,
8446 AC_VERB_GET_PIN_SENSE, 0)
8447 & AC_PINSENSE_PRESENCE;
8448 bits = present ? 0 : PIN_OUT;
8449 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8453 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8456 switch (res >> 26) {
8457 case ALC880_HP_EVENT:
8458 alc883_eee1601_speaker_automute(codec);
8463 static void alc883_eee1601_inithook(struct hda_codec *codec)
8465 alc883_eee1601_speaker_automute(codec);
8468 #ifdef CONFIG_SND_HDA_POWER_SAVE
8469 #define alc883_loopbacks alc880_loopbacks
8472 /* pcm configuration: identiacal with ALC880 */
8473 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8474 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8475 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8476 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8477 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8480 * configuration and preset
8482 static const char *alc883_models[ALC883_MODEL_LAST] = {
8483 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8484 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8485 [ALC883_3ST_6ch] = "3stack-6ch",
8486 [ALC883_6ST_DIG] = "6stack-dig",
8487 [ALC883_TARGA_DIG] = "targa-dig",
8488 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8489 [ALC883_ACER] = "acer",
8490 [ALC883_ACER_ASPIRE] = "acer-aspire",
8491 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8492 [ALC883_MEDION] = "medion",
8493 [ALC883_MEDION_MD2] = "medion-md2",
8494 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8495 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8496 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8497 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8498 [ALC888_LENOVO_SKY] = "lenovo-sky",
8499 [ALC883_HAIER_W66] = "haier-w66",
8500 [ALC888_3ST_HP] = "3stack-hp",
8501 [ALC888_6ST_DELL] = "6stack-dell",
8502 [ALC883_MITAC] = "mitac",
8503 [ALC883_CLEVO_M720] = "clevo-m720",
8504 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8505 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8506 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8507 [ALC1200_ASUS_P5Q] = "asus-p5q",
8508 [ALC883_AUTO] = "auto",
8511 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8512 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8513 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8514 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8515 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8516 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8517 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8518 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8519 ALC888_ACER_ASPIRE_4930G),
8520 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8521 ALC888_ACER_ASPIRE_4930G),
8522 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8523 ALC888_ACER_ASPIRE_4930G),
8524 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8525 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8526 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8527 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8528 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8529 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8530 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8531 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8532 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8533 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8534 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8535 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8536 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8537 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8538 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8539 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8540 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8541 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8542 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8543 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8544 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8545 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8546 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8547 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8548 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8549 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8550 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8551 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8552 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8553 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8554 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8555 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8556 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8557 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8558 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8559 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8560 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8561 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8562 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8563 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8564 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8565 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8566 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8567 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8568 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8569 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8570 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8571 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8572 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
8573 ALC883_FUJITSU_PI2515),
8574 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8575 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8576 ALC888_FUJITSU_XA3530),
8577 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8578 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8579 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8580 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8581 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8582 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8583 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8584 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8585 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8586 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8587 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8588 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8589 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8590 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8594 static hda_nid_t alc1200_slave_dig_outs[] = {
8595 ALC883_DIGOUT_NID, 0,
8598 static struct alc_config_preset alc883_presets[] = {
8599 [ALC883_3ST_2ch_DIG] = {
8600 .mixers = { alc883_3ST_2ch_mixer },
8601 .init_verbs = { alc883_init_verbs },
8602 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8603 .dac_nids = alc883_dac_nids,
8604 .dig_out_nid = ALC883_DIGOUT_NID,
8605 .dig_in_nid = ALC883_DIGIN_NID,
8606 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8607 .channel_mode = alc883_3ST_2ch_modes,
8608 .input_mux = &alc883_capture_source,
8610 [ALC883_3ST_6ch_DIG] = {
8611 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8612 .init_verbs = { alc883_init_verbs },
8613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8614 .dac_nids = alc883_dac_nids,
8615 .dig_out_nid = ALC883_DIGOUT_NID,
8616 .dig_in_nid = ALC883_DIGIN_NID,
8617 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8618 .channel_mode = alc883_3ST_6ch_modes,
8620 .input_mux = &alc883_capture_source,
8622 [ALC883_3ST_6ch] = {
8623 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8624 .init_verbs = { alc883_init_verbs },
8625 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8626 .dac_nids = alc883_dac_nids,
8627 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8628 .channel_mode = alc883_3ST_6ch_modes,
8630 .input_mux = &alc883_capture_source,
8632 [ALC883_3ST_6ch_INTEL] = {
8633 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8634 .init_verbs = { alc883_init_verbs },
8635 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8636 .dac_nids = alc883_dac_nids,
8637 .dig_out_nid = ALC883_DIGOUT_NID,
8638 .dig_in_nid = ALC883_DIGIN_NID,
8639 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8640 .channel_mode = alc883_3ST_6ch_intel_modes,
8642 .input_mux = &alc883_3stack_6ch_intel,
8644 [ALC883_6ST_DIG] = {
8645 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8646 .init_verbs = { alc883_init_verbs },
8647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8648 .dac_nids = alc883_dac_nids,
8649 .dig_out_nid = ALC883_DIGOUT_NID,
8650 .dig_in_nid = ALC883_DIGIN_NID,
8651 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8652 .channel_mode = alc883_sixstack_modes,
8653 .input_mux = &alc883_capture_source,
8655 [ALC883_TARGA_DIG] = {
8656 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8657 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8658 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8659 .dac_nids = alc883_dac_nids,
8660 .dig_out_nid = ALC883_DIGOUT_NID,
8661 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8662 .channel_mode = alc883_3ST_6ch_modes,
8664 .input_mux = &alc883_capture_source,
8665 .unsol_event = alc883_tagra_unsol_event,
8666 .init_hook = alc883_tagra_automute,
8668 [ALC883_TARGA_2ch_DIG] = {
8669 .mixers = { alc883_tagra_2ch_mixer},
8670 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8671 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8672 .dac_nids = alc883_dac_nids,
8673 .adc_nids = alc883_adc_nids_alt,
8674 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8675 .dig_out_nid = ALC883_DIGOUT_NID,
8676 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8677 .channel_mode = alc883_3ST_2ch_modes,
8678 .input_mux = &alc883_capture_source,
8679 .unsol_event = alc883_tagra_unsol_event,
8680 .init_hook = alc883_tagra_automute,
8683 .mixers = { alc883_base_mixer },
8684 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8685 * and the headphone jack. Turn this on and rely on the
8686 * standard mute methods whenever the user wants to turn
8687 * these outputs off.
8689 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8690 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8691 .dac_nids = alc883_dac_nids,
8692 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8693 .channel_mode = alc883_3ST_2ch_modes,
8694 .input_mux = &alc883_capture_source,
8696 [ALC883_ACER_ASPIRE] = {
8697 .mixers = { alc883_acer_aspire_mixer },
8698 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8699 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8700 .dac_nids = alc883_dac_nids,
8701 .dig_out_nid = ALC883_DIGOUT_NID,
8702 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8703 .channel_mode = alc883_3ST_2ch_modes,
8704 .input_mux = &alc883_capture_source,
8705 .unsol_event = alc883_acer_aspire_unsol_event,
8706 .init_hook = alc883_acer_aspire_automute,
8708 [ALC888_ACER_ASPIRE_4930G] = {
8709 .mixers = { alc888_base_mixer,
8710 alc883_chmode_mixer },
8711 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8712 alc888_acer_aspire_4930g_verbs },
8713 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8714 .dac_nids = alc883_dac_nids,
8715 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8716 .adc_nids = alc883_adc_nids_rev,
8717 .capsrc_nids = alc883_capsrc_nids_rev,
8718 .dig_out_nid = ALC883_DIGOUT_NID,
8719 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8720 .channel_mode = alc883_3ST_6ch_modes,
8723 ARRAY_SIZE(alc888_2_capture_sources),
8724 .input_mux = alc888_2_capture_sources,
8725 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8726 .init_hook = alc888_acer_aspire_4930g_automute,
8729 .mixers = { alc883_fivestack_mixer,
8730 alc883_chmode_mixer },
8731 .init_verbs = { alc883_init_verbs,
8732 alc883_medion_eapd_verbs },
8733 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8734 .dac_nids = alc883_dac_nids,
8735 .adc_nids = alc883_adc_nids_alt,
8736 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8737 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8738 .channel_mode = alc883_sixstack_modes,
8739 .input_mux = &alc883_capture_source,
8741 [ALC883_MEDION_MD2] = {
8742 .mixers = { alc883_medion_md2_mixer},
8743 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8744 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8745 .dac_nids = alc883_dac_nids,
8746 .dig_out_nid = ALC883_DIGOUT_NID,
8747 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8748 .channel_mode = alc883_3ST_2ch_modes,
8749 .input_mux = &alc883_capture_source,
8750 .unsol_event = alc883_medion_md2_unsol_event,
8751 .init_hook = alc883_medion_md2_automute,
8753 [ALC883_LAPTOP_EAPD] = {
8754 .mixers = { alc883_base_mixer },
8755 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8756 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8757 .dac_nids = alc883_dac_nids,
8758 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8759 .channel_mode = alc883_3ST_2ch_modes,
8760 .input_mux = &alc883_capture_source,
8762 [ALC883_CLEVO_M720] = {
8763 .mixers = { alc883_clevo_m720_mixer },
8764 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8765 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8766 .dac_nids = alc883_dac_nids,
8767 .dig_out_nid = ALC883_DIGOUT_NID,
8768 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8769 .channel_mode = alc883_3ST_2ch_modes,
8770 .input_mux = &alc883_capture_source,
8771 .unsol_event = alc883_clevo_m720_unsol_event,
8772 .init_hook = alc883_clevo_m720_automute,
8774 [ALC883_LENOVO_101E_2ch] = {
8775 .mixers = { alc883_lenovo_101e_2ch_mixer},
8776 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8777 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8778 .dac_nids = alc883_dac_nids,
8779 .adc_nids = alc883_adc_nids_alt,
8780 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8781 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8782 .channel_mode = alc883_3ST_2ch_modes,
8783 .input_mux = &alc883_lenovo_101e_capture_source,
8784 .unsol_event = alc883_lenovo_101e_unsol_event,
8785 .init_hook = alc883_lenovo_101e_all_automute,
8787 [ALC883_LENOVO_NB0763] = {
8788 .mixers = { alc883_lenovo_nb0763_mixer },
8789 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8790 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8791 .dac_nids = alc883_dac_nids,
8792 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8793 .channel_mode = alc883_3ST_2ch_modes,
8795 .input_mux = &alc883_lenovo_nb0763_capture_source,
8796 .unsol_event = alc883_medion_md2_unsol_event,
8797 .init_hook = alc883_medion_md2_automute,
8799 [ALC888_LENOVO_MS7195_DIG] = {
8800 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8801 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8802 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8803 .dac_nids = alc883_dac_nids,
8804 .dig_out_nid = ALC883_DIGOUT_NID,
8805 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8806 .channel_mode = alc883_3ST_6ch_modes,
8808 .input_mux = &alc883_capture_source,
8809 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8810 .init_hook = alc888_lenovo_ms7195_front_automute,
8812 [ALC883_HAIER_W66] = {
8813 .mixers = { alc883_tagra_2ch_mixer},
8814 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8815 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8816 .dac_nids = alc883_dac_nids,
8817 .dig_out_nid = ALC883_DIGOUT_NID,
8818 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8819 .channel_mode = alc883_3ST_2ch_modes,
8820 .input_mux = &alc883_capture_source,
8821 .unsol_event = alc883_haier_w66_unsol_event,
8822 .init_hook = alc883_haier_w66_automute,
8825 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8826 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8827 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8828 .dac_nids = alc883_dac_nids,
8829 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8830 .channel_mode = alc888_3st_hp_modes,
8832 .input_mux = &alc883_capture_source,
8834 [ALC888_6ST_DELL] = {
8835 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8836 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8837 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8838 .dac_nids = alc883_dac_nids,
8839 .dig_out_nid = ALC883_DIGOUT_NID,
8840 .dig_in_nid = ALC883_DIGIN_NID,
8841 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8842 .channel_mode = alc883_sixstack_modes,
8843 .input_mux = &alc883_capture_source,
8844 .unsol_event = alc888_6st_dell_unsol_event,
8845 .init_hook = alc888_6st_dell_front_automute,
8848 .mixers = { alc883_mitac_mixer },
8849 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8850 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8851 .dac_nids = alc883_dac_nids,
8852 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8853 .channel_mode = alc883_3ST_2ch_modes,
8854 .input_mux = &alc883_capture_source,
8855 .unsol_event = alc883_mitac_unsol_event,
8856 .init_hook = alc883_mitac_automute,
8858 [ALC883_FUJITSU_PI2515] = {
8859 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8860 .init_verbs = { alc883_init_verbs,
8861 alc883_2ch_fujitsu_pi2515_verbs},
8862 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8863 .dac_nids = alc883_dac_nids,
8864 .dig_out_nid = ALC883_DIGOUT_NID,
8865 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8866 .channel_mode = alc883_3ST_2ch_modes,
8867 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8868 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8869 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8871 [ALC888_FUJITSU_XA3530] = {
8872 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8873 .init_verbs = { alc883_init_verbs,
8874 alc888_fujitsu_xa3530_verbs },
8875 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8876 .dac_nids = alc883_dac_nids,
8877 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8878 .adc_nids = alc883_adc_nids_rev,
8879 .capsrc_nids = alc883_capsrc_nids_rev,
8880 .dig_out_nid = ALC883_DIGOUT_NID,
8881 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8882 .channel_mode = alc888_4ST_8ch_intel_modes,
8884 ARRAY_SIZE(alc888_2_capture_sources),
8885 .input_mux = alc888_2_capture_sources,
8886 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8887 .init_hook = alc888_fujitsu_xa3530_automute,
8889 [ALC888_LENOVO_SKY] = {
8890 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8891 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8892 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8893 .dac_nids = alc883_dac_nids,
8894 .dig_out_nid = ALC883_DIGOUT_NID,
8895 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8896 .channel_mode = alc883_sixstack_modes,
8898 .input_mux = &alc883_lenovo_sky_capture_source,
8899 .unsol_event = alc883_lenovo_sky_unsol_event,
8900 .init_hook = alc888_lenovo_sky_front_automute,
8902 [ALC888_ASUS_M90V] = {
8903 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8904 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8905 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8906 .dac_nids = alc883_dac_nids,
8907 .dig_out_nid = ALC883_DIGOUT_NID,
8908 .dig_in_nid = ALC883_DIGIN_NID,
8909 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8910 .channel_mode = alc883_3ST_6ch_modes,
8912 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8913 .unsol_event = alc883_mode2_unsol_event,
8914 .init_hook = alc883_mode2_inithook,
8916 [ALC888_ASUS_EEE1601] = {
8917 .mixers = { alc883_asus_eee1601_mixer },
8918 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8919 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8920 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8921 .dac_nids = alc883_dac_nids,
8922 .dig_out_nid = ALC883_DIGOUT_NID,
8923 .dig_in_nid = ALC883_DIGIN_NID,
8924 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8925 .channel_mode = alc883_3ST_2ch_modes,
8927 .input_mux = &alc883_asus_eee1601_capture_source,
8928 .unsol_event = alc883_eee1601_unsol_event,
8929 .init_hook = alc883_eee1601_inithook,
8931 [ALC1200_ASUS_P5Q] = {
8932 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8933 .init_verbs = { alc883_init_verbs },
8934 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8935 .dac_nids = alc883_dac_nids,
8936 .dig_out_nid = ALC1200_DIGOUT_NID,
8937 .dig_in_nid = ALC883_DIGIN_NID,
8938 .slave_dig_outs = alc1200_slave_dig_outs,
8939 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8940 .channel_mode = alc883_sixstack_modes,
8941 .input_mux = &alc883_capture_source,
8947 * BIOS auto configuration
8949 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8950 hda_nid_t nid, int pin_type,
8954 struct alc_spec *spec = codec->spec;
8957 alc_set_pin_output(codec, nid, pin_type);
8958 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8961 idx = spec->multiout.dac_nids[dac_idx] - 2;
8962 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8966 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8968 struct alc_spec *spec = codec->spec;
8971 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8972 for (i = 0; i <= HDA_SIDE; i++) {
8973 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8974 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8976 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8981 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8983 struct alc_spec *spec = codec->spec;
8986 pin = spec->autocfg.hp_pins[0];
8987 if (pin) /* connect to front */
8989 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8990 pin = spec->autocfg.speaker_pins[0];
8992 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8995 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8996 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8998 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9000 struct alc_spec *spec = codec->spec;
9003 for (i = 0; i < AUTO_PIN_LAST; i++) {
9004 hda_nid_t nid = spec->autocfg.input_pins[i];
9005 if (alc883_is_input_pin(nid)) {
9006 snd_hda_codec_write(codec, nid, 0,
9007 AC_VERB_SET_PIN_WIDGET_CONTROL,
9008 (i <= AUTO_PIN_FRONT_MIC ?
9009 PIN_VREF80 : PIN_IN));
9010 if (nid != ALC883_PIN_CD_NID)
9011 snd_hda_codec_write(codec, nid, 0,
9012 AC_VERB_SET_AMP_GAIN_MUTE,
9018 #define alc883_auto_init_input_src alc882_auto_init_input_src
9020 /* almost identical with ALC880 parser... */
9021 static int alc883_parse_auto_config(struct hda_codec *codec)
9023 struct alc_spec *spec = codec->spec;
9024 int err = alc880_parse_auto_config(codec);
9025 struct auto_pin_cfg *cfg = &spec->autocfg;
9031 return 0; /* no config found */
9033 err = alc_auto_add_mic_boost(codec);
9037 /* hack - override the init verbs */
9038 spec->init_verbs[0] = alc883_auto_init_verbs;
9040 /* setup input_mux for ALC889 */
9041 if (codec->vendor_id == 0x10ec0889) {
9042 /* digital-mic input pin is excluded in alc880_auto_create..()
9043 * because it's under 0x18
9045 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9046 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9047 struct hda_input_mux *imux = &spec->private_imux[0];
9048 for (i = 1; i < 3; i++)
9049 memcpy(&spec->private_imux[i],
9050 &spec->private_imux[0],
9051 sizeof(spec->private_imux[0]));
9052 imux->items[imux->num_items].label = "Int DMic";
9053 imux->items[imux->num_items].index = 0x0b;
9055 spec->num_mux_defs = 3;
9056 spec->input_mux = spec->private_imux;
9060 return 1; /* config found */
9063 /* additional initialization for auto-configuration model */
9064 static void alc883_auto_init(struct hda_codec *codec)
9066 struct alc_spec *spec = codec->spec;
9067 alc883_auto_init_multi_out(codec);
9068 alc883_auto_init_hp_out(codec);
9069 alc883_auto_init_analog_input(codec);
9070 alc883_auto_init_input_src(codec);
9071 if (spec->unsol_event)
9072 alc_inithook(codec);
9075 static int patch_alc883(struct hda_codec *codec)
9077 struct alc_spec *spec;
9078 int err, board_config;
9080 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9086 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9088 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9091 if (board_config < 0) {
9092 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9093 "trying auto-probe from BIOS...\n");
9094 board_config = ALC883_AUTO;
9097 if (board_config == ALC883_AUTO) {
9098 /* automatic parse from the BIOS config */
9099 err = alc883_parse_auto_config(codec);
9105 "hda_codec: Cannot set up configuration "
9106 "from BIOS. Using base mode...\n");
9107 board_config = ALC883_3ST_2ch_DIG;
9111 err = snd_hda_attach_beep_device(codec, 0x1);
9117 if (board_config != ALC883_AUTO)
9118 setup_preset(spec, &alc883_presets[board_config]);
9120 switch (codec->vendor_id) {
9122 if (codec->revision_id == 0x100101) {
9123 spec->stream_name_analog = "ALC1200 Analog";
9124 spec->stream_name_digital = "ALC1200 Digital";
9126 spec->stream_name_analog = "ALC888 Analog";
9127 spec->stream_name_digital = "ALC888 Digital";
9129 if (!spec->num_adc_nids) {
9130 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9131 spec->adc_nids = alc883_adc_nids;
9133 if (!spec->capsrc_nids)
9134 spec->capsrc_nids = alc883_capsrc_nids;
9135 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9138 spec->stream_name_analog = "ALC889 Analog";
9139 spec->stream_name_digital = "ALC889 Digital";
9140 if (!spec->num_adc_nids) {
9141 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9142 spec->adc_nids = alc889_adc_nids;
9144 if (!spec->capsrc_nids)
9145 spec->capsrc_nids = alc889_capsrc_nids;
9146 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9150 spec->stream_name_analog = "ALC883 Analog";
9151 spec->stream_name_digital = "ALC883 Digital";
9152 if (!spec->num_adc_nids) {
9153 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9154 spec->adc_nids = alc883_adc_nids;
9156 if (!spec->capsrc_nids)
9157 spec->capsrc_nids = alc883_capsrc_nids;
9158 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9162 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9163 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9164 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9166 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9167 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9169 if (!spec->cap_mixer)
9170 set_capture_mixer(spec);
9171 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9173 spec->vmaster_nid = 0x0c;
9175 codec->patch_ops = alc_patch_ops;
9176 if (board_config == ALC883_AUTO)
9177 spec->init_hook = alc883_auto_init;
9179 #ifdef CONFIG_SND_HDA_POWER_SAVE
9180 if (!spec->loopback.amplist)
9181 spec->loopback.amplist = alc883_loopbacks;
9183 codec->proc_widget_hook = print_realtek_coef;
9192 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9193 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9195 #define alc262_dac_nids alc260_dac_nids
9196 #define alc262_adc_nids alc882_adc_nids
9197 #define alc262_adc_nids_alt alc882_adc_nids_alt
9198 #define alc262_capsrc_nids alc882_capsrc_nids
9199 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9201 #define alc262_modes alc260_modes
9202 #define alc262_capture_source alc882_capture_source
9204 static hda_nid_t alc262_dmic_adc_nids[1] = {
9209 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9211 static struct snd_kcontrol_new alc262_base_mixer[] = {
9212 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9213 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9214 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9215 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9220 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9221 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9222 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9223 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9224 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9225 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9226 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9227 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9231 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9233 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9234 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9235 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9236 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9237 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9240 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9241 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9242 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9243 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9244 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9245 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9249 /* update HP, line and mono-out pins according to the master switch */
9250 static void alc262_hp_master_update(struct hda_codec *codec)
9252 struct alc_spec *spec = codec->spec;
9253 int val = spec->master_sw;
9256 snd_hda_codec_write_cache(codec, 0x1b, 0,
9257 AC_VERB_SET_PIN_WIDGET_CONTROL,
9259 snd_hda_codec_write_cache(codec, 0x15, 0,
9260 AC_VERB_SET_PIN_WIDGET_CONTROL,
9262 /* mono (speaker) depending on the HP jack sense */
9263 val = val && !spec->jack_present;
9264 snd_hda_codec_write_cache(codec, 0x16, 0,
9265 AC_VERB_SET_PIN_WIDGET_CONTROL,
9269 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9271 struct alc_spec *spec = codec->spec;
9272 unsigned int presence;
9273 presence = snd_hda_codec_read(codec, 0x1b, 0,
9274 AC_VERB_GET_PIN_SENSE, 0);
9275 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9276 alc262_hp_master_update(codec);
9279 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9281 if ((res >> 26) != ALC880_HP_EVENT)
9283 alc262_hp_bpc_automute(codec);
9286 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9288 struct alc_spec *spec = codec->spec;
9289 unsigned int presence;
9290 presence = snd_hda_codec_read(codec, 0x15, 0,
9291 AC_VERB_GET_PIN_SENSE, 0);
9292 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9293 alc262_hp_master_update(codec);
9296 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9299 if ((res >> 26) != ALC880_HP_EVENT)
9301 alc262_hp_wildwest_automute(codec);
9304 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9305 struct snd_ctl_elem_value *ucontrol)
9307 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9308 struct alc_spec *spec = codec->spec;
9309 *ucontrol->value.integer.value = spec->master_sw;
9313 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9314 struct snd_ctl_elem_value *ucontrol)
9316 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9317 struct alc_spec *spec = codec->spec;
9318 int val = !!*ucontrol->value.integer.value;
9320 if (val == spec->master_sw)
9322 spec->master_sw = val;
9323 alc262_hp_master_update(codec);
9327 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9329 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9330 .name = "Master Playback Switch",
9331 .info = snd_ctl_boolean_mono_info,
9332 .get = alc262_hp_master_sw_get,
9333 .put = alc262_hp_master_sw_put,
9335 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9336 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9338 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9340 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9344 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9345 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9346 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9347 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9348 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9349 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9350 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9351 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9352 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9353 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9357 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9359 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9360 .name = "Master Playback Switch",
9361 .info = snd_ctl_boolean_mono_info,
9362 .get = alc262_hp_master_sw_get,
9363 .put = alc262_hp_master_sw_put,
9365 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9366 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9367 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9368 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9369 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9371 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9373 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9374 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9375 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9376 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9377 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9378 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9379 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9383 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9384 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9385 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9386 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9390 /* mute/unmute internal speaker according to the hp jack and mute state */
9391 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9393 struct alc_spec *spec = codec->spec;
9395 if (force || !spec->sense_updated) {
9396 unsigned int present;
9397 present = snd_hda_codec_read(codec, 0x15, 0,
9398 AC_VERB_GET_PIN_SENSE, 0);
9399 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9400 spec->sense_updated = 1;
9402 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9403 spec->jack_present ? HDA_AMP_MUTE : 0);
9406 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9409 if ((res >> 26) != ALC880_HP_EVENT)
9411 alc262_hp_t5735_automute(codec, 1);
9414 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9416 alc262_hp_t5735_automute(codec, 1);
9419 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9420 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9421 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9422 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9426 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9430 static struct hda_verb alc262_hp_t5735_verbs[] = {
9431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9434 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9438 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9439 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9440 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9441 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9442 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9443 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9444 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9448 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9449 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9450 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9451 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9452 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9453 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9454 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9462 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9469 /* bind hp and internal speaker mute (with plug check) */
9470 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9471 struct snd_ctl_elem_value *ucontrol)
9473 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9474 long *valp = ucontrol->value.integer.value;
9477 /* change hp mute */
9478 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9480 valp[0] ? 0 : HDA_AMP_MUTE);
9481 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9483 valp[1] ? 0 : HDA_AMP_MUTE);
9485 /* change speaker according to HP jack state */
9486 struct alc_spec *spec = codec->spec;
9488 if (spec->jack_present)
9489 mute = HDA_AMP_MUTE;
9491 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9493 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9494 HDA_AMP_MUTE, mute);
9499 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9500 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9502 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9503 .name = "Master Playback Switch",
9504 .info = snd_hda_mixer_amp_switch_info,
9505 .get = snd_hda_mixer_amp_switch_get,
9506 .put = alc262_sony_master_sw_put,
9507 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9511 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9512 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9516 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9517 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9518 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9519 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9522 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9523 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9527 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9528 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9529 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9530 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9531 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9532 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9533 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9534 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9535 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9536 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9537 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9538 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9539 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9543 static struct hda_verb alc262_tyan_verbs[] = {
9544 /* Headphone automute */
9545 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9547 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9549 /* P11 AUX_IN, white 4-pin connector */
9550 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9551 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9552 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9553 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9558 /* unsolicited event for HP jack sensing */
9559 static void alc262_tyan_automute(struct hda_codec *codec)
9562 unsigned int present;
9564 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9565 present = snd_hda_codec_read(codec, 0x1b, 0,
9566 AC_VERB_GET_PIN_SENSE, 0);
9567 present = (present & 0x80000000) != 0;
9569 /* mute line output on ATX panel */
9570 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9571 HDA_AMP_MUTE, HDA_AMP_MUTE);
9573 /* unmute line output if necessary */
9574 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9575 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9576 HDA_AMP_MUTE, mute);
9580 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9583 if ((res >> 26) != ALC880_HP_EVENT)
9585 alc262_tyan_automute(codec);
9588 #define alc262_capture_mixer alc882_capture_mixer
9589 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9592 * generic initialization of ADC, input mixers and output mixers
9594 static struct hda_verb alc262_init_verbs[] = {
9596 * Unmute ADC0-2 and set the default input to mic-in
9598 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9600 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9602 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9603 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9605 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9607 * Note: PASD motherboards uses the Line In 2 as the input for
9608 * front panel mic (mic 2)
9610 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9618 * Set up output mixers (0x0c - 0x0e)
9620 /* set vol=0 to output mixers */
9621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9624 /* set up input amps for analog loopback */
9625 /* Amp Indices: DAC = 0, mixer = 1 */
9626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9635 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9636 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9637 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9638 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9640 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9642 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9644 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9646 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9647 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9649 /* FIXME: use matrix-type input source selection */
9650 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9651 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9652 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9653 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9658 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9659 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9663 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9670 static struct hda_verb alc262_eapd_verbs[] = {
9671 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9672 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9676 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9677 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9678 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9682 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9683 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9684 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9685 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9687 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9692 static struct hda_verb alc262_sony_unsol_verbs[] = {
9693 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9694 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9695 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9697 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9702 static struct hda_input_mux alc262_dmic_capture_source = {
9705 { "Int DMic", 0x9 },
9710 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9711 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9712 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9714 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9715 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9719 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9720 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9721 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9722 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9724 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9725 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9726 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9727 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9731 static void alc262_dmic_automute(struct hda_codec *codec)
9733 unsigned int present;
9735 present = snd_hda_codec_read(codec, 0x18, 0,
9736 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9737 snd_hda_codec_write(codec, 0x22, 0,
9738 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9741 /* toggle speaker-output according to the hp-jack state */
9742 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9744 unsigned int present;
9747 present = snd_hda_codec_read(codec, 0x15, 0,
9748 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9749 bits = present ? 0 : PIN_OUT;
9750 snd_hda_codec_write(codec, 0x14, 0,
9751 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9756 /* unsolicited event for HP jack sensing */
9757 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9760 if ((res >> 26) == ALC880_HP_EVENT)
9761 alc262_toshiba_s06_speaker_automute(codec);
9762 if ((res >> 26) == ALC880_MIC_EVENT)
9763 alc262_dmic_automute(codec);
9767 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9769 alc262_toshiba_s06_speaker_automute(codec);
9770 alc262_dmic_automute(codec);
9773 /* mute/unmute internal speaker according to the hp jack and mute state */
9774 static void alc262_hippo_automute(struct hda_codec *codec)
9776 struct alc_spec *spec = codec->spec;
9778 unsigned int present;
9780 /* need to execute and sync at first */
9781 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9782 present = snd_hda_codec_read(codec, 0x15, 0,
9783 AC_VERB_GET_PIN_SENSE, 0);
9784 spec->jack_present = (present & 0x80000000) != 0;
9785 if (spec->jack_present) {
9786 /* mute internal speaker */
9787 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9788 HDA_AMP_MUTE, HDA_AMP_MUTE);
9790 /* unmute internal speaker if necessary */
9791 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9792 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9793 HDA_AMP_MUTE, mute);
9797 /* unsolicited event for HP jack sensing */
9798 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9801 if ((res >> 26) != ALC880_HP_EVENT)
9803 alc262_hippo_automute(codec);
9806 static void alc262_hippo1_automute(struct hda_codec *codec)
9809 unsigned int present;
9811 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9812 present = snd_hda_codec_read(codec, 0x1b, 0,
9813 AC_VERB_GET_PIN_SENSE, 0);
9814 present = (present & 0x80000000) != 0;
9816 /* mute internal speaker */
9817 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9818 HDA_AMP_MUTE, HDA_AMP_MUTE);
9820 /* unmute internal speaker if necessary */
9821 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9822 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9823 HDA_AMP_MUTE, mute);
9827 /* unsolicited event for HP jack sensing */
9828 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9831 if ((res >> 26) != ALC880_HP_EVENT)
9833 alc262_hippo1_automute(codec);
9839 * 0x16 = internal speaker
9840 * 0x18 = external mic
9843 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9844 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9845 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9849 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9851 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9852 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9856 static struct hda_verb alc262_nec_verbs[] = {
9857 /* Unmute Speaker */
9858 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9861 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9864 /* External mic to headphone */
9865 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9866 /* External mic to speaker */
9867 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9873 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9874 * 0x1b = port replicator headphone out
9877 #define ALC_HP_EVENT 0x37
9879 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9880 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9882 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9883 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9887 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9888 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9889 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9893 static struct hda_input_mux alc262_fujitsu_capture_source = {
9902 static struct hda_input_mux alc262_HP_capture_source = {
9906 { "Front Mic", 0x1 },
9913 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9917 { "Front Mic", 0x2 },
9923 /* mute/unmute internal speaker according to the hp jacks and mute state */
9924 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9926 struct alc_spec *spec = codec->spec;
9929 if (force || !spec->sense_updated) {
9930 unsigned int present;
9931 /* need to execute and sync at first */
9932 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9933 /* check laptop HP jack */
9934 present = snd_hda_codec_read(codec, 0x14, 0,
9935 AC_VERB_GET_PIN_SENSE, 0);
9936 /* need to execute and sync at first */
9937 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9938 /* check docking HP jack */
9939 present |= snd_hda_codec_read(codec, 0x1b, 0,
9940 AC_VERB_GET_PIN_SENSE, 0);
9941 if (present & AC_PINSENSE_PRESENCE)
9942 spec->jack_present = 1;
9944 spec->jack_present = 0;
9945 spec->sense_updated = 1;
9947 /* unmute internal speaker only if both HPs are unplugged and
9948 * master switch is on
9950 if (spec->jack_present)
9951 mute = HDA_AMP_MUTE;
9953 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9954 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9955 HDA_AMP_MUTE, mute);
9958 /* unsolicited event for HP jack sensing */
9959 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9962 if ((res >> 26) != ALC_HP_EVENT)
9964 alc262_fujitsu_automute(codec, 1);
9967 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9969 alc262_fujitsu_automute(codec, 1);
9972 /* bind volumes of both NID 0x0c and 0x0d */
9973 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9974 .ops = &snd_hda_bind_vol,
9976 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9977 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9982 /* mute/unmute internal speaker according to the hp jack and mute state */
9983 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9985 struct alc_spec *spec = codec->spec;
9988 if (force || !spec->sense_updated) {
9989 unsigned int present_int_hp;
9990 /* need to execute and sync at first */
9991 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9992 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9993 AC_VERB_GET_PIN_SENSE, 0);
9994 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9995 spec->sense_updated = 1;
9997 if (spec->jack_present) {
9998 /* mute internal speaker */
9999 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10000 HDA_AMP_MUTE, HDA_AMP_MUTE);
10001 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10002 HDA_AMP_MUTE, HDA_AMP_MUTE);
10004 /* unmute internal speaker if necessary */
10005 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10006 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10007 HDA_AMP_MUTE, mute);
10008 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10009 HDA_AMP_MUTE, mute);
10013 /* unsolicited event for HP jack sensing */
10014 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10017 if ((res >> 26) != ALC_HP_EVENT)
10019 alc262_lenovo_3000_automute(codec, 1);
10022 /* bind hp and internal speaker mute (with plug check) */
10023 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10024 struct snd_ctl_elem_value *ucontrol)
10026 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10027 long *valp = ucontrol->value.integer.value;
10030 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10032 valp ? 0 : HDA_AMP_MUTE);
10033 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10035 valp ? 0 : HDA_AMP_MUTE);
10038 alc262_fujitsu_automute(codec, 0);
10042 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10043 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10045 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10046 .name = "Master Playback Switch",
10047 .info = snd_hda_mixer_amp_switch_info,
10048 .get = snd_hda_mixer_amp_switch_get,
10049 .put = alc262_fujitsu_master_sw_put,
10050 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10052 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10053 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10054 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10057 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10058 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10059 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10063 /* bind hp and internal speaker mute (with plug check) */
10064 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10065 struct snd_ctl_elem_value *ucontrol)
10067 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10068 long *valp = ucontrol->value.integer.value;
10071 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10073 valp ? 0 : HDA_AMP_MUTE);
10076 alc262_lenovo_3000_automute(codec, 0);
10080 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10081 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10083 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10084 .name = "Master Playback Switch",
10085 .info = snd_hda_mixer_amp_switch_info,
10086 .get = snd_hda_mixer_amp_switch_get,
10087 .put = alc262_lenovo_3000_master_sw_put,
10088 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10092 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10094 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10095 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10096 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10097 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10101 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10102 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10105 .name = "Master Playback Switch",
10106 .info = snd_hda_mixer_amp_switch_info,
10107 .get = snd_hda_mixer_amp_switch_get,
10108 .put = alc262_sony_master_sw_put,
10109 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10113 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10114 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10116 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10120 /* additional init verbs for Benq laptops */
10121 static struct hda_verb alc262_EAPD_verbs[] = {
10122 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10123 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10127 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10128 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10129 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10131 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10132 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10136 /* Samsung Q1 Ultra Vista model setup */
10137 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10138 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10139 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10142 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10143 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10147 static struct hda_verb alc262_ultra_verbs[] = {
10149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10154 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10156 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10158 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10159 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10162 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10164 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10166 /* ADC, choose mic */
10167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10168 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10169 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10171 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10172 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10173 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10174 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10175 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10176 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10180 /* mute/unmute internal speaker according to the hp jack and mute state */
10181 static void alc262_ultra_automute(struct hda_codec *codec)
10183 struct alc_spec *spec = codec->spec;
10187 /* auto-mute only when HP is used as HP */
10188 if (!spec->cur_mux[0]) {
10189 unsigned int present;
10190 /* need to execute and sync at first */
10191 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10192 present = snd_hda_codec_read(codec, 0x15, 0,
10193 AC_VERB_GET_PIN_SENSE, 0);
10194 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10195 if (spec->jack_present)
10196 mute = HDA_AMP_MUTE;
10198 /* mute/unmute internal speaker */
10199 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10200 HDA_AMP_MUTE, mute);
10201 /* mute/unmute HP */
10202 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10203 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10206 /* unsolicited event for HP jack sensing */
10207 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10210 if ((res >> 26) != ALC880_HP_EVENT)
10212 alc262_ultra_automute(codec);
10215 static struct hda_input_mux alc262_ultra_capture_source = {
10219 { "Headphone", 0x7 },
10223 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10224 struct snd_ctl_elem_value *ucontrol)
10226 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10227 struct alc_spec *spec = codec->spec;
10230 ret = alc_mux_enum_put(kcontrol, ucontrol);
10233 /* reprogram the HP pin as mic or HP according to the input source */
10234 snd_hda_codec_write_cache(codec, 0x15, 0,
10235 AC_VERB_SET_PIN_WIDGET_CONTROL,
10236 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10237 alc262_ultra_automute(codec); /* mute/unmute HP */
10241 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10242 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10243 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10245 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10246 .name = "Capture Source",
10247 .info = alc_mux_enum_info,
10248 .get = alc_mux_enum_get,
10249 .put = alc262_ultra_mux_enum_put,
10254 /* add playback controls from the parsed DAC table */
10255 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10256 const struct auto_pin_cfg *cfg)
10261 spec->multiout.num_dacs = 1; /* only use one dac */
10262 spec->multiout.dac_nids = spec->private_dac_nids;
10263 spec->multiout.dac_nids[0] = 2;
10265 nid = cfg->line_out_pins[0];
10267 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10268 "Front Playback Volume",
10269 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10272 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10273 "Front Playback Switch",
10274 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10279 nid = cfg->speaker_pins[0];
10282 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10283 "Speaker Playback Volume",
10284 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10288 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10289 "Speaker Playback Switch",
10290 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10295 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10296 "Speaker Playback Switch",
10297 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10303 nid = cfg->hp_pins[0];
10305 /* spec->multiout.hp_nid = 2; */
10307 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10308 "Headphone Playback Volume",
10309 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10313 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10314 "Headphone Playback Switch",
10315 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10320 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10321 "Headphone Playback Switch",
10322 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10331 /* identical with ALC880 */
10332 #define alc262_auto_create_analog_input_ctls \
10333 alc880_auto_create_analog_input_ctls
10336 * generic initialization of ADC, input mixers and output mixers
10338 static struct hda_verb alc262_volume_init_verbs[] = {
10340 * Unmute ADC0-2 and set the default input to mic-in
10342 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10343 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10344 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10345 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10346 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10347 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10349 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10351 * Note: PASD motherboards uses the Line In 2 as the input for
10352 * front panel mic (mic 2)
10354 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10358 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10359 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10362 * Set up output mixers (0x0c - 0x0f)
10364 /* set vol=0 to output mixers */
10365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10369 /* set up input amps for analog loopback */
10370 /* Amp Indices: DAC = 0, mixer = 1 */
10371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10378 /* FIXME: use matrix-type input source selection */
10379 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10380 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10381 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10382 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10386 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10387 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10388 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10391 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10392 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10399 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10401 * Unmute ADC0-2 and set the default input to mic-in
10403 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10405 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10406 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10407 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10408 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10410 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10412 * Note: PASD motherboards uses the Line In 2 as the input for
10413 * front panel mic (mic 2)
10415 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10421 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10422 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10425 * Set up output mixers (0x0c - 0x0e)
10427 /* set vol=0 to output mixers */
10428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10432 /* set up input amps for analog loopback */
10433 /* Amp Indices: DAC = 0, mixer = 1 */
10434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10437 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10439 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10441 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10443 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10445 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10448 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10449 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10451 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10452 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10453 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10454 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10455 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10457 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10458 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10459 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10460 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10461 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10462 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10465 /* FIXME: use matrix-type input source selection */
10466 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10467 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10483 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10488 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10490 * Unmute ADC0-2 and set the default input to mic-in
10492 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10494 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10495 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10496 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10497 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10499 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10501 * Note: PASD motherboards uses the Line In 2 as the input for front
10502 * panel mic (mic 2)
10504 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10511 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10512 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10514 * Set up output mixers (0x0c - 0x0e)
10516 /* set vol=0 to output mixers */
10517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10518 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10519 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10521 /* set up input amps for analog loopback */
10522 /* Amp Indices: DAC = 0, mixer = 1 */
10523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10526 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10528 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10531 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10532 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10533 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10534 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10535 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10536 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10537 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10539 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10542 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10543 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10545 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10546 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10547 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10548 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10549 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10550 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10552 /* FIXME: use matrix-type input source selection */
10553 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10554 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10558 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10560 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10568 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10569 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10574 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10575 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10576 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10579 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10584 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10586 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10587 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10588 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10590 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10591 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10592 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10593 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10595 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10596 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10597 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10602 #ifdef CONFIG_SND_HDA_POWER_SAVE
10603 #define alc262_loopbacks alc880_loopbacks
10606 /* pcm configuration: identiacal with ALC880 */
10607 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10608 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10609 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10610 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10613 * BIOS auto configuration
10615 static int alc262_parse_auto_config(struct hda_codec *codec)
10617 struct alc_spec *spec = codec->spec;
10619 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10621 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10625 if (!spec->autocfg.line_outs) {
10626 if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) {
10627 spec->multiout.max_channels = 2;
10628 spec->no_analog = 1;
10631 return 0; /* can't find valid BIOS pin config */
10633 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10636 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10640 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10643 if (spec->autocfg.dig_out_pin) {
10644 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10645 spec->dig_out_type = spec->autocfg.dig_out_type;
10647 if (spec->autocfg.dig_in_pin)
10648 spec->dig_in_nid = ALC262_DIGIN_NID;
10650 if (spec->kctls.list)
10651 add_mixer(spec, spec->kctls.list);
10653 add_verb(spec, alc262_volume_init_verbs);
10654 spec->num_mux_defs = 1;
10655 spec->input_mux = &spec->private_imux[0];
10657 err = alc_auto_add_mic_boost(codec);
10661 store_pin_configs(codec);
10665 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10666 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10667 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10668 #define alc262_auto_init_input_src alc882_auto_init_input_src
10671 /* init callback for auto-configuration model -- overriding the default init */
10672 static void alc262_auto_init(struct hda_codec *codec)
10674 struct alc_spec *spec = codec->spec;
10675 alc262_auto_init_multi_out(codec);
10676 alc262_auto_init_hp_out(codec);
10677 alc262_auto_init_analog_input(codec);
10678 alc262_auto_init_input_src(codec);
10679 if (spec->unsol_event)
10680 alc_inithook(codec);
10684 * configuration and preset
10686 static const char *alc262_models[ALC262_MODEL_LAST] = {
10687 [ALC262_BASIC] = "basic",
10688 [ALC262_HIPPO] = "hippo",
10689 [ALC262_HIPPO_1] = "hippo_1",
10690 [ALC262_FUJITSU] = "fujitsu",
10691 [ALC262_HP_BPC] = "hp-bpc",
10692 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10693 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10694 [ALC262_HP_RP5700] = "hp-rp5700",
10695 [ALC262_BENQ_ED8] = "benq",
10696 [ALC262_BENQ_T31] = "benq-t31",
10697 [ALC262_SONY_ASSAMD] = "sony-assamd",
10698 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10699 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10700 [ALC262_ULTRA] = "ultra",
10701 [ALC262_LENOVO_3000] = "lenovo-3000",
10702 [ALC262_NEC] = "nec",
10703 [ALC262_TYAN] = "tyan",
10704 [ALC262_AUTO] = "auto",
10707 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10708 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10709 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10710 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10711 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10712 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10713 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10714 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10715 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10716 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10717 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10718 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10719 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10720 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10721 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10722 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10723 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10724 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10725 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10726 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10727 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10728 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10729 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10730 ALC262_HP_TC_T5735),
10731 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10732 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10733 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10734 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10735 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10736 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10737 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10738 ALC262_SONY_ASSAMD),
10739 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10740 ALC262_TOSHIBA_RX1),
10741 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10742 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10743 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10744 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10745 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10746 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10747 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10748 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10749 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10750 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10751 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10755 static struct alc_config_preset alc262_presets[] = {
10757 .mixers = { alc262_base_mixer },
10758 .init_verbs = { alc262_init_verbs },
10759 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10760 .dac_nids = alc262_dac_nids,
10762 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10763 .channel_mode = alc262_modes,
10764 .input_mux = &alc262_capture_source,
10767 .mixers = { alc262_base_mixer },
10768 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10769 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10770 .dac_nids = alc262_dac_nids,
10772 .dig_out_nid = ALC262_DIGOUT_NID,
10773 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10774 .channel_mode = alc262_modes,
10775 .input_mux = &alc262_capture_source,
10776 .unsol_event = alc262_hippo_unsol_event,
10777 .init_hook = alc262_hippo_automute,
10779 [ALC262_HIPPO_1] = {
10780 .mixers = { alc262_hippo1_mixer },
10781 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10782 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10783 .dac_nids = alc262_dac_nids,
10785 .dig_out_nid = ALC262_DIGOUT_NID,
10786 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10787 .channel_mode = alc262_modes,
10788 .input_mux = &alc262_capture_source,
10789 .unsol_event = alc262_hippo1_unsol_event,
10790 .init_hook = alc262_hippo1_automute,
10792 [ALC262_FUJITSU] = {
10793 .mixers = { alc262_fujitsu_mixer },
10794 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10795 alc262_fujitsu_unsol_verbs },
10796 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10797 .dac_nids = alc262_dac_nids,
10799 .dig_out_nid = ALC262_DIGOUT_NID,
10800 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10801 .channel_mode = alc262_modes,
10802 .input_mux = &alc262_fujitsu_capture_source,
10803 .unsol_event = alc262_fujitsu_unsol_event,
10804 .init_hook = alc262_fujitsu_init_hook,
10806 [ALC262_HP_BPC] = {
10807 .mixers = { alc262_HP_BPC_mixer },
10808 .init_verbs = { alc262_HP_BPC_init_verbs },
10809 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10810 .dac_nids = alc262_dac_nids,
10812 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10813 .channel_mode = alc262_modes,
10814 .input_mux = &alc262_HP_capture_source,
10815 .unsol_event = alc262_hp_bpc_unsol_event,
10816 .init_hook = alc262_hp_bpc_automute,
10818 [ALC262_HP_BPC_D7000_WF] = {
10819 .mixers = { alc262_HP_BPC_WildWest_mixer },
10820 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10821 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10822 .dac_nids = alc262_dac_nids,
10824 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10825 .channel_mode = alc262_modes,
10826 .input_mux = &alc262_HP_D7000_capture_source,
10827 .unsol_event = alc262_hp_wildwest_unsol_event,
10828 .init_hook = alc262_hp_wildwest_automute,
10830 [ALC262_HP_BPC_D7000_WL] = {
10831 .mixers = { alc262_HP_BPC_WildWest_mixer,
10832 alc262_HP_BPC_WildWest_option_mixer },
10833 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10834 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10835 .dac_nids = alc262_dac_nids,
10837 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10838 .channel_mode = alc262_modes,
10839 .input_mux = &alc262_HP_D7000_capture_source,
10840 .unsol_event = alc262_hp_wildwest_unsol_event,
10841 .init_hook = alc262_hp_wildwest_automute,
10843 [ALC262_HP_TC_T5735] = {
10844 .mixers = { alc262_hp_t5735_mixer },
10845 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10846 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10847 .dac_nids = alc262_dac_nids,
10849 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10850 .channel_mode = alc262_modes,
10851 .input_mux = &alc262_capture_source,
10852 .unsol_event = alc262_hp_t5735_unsol_event,
10853 .init_hook = alc262_hp_t5735_init_hook,
10855 [ALC262_HP_RP5700] = {
10856 .mixers = { alc262_hp_rp5700_mixer },
10857 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10858 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10859 .dac_nids = alc262_dac_nids,
10860 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10861 .channel_mode = alc262_modes,
10862 .input_mux = &alc262_hp_rp5700_capture_source,
10864 [ALC262_BENQ_ED8] = {
10865 .mixers = { alc262_base_mixer },
10866 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10867 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10868 .dac_nids = alc262_dac_nids,
10870 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10871 .channel_mode = alc262_modes,
10872 .input_mux = &alc262_capture_source,
10874 [ALC262_SONY_ASSAMD] = {
10875 .mixers = { alc262_sony_mixer },
10876 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10877 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10878 .dac_nids = alc262_dac_nids,
10880 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10881 .channel_mode = alc262_modes,
10882 .input_mux = &alc262_capture_source,
10883 .unsol_event = alc262_hippo_unsol_event,
10884 .init_hook = alc262_hippo_automute,
10886 [ALC262_BENQ_T31] = {
10887 .mixers = { alc262_benq_t31_mixer },
10888 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10889 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10890 .dac_nids = alc262_dac_nids,
10892 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10893 .channel_mode = alc262_modes,
10894 .input_mux = &alc262_capture_source,
10895 .unsol_event = alc262_hippo_unsol_event,
10896 .init_hook = alc262_hippo_automute,
10899 .mixers = { alc262_ultra_mixer },
10900 .cap_mixer = alc262_ultra_capture_mixer,
10901 .init_verbs = { alc262_ultra_verbs },
10902 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10903 .dac_nids = alc262_dac_nids,
10904 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10905 .channel_mode = alc262_modes,
10906 .input_mux = &alc262_ultra_capture_source,
10907 .adc_nids = alc262_adc_nids, /* ADC0 */
10908 .capsrc_nids = alc262_capsrc_nids,
10909 .num_adc_nids = 1, /* single ADC */
10910 .unsol_event = alc262_ultra_unsol_event,
10911 .init_hook = alc262_ultra_automute,
10913 [ALC262_LENOVO_3000] = {
10914 .mixers = { alc262_lenovo_3000_mixer },
10915 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10916 alc262_lenovo_3000_unsol_verbs },
10917 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10918 .dac_nids = alc262_dac_nids,
10920 .dig_out_nid = ALC262_DIGOUT_NID,
10921 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10922 .channel_mode = alc262_modes,
10923 .input_mux = &alc262_fujitsu_capture_source,
10924 .unsol_event = alc262_lenovo_3000_unsol_event,
10927 .mixers = { alc262_nec_mixer },
10928 .init_verbs = { alc262_nec_verbs },
10929 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10930 .dac_nids = alc262_dac_nids,
10932 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10933 .channel_mode = alc262_modes,
10934 .input_mux = &alc262_capture_source,
10936 [ALC262_TOSHIBA_S06] = {
10937 .mixers = { alc262_toshiba_s06_mixer },
10938 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10939 alc262_eapd_verbs },
10940 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10941 .capsrc_nids = alc262_dmic_capsrc_nids,
10942 .dac_nids = alc262_dac_nids,
10943 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10944 .dig_out_nid = ALC262_DIGOUT_NID,
10945 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10946 .channel_mode = alc262_modes,
10947 .input_mux = &alc262_dmic_capture_source,
10948 .unsol_event = alc262_toshiba_s06_unsol_event,
10949 .init_hook = alc262_toshiba_s06_init_hook,
10951 [ALC262_TOSHIBA_RX1] = {
10952 .mixers = { alc262_toshiba_rx1_mixer },
10953 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10954 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10955 .dac_nids = alc262_dac_nids,
10957 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10958 .channel_mode = alc262_modes,
10959 .input_mux = &alc262_capture_source,
10960 .unsol_event = alc262_hippo_unsol_event,
10961 .init_hook = alc262_hippo_automute,
10964 .mixers = { alc262_tyan_mixer },
10965 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
10966 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10967 .dac_nids = alc262_dac_nids,
10969 .dig_out_nid = ALC262_DIGOUT_NID,
10970 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10971 .channel_mode = alc262_modes,
10972 .input_mux = &alc262_capture_source,
10973 .unsol_event = alc262_tyan_unsol_event,
10974 .init_hook = alc262_tyan_automute,
10978 static int patch_alc262(struct hda_codec *codec)
10980 struct alc_spec *spec;
10984 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10988 codec->spec = spec;
10990 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10995 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10996 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10997 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10998 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11002 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11004 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11008 if (board_config < 0) {
11009 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11010 "trying auto-probe from BIOS...\n");
11011 board_config = ALC262_AUTO;
11014 if (board_config == ALC262_AUTO) {
11015 /* automatic parse from the BIOS config */
11016 err = alc262_parse_auto_config(codec);
11022 "hda_codec: Cannot set up configuration "
11023 "from BIOS. Using base mode...\n");
11024 board_config = ALC262_BASIC;
11028 err = snd_hda_attach_beep_device(codec, 0x1);
11034 if (board_config != ALC262_AUTO)
11035 setup_preset(spec, &alc262_presets[board_config]);
11037 spec->stream_name_analog = "ALC262 Analog";
11038 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11039 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11041 spec->stream_name_digital = "ALC262 Digital";
11042 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11043 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11045 spec->capture_style = CAPT_MIX;
11046 if (!spec->adc_nids && spec->input_mux) {
11047 /* check whether NID 0x07 is valid */
11048 unsigned int wcap = get_wcaps(codec, 0x07);
11051 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11052 if (wcap != AC_WID_AUD_IN) {
11053 spec->adc_nids = alc262_adc_nids_alt;
11054 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11055 spec->capsrc_nids = alc262_capsrc_nids_alt;
11057 spec->adc_nids = alc262_adc_nids;
11058 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11059 spec->capsrc_nids = alc262_capsrc_nids;
11062 if (!spec->cap_mixer && !spec->no_analog)
11063 set_capture_mixer(spec);
11064 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11066 spec->vmaster_nid = 0x0c;
11068 codec->patch_ops = alc_patch_ops;
11069 if (board_config == ALC262_AUTO)
11070 spec->init_hook = alc262_auto_init;
11071 #ifdef CONFIG_SND_HDA_POWER_SAVE
11072 if (!spec->loopback.amplist)
11073 spec->loopback.amplist = alc262_loopbacks;
11075 codec->proc_widget_hook = print_realtek_coef;
11081 * ALC268 channel source setting (2 channel)
11083 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11084 #define alc268_modes alc260_modes
11086 static hda_nid_t alc268_dac_nids[2] = {
11091 static hda_nid_t alc268_adc_nids[2] = {
11096 static hda_nid_t alc268_adc_nids_alt[1] = {
11101 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11103 static struct snd_kcontrol_new alc268_base_mixer[] = {
11104 /* output mixer control */
11105 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11106 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11107 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11108 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11109 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11110 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11111 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11115 /* bind Beep switches of both NID 0x0f and 0x10 */
11116 static struct hda_bind_ctls alc268_bind_beep_sw = {
11117 .ops = &snd_hda_bind_sw,
11119 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11120 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11125 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11126 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11127 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11131 static struct hda_verb alc268_eapd_verbs[] = {
11132 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11133 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11137 /* Toshiba specific */
11138 #define alc268_toshiba_automute alc262_hippo_automute
11140 static struct hda_verb alc268_toshiba_verbs[] = {
11141 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11145 static struct hda_input_mux alc268_acer_lc_capture_source = {
11153 /* Acer specific */
11154 /* bind volumes of both NID 0x02 and 0x03 */
11155 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11156 .ops = &snd_hda_bind_vol,
11158 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11159 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11164 /* mute/unmute internal speaker according to the hp jack and mute state */
11165 static void alc268_acer_automute(struct hda_codec *codec, int force)
11167 struct alc_spec *spec = codec->spec;
11170 if (force || !spec->sense_updated) {
11171 unsigned int present;
11172 present = snd_hda_codec_read(codec, 0x14, 0,
11173 AC_VERB_GET_PIN_SENSE, 0);
11174 spec->jack_present = (present & 0x80000000) != 0;
11175 spec->sense_updated = 1;
11177 if (spec->jack_present)
11178 mute = HDA_AMP_MUTE; /* mute internal speaker */
11179 else /* unmute internal speaker if necessary */
11180 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11181 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11182 HDA_AMP_MUTE, mute);
11186 /* bind hp and internal speaker mute (with plug check) */
11187 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11188 struct snd_ctl_elem_value *ucontrol)
11190 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11191 long *valp = ucontrol->value.integer.value;
11194 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11196 valp[0] ? 0 : HDA_AMP_MUTE);
11197 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11199 valp[1] ? 0 : HDA_AMP_MUTE);
11201 alc268_acer_automute(codec, 0);
11205 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11206 /* output mixer control */
11207 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11209 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11210 .name = "Master Playback Switch",
11211 .info = snd_hda_mixer_amp_switch_info,
11212 .get = snd_hda_mixer_amp_switch_get,
11213 .put = alc268_acer_master_sw_put,
11214 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11216 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11220 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11221 /* output mixer control */
11222 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11225 .name = "Master Playback Switch",
11226 .info = snd_hda_mixer_amp_switch_info,
11227 .get = snd_hda_mixer_amp_switch_get,
11228 .put = alc268_acer_master_sw_put,
11229 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11232 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11233 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11237 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11238 /* output mixer control */
11239 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11242 .name = "Master Playback Switch",
11243 .info = snd_hda_mixer_amp_switch_info,
11244 .get = snd_hda_mixer_amp_switch_get,
11245 .put = alc268_acer_master_sw_put,
11246 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11248 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11249 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11253 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11254 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11256 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11257 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11258 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11263 static struct hda_verb alc268_acer_verbs[] = {
11264 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11265 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11267 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11268 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11269 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11270 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11274 /* unsolicited event for HP jack sensing */
11275 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11278 if ((res >> 26) != ALC880_HP_EVENT)
11280 alc268_toshiba_automute(codec);
11283 static void alc268_acer_unsol_event(struct hda_codec *codec,
11286 if ((res >> 26) != ALC880_HP_EVENT)
11288 alc268_acer_automute(codec, 1);
11291 static void alc268_acer_init_hook(struct hda_codec *codec)
11293 alc268_acer_automute(codec, 1);
11296 /* toggle speaker-output according to the hp-jack state */
11297 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11299 unsigned int present;
11300 unsigned char bits;
11302 present = snd_hda_codec_read(codec, 0x15, 0,
11303 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11304 bits = present ? AMP_IN_MUTE(0) : 0;
11305 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11306 AMP_IN_MUTE(0), bits);
11307 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11308 AMP_IN_MUTE(0), bits);
11312 static void alc268_acer_mic_automute(struct hda_codec *codec)
11314 unsigned int present;
11316 present = snd_hda_codec_read(codec, 0x18, 0,
11317 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11318 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11319 present ? 0x0 : 0x6);
11322 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11325 if ((res >> 26) == ALC880_HP_EVENT)
11326 alc268_aspire_one_speaker_automute(codec);
11327 if ((res >> 26) == ALC880_MIC_EVENT)
11328 alc268_acer_mic_automute(codec);
11331 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11333 alc268_aspire_one_speaker_automute(codec);
11334 alc268_acer_mic_automute(codec);
11337 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11338 /* output mixer control */
11339 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11340 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11341 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11343 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11344 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11348 static struct hda_verb alc268_dell_verbs[] = {
11349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11351 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11355 /* mute/unmute internal speaker according to the hp jack and mute state */
11356 static void alc268_dell_automute(struct hda_codec *codec)
11358 unsigned int present;
11361 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11362 if (present & 0x80000000)
11363 mute = HDA_AMP_MUTE;
11365 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11366 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11367 HDA_AMP_MUTE, mute);
11370 static void alc268_dell_unsol_event(struct hda_codec *codec,
11373 if ((res >> 26) != ALC880_HP_EVENT)
11375 alc268_dell_automute(codec);
11378 #define alc268_dell_init_hook alc268_dell_automute
11380 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11381 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11382 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11385 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11386 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11387 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11388 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11392 static struct hda_verb alc267_quanta_il1_verbs[] = {
11393 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11394 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11398 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11400 unsigned int present;
11402 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11403 & AC_PINSENSE_PRESENCE;
11404 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11405 present ? 0 : PIN_OUT);
11408 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11410 unsigned int present;
11412 present = snd_hda_codec_read(codec, 0x18, 0,
11413 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11414 snd_hda_codec_write(codec, 0x23, 0,
11415 AC_VERB_SET_CONNECT_SEL,
11416 present ? 0x00 : 0x01);
11419 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11421 alc267_quanta_il1_hp_automute(codec);
11422 alc267_quanta_il1_mic_automute(codec);
11425 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11428 switch (res >> 26) {
11429 case ALC880_HP_EVENT:
11430 alc267_quanta_il1_hp_automute(codec);
11432 case ALC880_MIC_EVENT:
11433 alc267_quanta_il1_mic_automute(codec);
11439 * generic initialization of ADC, input mixers and output mixers
11441 static struct hda_verb alc268_base_init_verbs[] = {
11442 /* Unmute DAC0-1 and set vol = 0 */
11443 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11444 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11447 * Set up output mixers (0x0c - 0x0e)
11449 /* set vol=0 to output mixers */
11450 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11451 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11454 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11456 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11457 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11458 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11459 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11460 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11461 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11462 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11463 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11467 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11468 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11469 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11471 /* set PCBEEP vol = 0, mute connections */
11472 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11473 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11474 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11476 /* Unmute Selector 23h,24h and set the default input to mic-in */
11478 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11480 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11487 * generic initialization of ADC, input mixers and output mixers
11489 static struct hda_verb alc268_volume_init_verbs[] = {
11490 /* set output DAC */
11491 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11492 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11494 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11495 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11496 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11497 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11498 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11500 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11501 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11502 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11504 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11507 /* set PCBEEP vol = 0, mute connections */
11508 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11509 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11510 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11515 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11516 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11517 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11519 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11520 /* The multiple "Capture Source" controls confuse alsamixer
11521 * So call somewhat different..
11523 /* .name = "Capture Source", */
11524 .name = "Input Source",
11526 .info = alc_mux_enum_info,
11527 .get = alc_mux_enum_get,
11528 .put = alc_mux_enum_put,
11533 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11534 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11535 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11536 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11537 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11539 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11540 /* The multiple "Capture Source" controls confuse alsamixer
11541 * So call somewhat different..
11543 /* .name = "Capture Source", */
11544 .name = "Input Source",
11546 .info = alc_mux_enum_info,
11547 .get = alc_mux_enum_get,
11548 .put = alc_mux_enum_put,
11553 static struct hda_input_mux alc268_capture_source = {
11557 { "Front Mic", 0x1 },
11563 static struct hda_input_mux alc268_acer_capture_source = {
11567 { "Internal Mic", 0x1 },
11572 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11576 { "Internal Mic", 0x6 },
11581 #ifdef CONFIG_SND_DEBUG
11582 static struct snd_kcontrol_new alc268_test_mixer[] = {
11583 /* Volume widgets */
11584 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11585 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11586 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11587 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11588 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11589 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11590 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11591 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11592 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11593 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11594 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11595 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11596 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11597 /* The below appears problematic on some hardwares */
11598 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11599 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11600 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11601 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11602 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11604 /* Modes for retasking pin widgets */
11605 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11606 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11607 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11608 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11610 /* Controls for GPIO pins, assuming they are configured as outputs */
11611 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11612 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11613 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11614 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11616 /* Switches to allow the digital SPDIF output pin to be enabled.
11617 * The ALC268 does not have an SPDIF input.
11619 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11621 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11622 * this output to turn on an external amplifier.
11624 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11625 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11631 /* create input playback/capture controls for the given pin */
11632 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11633 const char *ctlname, int idx)
11638 sprintf(name, "%s Playback Volume", ctlname);
11640 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11641 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11645 } else if (nid == 0x15) {
11646 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11647 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11653 sprintf(name, "%s Playback Switch", ctlname);
11654 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11655 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11661 /* add playback controls from the parsed DAC table */
11662 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11663 const struct auto_pin_cfg *cfg)
11668 spec->multiout.num_dacs = 2; /* only use one dac */
11669 spec->multiout.dac_nids = spec->private_dac_nids;
11670 spec->multiout.dac_nids[0] = 2;
11671 spec->multiout.dac_nids[1] = 3;
11673 nid = cfg->line_out_pins[0];
11675 alc268_new_analog_output(spec, nid, "Front", 0);
11677 nid = cfg->speaker_pins[0];
11679 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11680 "Speaker Playback Volume",
11681 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11685 nid = cfg->hp_pins[0];
11687 alc268_new_analog_output(spec, nid, "Headphone", 0);
11689 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11691 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11692 "Mono Playback Switch",
11693 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11700 /* create playback/capture controls for input pins */
11701 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11702 const struct auto_pin_cfg *cfg)
11704 struct hda_input_mux *imux = &spec->private_imux[0];
11707 for (i = 0; i < AUTO_PIN_LAST; i++) {
11708 switch(cfg->input_pins[i]) {
11710 idx1 = 0; /* Mic 1 */
11713 idx1 = 1; /* Mic 2 */
11716 idx1 = 2; /* Line In */
11723 idx1 = 6; /* digital mics */
11728 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11729 imux->items[imux->num_items].index = idx1;
11735 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11737 struct alc_spec *spec = codec->spec;
11738 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11739 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11740 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11741 unsigned int dac_vol1, dac_vol2;
11744 snd_hda_codec_write(codec, speaker_nid, 0,
11745 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11746 snd_hda_codec_write(codec, 0x0f, 0,
11747 AC_VERB_SET_AMP_GAIN_MUTE,
11749 snd_hda_codec_write(codec, 0x10, 0,
11750 AC_VERB_SET_AMP_GAIN_MUTE,
11753 snd_hda_codec_write(codec, 0x0f, 0,
11754 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11755 snd_hda_codec_write(codec, 0x10, 0,
11756 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11759 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11760 if (line_nid == 0x14)
11761 dac_vol2 = AMP_OUT_ZERO;
11762 else if (line_nid == 0x15)
11763 dac_vol1 = AMP_OUT_ZERO;
11764 if (hp_nid == 0x14)
11765 dac_vol2 = AMP_OUT_ZERO;
11766 else if (hp_nid == 0x15)
11767 dac_vol1 = AMP_OUT_ZERO;
11768 if (line_nid != 0x16 || hp_nid != 0x16 ||
11769 spec->autocfg.line_out_pins[1] != 0x16 ||
11770 spec->autocfg.line_out_pins[2] != 0x16)
11771 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11773 snd_hda_codec_write(codec, 0x02, 0,
11774 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11775 snd_hda_codec_write(codec, 0x03, 0,
11776 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11779 /* pcm configuration: identiacal with ALC880 */
11780 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11781 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11782 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11783 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11786 * BIOS auto configuration
11788 static int alc268_parse_auto_config(struct hda_codec *codec)
11790 struct alc_spec *spec = codec->spec;
11792 static hda_nid_t alc268_ignore[] = { 0 };
11794 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11798 if (!spec->autocfg.line_outs)
11799 return 0; /* can't find valid BIOS pin config */
11801 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11804 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11808 spec->multiout.max_channels = 2;
11810 /* digital only support output */
11811 if (spec->autocfg.dig_out_pin)
11812 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11814 if (spec->kctls.list)
11815 add_mixer(spec, spec->kctls.list);
11817 if (spec->autocfg.speaker_pins[0] != 0x1d)
11818 add_mixer(spec, alc268_beep_mixer);
11820 add_verb(spec, alc268_volume_init_verbs);
11821 spec->num_mux_defs = 1;
11822 spec->input_mux = &spec->private_imux[0];
11824 err = alc_auto_add_mic_boost(codec);
11828 store_pin_configs(codec);
11832 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11833 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11834 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11836 /* init callback for auto-configuration model -- overriding the default init */
11837 static void alc268_auto_init(struct hda_codec *codec)
11839 struct alc_spec *spec = codec->spec;
11840 alc268_auto_init_multi_out(codec);
11841 alc268_auto_init_hp_out(codec);
11842 alc268_auto_init_mono_speaker_out(codec);
11843 alc268_auto_init_analog_input(codec);
11844 if (spec->unsol_event)
11845 alc_inithook(codec);
11849 * configuration and preset
11851 static const char *alc268_models[ALC268_MODEL_LAST] = {
11852 [ALC267_QUANTA_IL1] = "quanta-il1",
11853 [ALC268_3ST] = "3stack",
11854 [ALC268_TOSHIBA] = "toshiba",
11855 [ALC268_ACER] = "acer",
11856 [ALC268_ACER_DMIC] = "acer-dmic",
11857 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11858 [ALC268_DELL] = "dell",
11859 [ALC268_ZEPTO] = "zepto",
11860 #ifdef CONFIG_SND_DEBUG
11861 [ALC268_TEST] = "test",
11863 [ALC268_AUTO] = "auto",
11866 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11867 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11868 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11869 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11870 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11871 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11872 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11873 ALC268_ACER_ASPIRE_ONE),
11874 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11875 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11876 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11877 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11878 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11879 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11880 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11881 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11882 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11883 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11884 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11888 static struct alc_config_preset alc268_presets[] = {
11889 [ALC267_QUANTA_IL1] = {
11890 .mixers = { alc267_quanta_il1_mixer },
11891 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11892 alc267_quanta_il1_verbs },
11893 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11894 .dac_nids = alc268_dac_nids,
11895 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11896 .adc_nids = alc268_adc_nids_alt,
11898 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11899 .channel_mode = alc268_modes,
11900 .input_mux = &alc268_capture_source,
11901 .unsol_event = alc267_quanta_il1_unsol_event,
11902 .init_hook = alc267_quanta_il1_automute,
11905 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11906 alc268_beep_mixer },
11907 .init_verbs = { alc268_base_init_verbs },
11908 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11909 .dac_nids = alc268_dac_nids,
11910 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11911 .adc_nids = alc268_adc_nids_alt,
11912 .capsrc_nids = alc268_capsrc_nids,
11914 .dig_out_nid = ALC268_DIGOUT_NID,
11915 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11916 .channel_mode = alc268_modes,
11917 .input_mux = &alc268_capture_source,
11919 [ALC268_TOSHIBA] = {
11920 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11921 alc268_beep_mixer },
11922 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11923 alc268_toshiba_verbs },
11924 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11925 .dac_nids = alc268_dac_nids,
11926 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11927 .adc_nids = alc268_adc_nids_alt,
11928 .capsrc_nids = alc268_capsrc_nids,
11930 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11931 .channel_mode = alc268_modes,
11932 .input_mux = &alc268_capture_source,
11933 .unsol_event = alc268_toshiba_unsol_event,
11934 .init_hook = alc268_toshiba_automute,
11937 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11938 alc268_beep_mixer },
11939 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11940 alc268_acer_verbs },
11941 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11942 .dac_nids = alc268_dac_nids,
11943 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11944 .adc_nids = alc268_adc_nids_alt,
11945 .capsrc_nids = alc268_capsrc_nids,
11947 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11948 .channel_mode = alc268_modes,
11949 .input_mux = &alc268_acer_capture_source,
11950 .unsol_event = alc268_acer_unsol_event,
11951 .init_hook = alc268_acer_init_hook,
11953 [ALC268_ACER_DMIC] = {
11954 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11955 alc268_beep_mixer },
11956 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11957 alc268_acer_verbs },
11958 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11959 .dac_nids = alc268_dac_nids,
11960 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11961 .adc_nids = alc268_adc_nids_alt,
11962 .capsrc_nids = alc268_capsrc_nids,
11964 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11965 .channel_mode = alc268_modes,
11966 .input_mux = &alc268_acer_dmic_capture_source,
11967 .unsol_event = alc268_acer_unsol_event,
11968 .init_hook = alc268_acer_init_hook,
11970 [ALC268_ACER_ASPIRE_ONE] = {
11971 .mixers = { alc268_acer_aspire_one_mixer,
11972 alc268_capture_alt_mixer },
11973 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11974 alc268_acer_aspire_one_verbs },
11975 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11976 .dac_nids = alc268_dac_nids,
11977 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11978 .adc_nids = alc268_adc_nids_alt,
11979 .capsrc_nids = alc268_capsrc_nids,
11981 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11982 .channel_mode = alc268_modes,
11983 .input_mux = &alc268_acer_lc_capture_source,
11984 .unsol_event = alc268_acer_lc_unsol_event,
11985 .init_hook = alc268_acer_lc_init_hook,
11988 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11989 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11990 alc268_dell_verbs },
11991 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11992 .dac_nids = alc268_dac_nids,
11994 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11995 .channel_mode = alc268_modes,
11996 .unsol_event = alc268_dell_unsol_event,
11997 .init_hook = alc268_dell_init_hook,
11998 .input_mux = &alc268_capture_source,
12001 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12002 alc268_beep_mixer },
12003 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12004 alc268_toshiba_verbs },
12005 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12006 .dac_nids = alc268_dac_nids,
12007 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12008 .adc_nids = alc268_adc_nids_alt,
12009 .capsrc_nids = alc268_capsrc_nids,
12011 .dig_out_nid = ALC268_DIGOUT_NID,
12012 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12013 .channel_mode = alc268_modes,
12014 .input_mux = &alc268_capture_source,
12015 .unsol_event = alc268_toshiba_unsol_event,
12016 .init_hook = alc268_toshiba_automute
12018 #ifdef CONFIG_SND_DEBUG
12020 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12021 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12022 alc268_volume_init_verbs },
12023 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12024 .dac_nids = alc268_dac_nids,
12025 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12026 .adc_nids = alc268_adc_nids_alt,
12027 .capsrc_nids = alc268_capsrc_nids,
12029 .dig_out_nid = ALC268_DIGOUT_NID,
12030 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12031 .channel_mode = alc268_modes,
12032 .input_mux = &alc268_capture_source,
12037 static int patch_alc268(struct hda_codec *codec)
12039 struct alc_spec *spec;
12043 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12047 codec->spec = spec;
12049 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12053 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12054 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12055 "trying auto-probe from BIOS...\n");
12056 board_config = ALC268_AUTO;
12059 if (board_config == ALC268_AUTO) {
12060 /* automatic parse from the BIOS config */
12061 err = alc268_parse_auto_config(codec);
12067 "hda_codec: Cannot set up configuration "
12068 "from BIOS. Using base mode...\n");
12069 board_config = ALC268_3ST;
12073 err = snd_hda_attach_beep_device(codec, 0x1);
12079 if (board_config != ALC268_AUTO)
12080 setup_preset(spec, &alc268_presets[board_config]);
12082 if (codec->vendor_id == 0x10ec0267) {
12083 spec->stream_name_analog = "ALC267 Analog";
12084 spec->stream_name_digital = "ALC267 Digital";
12086 spec->stream_name_analog = "ALC268 Analog";
12087 spec->stream_name_digital = "ALC268 Digital";
12090 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12091 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12092 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12094 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12096 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12097 /* override the amp caps for beep generator */
12098 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12099 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12100 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12101 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12102 (0 << AC_AMPCAP_MUTE_SHIFT));
12104 if (!spec->adc_nids && spec->input_mux) {
12105 /* check whether NID 0x07 is valid */
12106 unsigned int wcap = get_wcaps(codec, 0x07);
12110 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12111 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12112 spec->adc_nids = alc268_adc_nids_alt;
12113 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12114 add_mixer(spec, alc268_capture_alt_mixer);
12116 spec->adc_nids = alc268_adc_nids;
12117 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12118 add_mixer(spec, alc268_capture_mixer);
12120 spec->capsrc_nids = alc268_capsrc_nids;
12121 /* set default input source */
12122 for (i = 0; i < spec->num_adc_nids; i++)
12123 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12124 0, AC_VERB_SET_CONNECT_SEL,
12125 spec->input_mux->items[0].index);
12128 spec->vmaster_nid = 0x02;
12130 codec->patch_ops = alc_patch_ops;
12131 if (board_config == ALC268_AUTO)
12132 spec->init_hook = alc268_auto_init;
12134 codec->proc_widget_hook = print_realtek_coef;
12140 * ALC269 channel source setting (2 channel)
12142 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12144 #define alc269_dac_nids alc260_dac_nids
12146 static hda_nid_t alc269_adc_nids[1] = {
12151 static hda_nid_t alc269_capsrc_nids[1] = {
12155 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12159 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12167 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12175 #define alc269_modes alc260_modes
12176 #define alc269_capture_source alc880_lg_lw_capture_source
12178 static struct snd_kcontrol_new alc269_base_mixer[] = {
12179 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12180 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12181 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12182 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12185 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12186 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12187 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12188 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12189 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12190 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12194 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12195 /* output mixer control */
12196 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12198 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12199 .name = "Master Playback Switch",
12200 .info = snd_hda_mixer_amp_switch_info,
12201 .get = snd_hda_mixer_amp_switch_get,
12202 .put = alc268_acer_master_sw_put,
12203 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12207 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12208 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12209 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12210 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12214 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12215 /* output mixer control */
12216 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12219 .name = "Master Playback Switch",
12220 .info = snd_hda_mixer_amp_switch_info,
12221 .get = snd_hda_mixer_amp_switch_get,
12222 .put = alc268_acer_master_sw_put,
12223 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12226 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12227 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12228 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12229 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12230 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12231 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12232 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12233 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12237 /* bind volumes of both NID 0x0c and 0x0d */
12238 static struct hda_bind_ctls alc269_epc_bind_vol = {
12239 .ops = &snd_hda_bind_vol,
12241 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12242 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12247 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12248 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12249 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12250 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12254 /* capture mixer elements */
12255 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12256 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12257 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12258 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12263 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12264 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12265 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12266 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12270 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12271 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12272 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12273 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12274 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12275 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12276 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12280 static struct hda_verb alc269_lifebook_verbs[] = {
12281 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12282 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12283 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12284 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12285 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12286 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12287 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12288 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12289 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12290 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12294 /* toggle speaker-output according to the hp-jack state */
12295 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12297 unsigned int present;
12298 unsigned char bits;
12300 present = snd_hda_codec_read(codec, 0x15, 0,
12301 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12302 bits = present ? AMP_IN_MUTE(0) : 0;
12303 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12304 AMP_IN_MUTE(0), bits);
12305 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12306 AMP_IN_MUTE(0), bits);
12308 snd_hda_codec_write(codec, 0x20, 0,
12309 AC_VERB_SET_COEF_INDEX, 0x0c);
12310 snd_hda_codec_write(codec, 0x20, 0,
12311 AC_VERB_SET_PROC_COEF, 0x680);
12313 snd_hda_codec_write(codec, 0x20, 0,
12314 AC_VERB_SET_COEF_INDEX, 0x0c);
12315 snd_hda_codec_write(codec, 0x20, 0,
12316 AC_VERB_SET_PROC_COEF, 0x480);
12319 /* toggle speaker-output according to the hp-jacks state */
12320 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12322 unsigned int present;
12323 unsigned char bits;
12325 /* Check laptop headphone socket */
12326 present = snd_hda_codec_read(codec, 0x15, 0,
12327 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12329 /* Check port replicator headphone socket */
12330 present |= snd_hda_codec_read(codec, 0x1a, 0,
12331 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12333 bits = present ? AMP_IN_MUTE(0) : 0;
12334 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12335 AMP_IN_MUTE(0), bits);
12336 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12337 AMP_IN_MUTE(0), bits);
12339 snd_hda_codec_write(codec, 0x20, 0,
12340 AC_VERB_SET_COEF_INDEX, 0x0c);
12341 snd_hda_codec_write(codec, 0x20, 0,
12342 AC_VERB_SET_PROC_COEF, 0x680);
12344 snd_hda_codec_write(codec, 0x20, 0,
12345 AC_VERB_SET_COEF_INDEX, 0x0c);
12346 snd_hda_codec_write(codec, 0x20, 0,
12347 AC_VERB_SET_PROC_COEF, 0x480);
12350 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12352 unsigned int present;
12354 present = snd_hda_codec_read(codec, 0x18, 0,
12355 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12356 snd_hda_codec_write(codec, 0x23, 0,
12357 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12360 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12362 unsigned int present_laptop;
12363 unsigned int present_dock;
12365 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12366 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12368 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12369 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12371 /* Laptop mic port overrides dock mic port, design decision */
12373 snd_hda_codec_write(codec, 0x23, 0,
12374 AC_VERB_SET_CONNECT_SEL, 0x3);
12375 if (present_laptop)
12376 snd_hda_codec_write(codec, 0x23, 0,
12377 AC_VERB_SET_CONNECT_SEL, 0x0);
12378 if (!present_dock && !present_laptop)
12379 snd_hda_codec_write(codec, 0x23, 0,
12380 AC_VERB_SET_CONNECT_SEL, 0x1);
12383 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12386 if ((res >> 26) == ALC880_HP_EVENT)
12387 alc269_quanta_fl1_speaker_automute(codec);
12388 if ((res >> 26) == ALC880_MIC_EVENT)
12389 alc269_quanta_fl1_mic_automute(codec);
12392 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12395 if ((res >> 26) == ALC880_HP_EVENT)
12396 alc269_lifebook_speaker_automute(codec);
12397 if ((res >> 26) == ALC880_MIC_EVENT)
12398 alc269_lifebook_mic_autoswitch(codec);
12401 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12403 alc269_quanta_fl1_speaker_automute(codec);
12404 alc269_quanta_fl1_mic_automute(codec);
12407 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12409 alc269_lifebook_speaker_automute(codec);
12410 alc269_lifebook_mic_autoswitch(codec);
12413 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12414 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12415 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12416 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12417 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12418 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12419 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12420 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12424 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12425 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12426 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12427 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12428 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12429 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12430 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12434 /* toggle speaker-output according to the hp-jack state */
12435 static void alc269_speaker_automute(struct hda_codec *codec)
12437 unsigned int present;
12438 unsigned char bits;
12440 present = snd_hda_codec_read(codec, 0x15, 0,
12441 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12442 bits = present ? AMP_IN_MUTE(0) : 0;
12443 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12444 AMP_IN_MUTE(0), bits);
12445 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12446 AMP_IN_MUTE(0), bits);
12449 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12451 unsigned int present;
12453 present = snd_hda_codec_read(codec, 0x18, 0,
12454 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12455 snd_hda_codec_write(codec, 0x23, 0,
12456 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12459 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12461 unsigned int present;
12463 present = snd_hda_codec_read(codec, 0x18, 0,
12464 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12465 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12466 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12467 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12468 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12471 /* unsolicited event for HP jack sensing */
12472 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12475 if ((res >> 26) == ALC880_HP_EVENT)
12476 alc269_speaker_automute(codec);
12478 if ((res >> 26) == ALC880_MIC_EVENT)
12479 alc269_eeepc_dmic_automute(codec);
12482 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12484 alc269_speaker_automute(codec);
12485 alc269_eeepc_dmic_automute(codec);
12488 /* unsolicited event for HP jack sensing */
12489 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12492 if ((res >> 26) == ALC880_HP_EVENT)
12493 alc269_speaker_automute(codec);
12495 if ((res >> 26) == ALC880_MIC_EVENT)
12496 alc269_eeepc_amic_automute(codec);
12499 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12501 alc269_speaker_automute(codec);
12502 alc269_eeepc_amic_automute(codec);
12506 * generic initialization of ADC, input mixers and output mixers
12508 static struct hda_verb alc269_init_verbs[] = {
12510 * Unmute ADC0 and set the default input to mic-in
12512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12514 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12515 * analog-loopback mixer widget
12516 * Note: PASD motherboards uses the Line In 2 as the input for
12517 * front panel mic (mic 2)
12519 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12527 * Set up output mixers (0x0c - 0x0e)
12529 /* set vol=0 to output mixers */
12530 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12531 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12533 /* set up input amps for analog loopback */
12534 /* Amp Indices: DAC = 0, mixer = 1 */
12535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12540 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12542 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12544 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12545 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12546 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12547 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12548 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12550 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12551 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12552 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12553 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12554 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12555 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12556 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12558 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12559 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12561 /* FIXME: use matrix-type input source selection */
12562 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12563 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12564 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12565 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12566 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12567 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12570 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12571 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12575 /* add playback controls from the parsed DAC table */
12576 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12577 const struct auto_pin_cfg *cfg)
12582 spec->multiout.num_dacs = 1; /* only use one dac */
12583 spec->multiout.dac_nids = spec->private_dac_nids;
12584 spec->multiout.dac_nids[0] = 2;
12586 nid = cfg->line_out_pins[0];
12588 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12589 "Front Playback Volume",
12590 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12593 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12594 "Front Playback Switch",
12595 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12600 nid = cfg->speaker_pins[0];
12602 if (!cfg->line_out_pins[0]) {
12603 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12604 "Speaker Playback Volume",
12605 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12611 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12612 "Speaker Playback Switch",
12613 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12618 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12619 "Speaker Playback Switch",
12620 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12626 nid = cfg->hp_pins[0];
12628 /* spec->multiout.hp_nid = 2; */
12629 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12630 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12631 "Headphone Playback Volume",
12632 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12638 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12639 "Headphone Playback Switch",
12640 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12645 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12646 "Headphone Playback Switch",
12647 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12656 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12657 const struct auto_pin_cfg *cfg)
12661 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12664 /* digital-mic input pin is excluded in alc880_auto_create..()
12665 * because it's under 0x18
12667 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12668 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12669 struct hda_input_mux *imux = &spec->private_imux[0];
12670 imux->items[imux->num_items].label = "Int Mic";
12671 imux->items[imux->num_items].index = 0x05;
12677 #ifdef CONFIG_SND_HDA_POWER_SAVE
12678 #define alc269_loopbacks alc880_loopbacks
12681 /* pcm configuration: identiacal with ALC880 */
12682 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12683 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12684 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12685 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12688 * BIOS auto configuration
12690 static int alc269_parse_auto_config(struct hda_codec *codec)
12692 struct alc_spec *spec = codec->spec;
12694 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12696 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12701 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12704 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12708 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12710 if (spec->autocfg.dig_out_pin)
12711 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12713 if (spec->kctls.list)
12714 add_mixer(spec, spec->kctls.list);
12716 add_verb(spec, alc269_init_verbs);
12717 spec->num_mux_defs = 1;
12718 spec->input_mux = &spec->private_imux[0];
12719 /* set default input source */
12720 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12721 0, AC_VERB_SET_CONNECT_SEL,
12722 spec->input_mux->items[0].index);
12724 err = alc_auto_add_mic_boost(codec);
12728 if (!spec->cap_mixer)
12729 set_capture_mixer(spec);
12731 store_pin_configs(codec);
12735 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12736 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12737 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12740 /* init callback for auto-configuration model -- overriding the default init */
12741 static void alc269_auto_init(struct hda_codec *codec)
12743 struct alc_spec *spec = codec->spec;
12744 alc269_auto_init_multi_out(codec);
12745 alc269_auto_init_hp_out(codec);
12746 alc269_auto_init_analog_input(codec);
12747 if (spec->unsol_event)
12748 alc_inithook(codec);
12752 * configuration and preset
12754 static const char *alc269_models[ALC269_MODEL_LAST] = {
12755 [ALC269_BASIC] = "basic",
12756 [ALC269_QUANTA_FL1] = "quanta",
12757 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12758 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12759 [ALC269_FUJITSU] = "fujitsu",
12760 [ALC269_LIFEBOOK] = "lifebook"
12763 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12764 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12765 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12766 ALC269_ASUS_EEEPC_P703),
12767 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12768 ALC269_ASUS_EEEPC_P901),
12769 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12770 ALC269_ASUS_EEEPC_P901),
12771 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12772 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12776 static struct alc_config_preset alc269_presets[] = {
12778 .mixers = { alc269_base_mixer },
12779 .init_verbs = { alc269_init_verbs },
12780 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12781 .dac_nids = alc269_dac_nids,
12783 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12784 .channel_mode = alc269_modes,
12785 .input_mux = &alc269_capture_source,
12787 [ALC269_QUANTA_FL1] = {
12788 .mixers = { alc269_quanta_fl1_mixer },
12789 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12790 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12791 .dac_nids = alc269_dac_nids,
12793 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12794 .channel_mode = alc269_modes,
12795 .input_mux = &alc269_capture_source,
12796 .unsol_event = alc269_quanta_fl1_unsol_event,
12797 .init_hook = alc269_quanta_fl1_init_hook,
12799 [ALC269_ASUS_EEEPC_P703] = {
12800 .mixers = { alc269_eeepc_mixer },
12801 .cap_mixer = alc269_epc_capture_mixer,
12802 .init_verbs = { alc269_init_verbs,
12803 alc269_eeepc_amic_init_verbs },
12804 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12805 .dac_nids = alc269_dac_nids,
12807 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12808 .channel_mode = alc269_modes,
12809 .input_mux = &alc269_eeepc_amic_capture_source,
12810 .unsol_event = alc269_eeepc_amic_unsol_event,
12811 .init_hook = alc269_eeepc_amic_inithook,
12813 [ALC269_ASUS_EEEPC_P901] = {
12814 .mixers = { alc269_eeepc_mixer },
12815 .cap_mixer = alc269_epc_capture_mixer,
12816 .init_verbs = { alc269_init_verbs,
12817 alc269_eeepc_dmic_init_verbs },
12818 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12819 .dac_nids = alc269_dac_nids,
12821 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12822 .channel_mode = alc269_modes,
12823 .input_mux = &alc269_eeepc_dmic_capture_source,
12824 .unsol_event = alc269_eeepc_dmic_unsol_event,
12825 .init_hook = alc269_eeepc_dmic_inithook,
12827 [ALC269_FUJITSU] = {
12828 .mixers = { alc269_fujitsu_mixer },
12829 .cap_mixer = alc269_epc_capture_mixer,
12830 .init_verbs = { alc269_init_verbs,
12831 alc269_eeepc_dmic_init_verbs },
12832 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12833 .dac_nids = alc269_dac_nids,
12835 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12836 .channel_mode = alc269_modes,
12837 .input_mux = &alc269_eeepc_dmic_capture_source,
12838 .unsol_event = alc269_eeepc_dmic_unsol_event,
12839 .init_hook = alc269_eeepc_dmic_inithook,
12841 [ALC269_LIFEBOOK] = {
12842 .mixers = { alc269_lifebook_mixer },
12843 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12844 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12845 .dac_nids = alc269_dac_nids,
12847 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12848 .channel_mode = alc269_modes,
12849 .input_mux = &alc269_capture_source,
12850 .unsol_event = alc269_lifebook_unsol_event,
12851 .init_hook = alc269_lifebook_init_hook,
12855 static int patch_alc269(struct hda_codec *codec)
12857 struct alc_spec *spec;
12861 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12865 codec->spec = spec;
12867 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12869 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12873 if (board_config < 0) {
12874 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12875 "trying auto-probe from BIOS...\n");
12876 board_config = ALC269_AUTO;
12879 if (board_config == ALC269_AUTO) {
12880 /* automatic parse from the BIOS config */
12881 err = alc269_parse_auto_config(codec);
12887 "hda_codec: Cannot set up configuration "
12888 "from BIOS. Using base mode...\n");
12889 board_config = ALC269_BASIC;
12893 err = snd_hda_attach_beep_device(codec, 0x1);
12899 if (board_config != ALC269_AUTO)
12900 setup_preset(spec, &alc269_presets[board_config]);
12902 spec->stream_name_analog = "ALC269 Analog";
12903 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12904 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12906 spec->stream_name_digital = "ALC269 Digital";
12907 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12908 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12910 spec->adc_nids = alc269_adc_nids;
12911 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12912 spec->capsrc_nids = alc269_capsrc_nids;
12913 if (!spec->cap_mixer)
12914 set_capture_mixer(spec);
12915 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12917 codec->patch_ops = alc_patch_ops;
12918 if (board_config == ALC269_AUTO)
12919 spec->init_hook = alc269_auto_init;
12920 #ifdef CONFIG_SND_HDA_POWER_SAVE
12921 if (!spec->loopback.amplist)
12922 spec->loopback.amplist = alc269_loopbacks;
12924 codec->proc_widget_hook = print_realtek_coef;
12930 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12934 * set the path ways for 2 channel output
12935 * need to set the codec line out and mic 1 pin widgets to inputs
12937 static struct hda_verb alc861_threestack_ch2_init[] = {
12938 /* set pin widget 1Ah (line in) for input */
12939 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12940 /* set pin widget 18h (mic1/2) for input, for mic also enable
12943 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12945 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12947 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12948 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12954 * need to set the codec line out and mic 1 pin widgets to outputs
12956 static struct hda_verb alc861_threestack_ch6_init[] = {
12957 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12958 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12959 /* set pin widget 18h (mic1) for output (CLFE)*/
12960 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12962 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12963 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12965 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12967 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12968 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12973 static struct hda_channel_mode alc861_threestack_modes[2] = {
12974 { 2, alc861_threestack_ch2_init },
12975 { 6, alc861_threestack_ch6_init },
12977 /* Set mic1 as input and unmute the mixer */
12978 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12979 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12980 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12983 /* Set mic1 as output and mute mixer */
12984 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12985 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12986 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12990 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12991 { 2, alc861_uniwill_m31_ch2_init },
12992 { 4, alc861_uniwill_m31_ch4_init },
12995 /* Set mic1 and line-in as input and unmute the mixer */
12996 static struct hda_verb alc861_asus_ch2_init[] = {
12997 /* set pin widget 1Ah (line in) for input */
12998 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12999 /* set pin widget 18h (mic1/2) for input, for mic also enable
13002 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13004 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13006 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13007 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13011 /* Set mic1 nad line-in as output and mute mixer */
13012 static struct hda_verb alc861_asus_ch6_init[] = {
13013 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13014 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13015 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13016 /* set pin widget 18h (mic1) for output (CLFE)*/
13017 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13018 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13019 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13020 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13022 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13024 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13025 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13030 static struct hda_channel_mode alc861_asus_modes[2] = {
13031 { 2, alc861_asus_ch2_init },
13032 { 6, alc861_asus_ch6_init },
13037 static struct snd_kcontrol_new alc861_base_mixer[] = {
13038 /* output mixer control */
13039 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13040 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13041 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13042 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13043 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13045 /*Input mixer control */
13046 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13047 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13048 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13049 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13050 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13051 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13053 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13054 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13060 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13061 /* output mixer control */
13062 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13063 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13064 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13065 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13066 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13068 /* Input mixer control */
13069 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13070 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13071 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13072 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13073 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13074 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13076 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13077 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13078 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13081 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13082 .name = "Channel Mode",
13083 .info = alc_ch_mode_info,
13084 .get = alc_ch_mode_get,
13085 .put = alc_ch_mode_put,
13086 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13091 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13092 /* output mixer control */
13093 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13095 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13100 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13101 /* output mixer control */
13102 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13103 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13104 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13105 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13106 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13108 /* Input mixer control */
13109 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13110 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13111 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13112 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13113 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13114 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13116 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13117 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13121 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13122 .name = "Channel Mode",
13123 .info = alc_ch_mode_info,
13124 .get = alc_ch_mode_get,
13125 .put = alc_ch_mode_put,
13126 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13131 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13132 /* output mixer control */
13133 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13134 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13135 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13136 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13137 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13139 /* Input mixer control */
13140 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13141 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13142 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13143 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13144 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13145 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13147 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13153 .name = "Channel Mode",
13154 .info = alc_ch_mode_info,
13155 .get = alc_ch_mode_get,
13156 .put = alc_ch_mode_put,
13157 .private_value = ARRAY_SIZE(alc861_asus_modes),
13162 /* additional mixer */
13163 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13164 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13165 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13170 * generic initialization of ADC, input mixers and output mixers
13172 static struct hda_verb alc861_base_init_verbs[] = {
13174 * Unmute ADC0 and set the default input to mic-in
13176 /* port-A for surround (rear panel) */
13177 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13178 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13179 /* port-B for mic-in (rear panel) with vref */
13180 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13181 /* port-C for line-in (rear panel) */
13182 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13183 /* port-D for Front */
13184 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13185 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13186 /* port-E for HP out (front panel) */
13187 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13188 /* route front PCM to HP */
13189 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13190 /* port-F for mic-in (front panel) with vref */
13191 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13192 /* port-G for CLFE (rear panel) */
13193 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13194 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13195 /* port-H for side (rear panel) */
13196 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13197 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13199 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13200 /* route front mic to ADC1*/
13201 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13202 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13204 /* Unmute DAC0~3 & spdif out*/
13205 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13206 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13207 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13208 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13211 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13212 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13213 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13214 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13215 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13217 /* Unmute Stereo Mixer 15 */
13218 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13219 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13223 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13224 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13225 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13226 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13227 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13229 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13230 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13231 /* hp used DAC 3 (Front) */
13232 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13233 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13238 static struct hda_verb alc861_threestack_init_verbs[] = {
13240 * Unmute ADC0 and set the default input to mic-in
13242 /* port-A for surround (rear panel) */
13243 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13244 /* port-B for mic-in (rear panel) with vref */
13245 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13246 /* port-C for line-in (rear panel) */
13247 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13248 /* port-D for Front */
13249 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13250 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13251 /* port-E for HP out (front panel) */
13252 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13253 /* route front PCM to HP */
13254 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13255 /* port-F for mic-in (front panel) with vref */
13256 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13257 /* port-G for CLFE (rear panel) */
13258 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13259 /* port-H for side (rear panel) */
13260 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13262 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13263 /* route front mic to ADC1*/
13264 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13265 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13266 /* Unmute DAC0~3 & spdif out*/
13267 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13268 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13269 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13270 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13273 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13274 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13275 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13276 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13277 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13279 /* Unmute Stereo Mixer 15 */
13280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13285 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13286 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13287 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13288 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13289 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13290 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13291 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13292 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13293 /* hp used DAC 3 (Front) */
13294 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13295 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13299 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13301 * Unmute ADC0 and set the default input to mic-in
13303 /* port-A for surround (rear panel) */
13304 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13305 /* port-B for mic-in (rear panel) with vref */
13306 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13307 /* port-C for line-in (rear panel) */
13308 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13309 /* port-D for Front */
13310 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13311 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13312 /* port-E for HP out (front panel) */
13313 /* this has to be set to VREF80 */
13314 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13315 /* route front PCM to HP */
13316 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13317 /* port-F for mic-in (front panel) with vref */
13318 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13319 /* port-G for CLFE (rear panel) */
13320 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13321 /* port-H for side (rear panel) */
13322 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13324 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13325 /* route front mic to ADC1*/
13326 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13328 /* Unmute DAC0~3 & spdif out*/
13329 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13330 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13331 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13332 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13335 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13336 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13337 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13338 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13339 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13341 /* Unmute Stereo Mixer 15 */
13342 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13344 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13345 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13347 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13348 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13349 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13350 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13353 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13354 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13355 /* hp used DAC 3 (Front) */
13356 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13357 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13361 static struct hda_verb alc861_asus_init_verbs[] = {
13363 * Unmute ADC0 and set the default input to mic-in
13365 /* port-A for surround (rear panel)
13366 * according to codec#0 this is the HP jack
13368 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13369 /* route front PCM to HP */
13370 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13371 /* port-B for mic-in (rear panel) with vref */
13372 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13373 /* port-C for line-in (rear panel) */
13374 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13375 /* port-D for Front */
13376 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13377 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13378 /* port-E for HP out (front panel) */
13379 /* this has to be set to VREF80 */
13380 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13381 /* route front PCM to HP */
13382 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13383 /* port-F for mic-in (front panel) with vref */
13384 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13385 /* port-G for CLFE (rear panel) */
13386 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13387 /* port-H for side (rear panel) */
13388 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13390 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13391 /* route front mic to ADC1*/
13392 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13393 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13394 /* Unmute DAC0~3 & spdif out*/
13395 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13396 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13397 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13398 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13400 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13401 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13402 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13403 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13404 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13406 /* Unmute Stereo Mixer 15 */
13407 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13408 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13409 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13410 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13412 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13413 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13414 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13415 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13416 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13417 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13418 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13419 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13420 /* hp used DAC 3 (Front) */
13421 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13422 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13426 /* additional init verbs for ASUS laptops */
13427 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13428 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13429 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13434 * generic initialization of ADC, input mixers and output mixers
13436 static struct hda_verb alc861_auto_init_verbs[] = {
13438 * Unmute ADC0 and set the default input to mic-in
13440 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13443 /* Unmute DAC0~3 & spdif out*/
13444 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13445 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13446 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13447 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13448 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13450 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13451 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13452 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13453 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13454 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13456 /* Unmute Stereo Mixer 15 */
13457 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13458 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13459 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13460 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13462 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13463 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13464 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13465 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13466 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13467 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13468 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13469 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13471 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13472 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13473 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13474 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13475 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13476 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13477 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13478 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13480 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13485 static struct hda_verb alc861_toshiba_init_verbs[] = {
13486 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13491 /* toggle speaker-output according to the hp-jack state */
13492 static void alc861_toshiba_automute(struct hda_codec *codec)
13494 unsigned int present;
13496 present = snd_hda_codec_read(codec, 0x0f, 0,
13497 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13498 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13499 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13500 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13501 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13504 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13507 if ((res >> 26) == ALC880_HP_EVENT)
13508 alc861_toshiba_automute(codec);
13511 /* pcm configuration: identiacal with ALC880 */
13512 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13513 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13514 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13515 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13518 #define ALC861_DIGOUT_NID 0x07
13520 static struct hda_channel_mode alc861_8ch_modes[1] = {
13524 static hda_nid_t alc861_dac_nids[4] = {
13525 /* front, surround, clfe, side */
13526 0x03, 0x06, 0x05, 0x04
13529 static hda_nid_t alc660_dac_nids[3] = {
13530 /* front, clfe, surround */
13534 static hda_nid_t alc861_adc_nids[1] = {
13539 static struct hda_input_mux alc861_capture_source = {
13543 { "Front Mic", 0x3 },
13550 /* fill in the dac_nids table from the parsed pin configuration */
13551 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13552 const struct auto_pin_cfg *cfg)
13557 spec->multiout.dac_nids = spec->private_dac_nids;
13558 for (i = 0; i < cfg->line_outs; i++) {
13559 nid = cfg->line_out_pins[i];
13561 if (i >= ARRAY_SIZE(alc861_dac_nids))
13563 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13566 spec->multiout.num_dacs = cfg->line_outs;
13570 /* add playback controls from the parsed DAC table */
13571 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13572 const struct auto_pin_cfg *cfg)
13575 static const char *chname[4] = {
13576 "Front", "Surround", NULL /*CLFE*/, "Side"
13581 for (i = 0; i < cfg->line_outs; i++) {
13582 nid = spec->multiout.dac_nids[i];
13587 err = add_control(spec, ALC_CTL_BIND_MUTE,
13588 "Center Playback Switch",
13589 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13593 err = add_control(spec, ALC_CTL_BIND_MUTE,
13594 "LFE Playback Switch",
13595 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13600 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13602 if (nid == alc861_dac_nids[idx])
13604 sprintf(name, "%s Playback Switch", chname[idx]);
13605 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13606 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13615 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13623 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13625 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13626 "Headphone Playback Switch",
13627 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13630 spec->multiout.hp_nid = nid;
13635 /* create playback/capture controls for input pins */
13636 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13637 const struct auto_pin_cfg *cfg)
13639 struct hda_input_mux *imux = &spec->private_imux[0];
13640 int i, err, idx, idx1;
13642 for (i = 0; i < AUTO_PIN_LAST; i++) {
13643 switch (cfg->input_pins[i]) {
13646 idx = 2; /* Line In */
13650 idx = 2; /* Line In */
13654 idx = 1; /* Mic In */
13658 idx = 1; /* Mic In */
13668 err = new_analog_input(spec, cfg->input_pins[i],
13669 auto_pin_cfg_labels[i], idx, 0x15);
13673 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13674 imux->items[imux->num_items].index = idx1;
13680 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13682 int pin_type, int dac_idx)
13684 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13686 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13690 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13692 struct alc_spec *spec = codec->spec;
13695 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13696 for (i = 0; i < spec->autocfg.line_outs; i++) {
13697 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13698 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13700 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13701 spec->multiout.dac_nids[i]);
13705 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13707 struct alc_spec *spec = codec->spec;
13710 pin = spec->autocfg.hp_pins[0];
13711 if (pin) /* connect to front */
13712 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13713 spec->multiout.dac_nids[0]);
13714 pin = spec->autocfg.speaker_pins[0];
13716 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13719 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13721 struct alc_spec *spec = codec->spec;
13724 for (i = 0; i < AUTO_PIN_LAST; i++) {
13725 hda_nid_t nid = spec->autocfg.input_pins[i];
13726 if (nid >= 0x0c && nid <= 0x11) {
13727 snd_hda_codec_write(codec, nid, 0,
13728 AC_VERB_SET_PIN_WIDGET_CONTROL,
13729 i <= AUTO_PIN_FRONT_MIC ?
13730 PIN_VREF80 : PIN_IN);
13735 /* parse the BIOS configuration and set up the alc_spec */
13736 /* return 1 if successful, 0 if the proper config is not found,
13737 * or a negative error code
13739 static int alc861_parse_auto_config(struct hda_codec *codec)
13741 struct alc_spec *spec = codec->spec;
13743 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13745 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13749 if (!spec->autocfg.line_outs)
13750 return 0; /* can't find valid BIOS pin config */
13752 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13755 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13758 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13761 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13765 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13767 if (spec->autocfg.dig_out_pin)
13768 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13770 if (spec->kctls.list)
13771 add_mixer(spec, spec->kctls.list);
13773 add_verb(spec, alc861_auto_init_verbs);
13775 spec->num_mux_defs = 1;
13776 spec->input_mux = &spec->private_imux[0];
13778 spec->adc_nids = alc861_adc_nids;
13779 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13780 set_capture_mixer(spec);
13782 store_pin_configs(codec);
13786 /* additional initialization for auto-configuration model */
13787 static void alc861_auto_init(struct hda_codec *codec)
13789 struct alc_spec *spec = codec->spec;
13790 alc861_auto_init_multi_out(codec);
13791 alc861_auto_init_hp_out(codec);
13792 alc861_auto_init_analog_input(codec);
13793 if (spec->unsol_event)
13794 alc_inithook(codec);
13797 #ifdef CONFIG_SND_HDA_POWER_SAVE
13798 static struct hda_amp_list alc861_loopbacks[] = {
13799 { 0x15, HDA_INPUT, 0 },
13800 { 0x15, HDA_INPUT, 1 },
13801 { 0x15, HDA_INPUT, 2 },
13802 { 0x15, HDA_INPUT, 3 },
13809 * configuration and preset
13811 static const char *alc861_models[ALC861_MODEL_LAST] = {
13812 [ALC861_3ST] = "3stack",
13813 [ALC660_3ST] = "3stack-660",
13814 [ALC861_3ST_DIG] = "3stack-dig",
13815 [ALC861_6ST_DIG] = "6stack-dig",
13816 [ALC861_UNIWILL_M31] = "uniwill-m31",
13817 [ALC861_TOSHIBA] = "toshiba",
13818 [ALC861_ASUS] = "asus",
13819 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13820 [ALC861_AUTO] = "auto",
13823 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13824 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13825 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13826 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13827 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13828 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13829 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13830 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13831 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13832 * Any other models that need this preset?
13834 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13835 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13836 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13837 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13838 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13839 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13840 /* FIXME: the below seems conflict */
13841 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13842 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13843 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13847 static struct alc_config_preset alc861_presets[] = {
13849 .mixers = { alc861_3ST_mixer },
13850 .init_verbs = { alc861_threestack_init_verbs },
13851 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13852 .dac_nids = alc861_dac_nids,
13853 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13854 .channel_mode = alc861_threestack_modes,
13856 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13857 .adc_nids = alc861_adc_nids,
13858 .input_mux = &alc861_capture_source,
13860 [ALC861_3ST_DIG] = {
13861 .mixers = { alc861_base_mixer },
13862 .init_verbs = { alc861_threestack_init_verbs },
13863 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13864 .dac_nids = alc861_dac_nids,
13865 .dig_out_nid = ALC861_DIGOUT_NID,
13866 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13867 .channel_mode = alc861_threestack_modes,
13869 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13870 .adc_nids = alc861_adc_nids,
13871 .input_mux = &alc861_capture_source,
13873 [ALC861_6ST_DIG] = {
13874 .mixers = { alc861_base_mixer },
13875 .init_verbs = { alc861_base_init_verbs },
13876 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13877 .dac_nids = alc861_dac_nids,
13878 .dig_out_nid = ALC861_DIGOUT_NID,
13879 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13880 .channel_mode = alc861_8ch_modes,
13881 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13882 .adc_nids = alc861_adc_nids,
13883 .input_mux = &alc861_capture_source,
13886 .mixers = { alc861_3ST_mixer },
13887 .init_verbs = { alc861_threestack_init_verbs },
13888 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13889 .dac_nids = alc660_dac_nids,
13890 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13891 .channel_mode = alc861_threestack_modes,
13893 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13894 .adc_nids = alc861_adc_nids,
13895 .input_mux = &alc861_capture_source,
13897 [ALC861_UNIWILL_M31] = {
13898 .mixers = { alc861_uniwill_m31_mixer },
13899 .init_verbs = { alc861_uniwill_m31_init_verbs },
13900 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13901 .dac_nids = alc861_dac_nids,
13902 .dig_out_nid = ALC861_DIGOUT_NID,
13903 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13904 .channel_mode = alc861_uniwill_m31_modes,
13906 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13907 .adc_nids = alc861_adc_nids,
13908 .input_mux = &alc861_capture_source,
13910 [ALC861_TOSHIBA] = {
13911 .mixers = { alc861_toshiba_mixer },
13912 .init_verbs = { alc861_base_init_verbs,
13913 alc861_toshiba_init_verbs },
13914 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13915 .dac_nids = alc861_dac_nids,
13916 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13917 .channel_mode = alc883_3ST_2ch_modes,
13918 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13919 .adc_nids = alc861_adc_nids,
13920 .input_mux = &alc861_capture_source,
13921 .unsol_event = alc861_toshiba_unsol_event,
13922 .init_hook = alc861_toshiba_automute,
13925 .mixers = { alc861_asus_mixer },
13926 .init_verbs = { alc861_asus_init_verbs },
13927 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13928 .dac_nids = alc861_dac_nids,
13929 .dig_out_nid = ALC861_DIGOUT_NID,
13930 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13931 .channel_mode = alc861_asus_modes,
13934 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13935 .adc_nids = alc861_adc_nids,
13936 .input_mux = &alc861_capture_source,
13938 [ALC861_ASUS_LAPTOP] = {
13939 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13940 .init_verbs = { alc861_asus_init_verbs,
13941 alc861_asus_laptop_init_verbs },
13942 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13943 .dac_nids = alc861_dac_nids,
13944 .dig_out_nid = ALC861_DIGOUT_NID,
13945 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13946 .channel_mode = alc883_3ST_2ch_modes,
13948 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13949 .adc_nids = alc861_adc_nids,
13950 .input_mux = &alc861_capture_source,
13955 static int patch_alc861(struct hda_codec *codec)
13957 struct alc_spec *spec;
13961 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13965 codec->spec = spec;
13967 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13971 if (board_config < 0) {
13972 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13973 "trying auto-probe from BIOS...\n");
13974 board_config = ALC861_AUTO;
13977 if (board_config == ALC861_AUTO) {
13978 /* automatic parse from the BIOS config */
13979 err = alc861_parse_auto_config(codec);
13985 "hda_codec: Cannot set up configuration "
13986 "from BIOS. Using base mode...\n");
13987 board_config = ALC861_3ST_DIG;
13991 err = snd_hda_attach_beep_device(codec, 0x23);
13997 if (board_config != ALC861_AUTO)
13998 setup_preset(spec, &alc861_presets[board_config]);
14000 spec->stream_name_analog = "ALC861 Analog";
14001 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14002 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14004 spec->stream_name_digital = "ALC861 Digital";
14005 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14006 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14008 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14010 spec->vmaster_nid = 0x03;
14012 codec->patch_ops = alc_patch_ops;
14013 if (board_config == ALC861_AUTO)
14014 spec->init_hook = alc861_auto_init;
14015 #ifdef CONFIG_SND_HDA_POWER_SAVE
14016 if (!spec->loopback.amplist)
14017 spec->loopback.amplist = alc861_loopbacks;
14019 codec->proc_widget_hook = print_realtek_coef;
14025 * ALC861-VD support
14029 * In addition, an independent DAC
14031 #define ALC861VD_DIGOUT_NID 0x06
14033 static hda_nid_t alc861vd_dac_nids[4] = {
14034 /* front, surr, clfe, side surr */
14035 0x02, 0x03, 0x04, 0x05
14038 /* dac_nids for ALC660vd are in a different order - according to
14039 * Realtek's driver.
14040 * This should probably tesult in a different mixer for 6stack models
14041 * of ALC660vd codecs, but for now there is only 3stack mixer
14042 * - and it is the same as in 861vd.
14043 * adc_nids in ALC660vd are (is) the same as in 861vd
14045 static hda_nid_t alc660vd_dac_nids[3] = {
14046 /* front, rear, clfe, rear_surr */
14050 static hda_nid_t alc861vd_adc_nids[1] = {
14055 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14058 /* FIXME: should be a matrix-type input source selection */
14059 static struct hda_input_mux alc861vd_capture_source = {
14063 { "Front Mic", 0x1 },
14069 static struct hda_input_mux alc861vd_dallas_capture_source = {
14072 { "Ext Mic", 0x0 },
14073 { "Int Mic", 0x1 },
14077 static struct hda_input_mux alc861vd_hp_capture_source = {
14080 { "Front Mic", 0x0 },
14081 { "ATAPI Mic", 0x1 },
14088 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14095 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14096 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14097 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14098 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14099 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14106 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14107 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14108 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14109 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14110 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14114 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14115 { 6, alc861vd_6stack_ch6_init },
14116 { 8, alc861vd_6stack_ch8_init },
14119 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14121 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14122 .name = "Channel Mode",
14123 .info = alc_ch_mode_info,
14124 .get = alc_ch_mode_get,
14125 .put = alc_ch_mode_put,
14130 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14131 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14133 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14134 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14135 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14137 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14138 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14140 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14142 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14144 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14145 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14147 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14148 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14150 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14152 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14156 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14157 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14158 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14160 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14161 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14163 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14164 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14169 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14170 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14171 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14175 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14179 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14180 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14181 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14183 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14184 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14186 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14187 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14192 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14193 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14194 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14195 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14199 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14203 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14204 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14205 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14207 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14208 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14213 /* Pin assignment: Speaker=0x14, HP = 0x15,
14214 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14216 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14217 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14218 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14219 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14220 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14221 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14222 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14223 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14224 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14225 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14226 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14230 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14231 * Front Mic=0x18, ATAPI Mic = 0x19,
14233 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14234 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14235 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14236 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14237 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14238 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14239 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14240 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14241 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14247 * generic initialization of ADC, input mixers and output mixers
14249 static struct hda_verb alc861vd_volume_init_verbs[] = {
14251 * Unmute ADC0 and set the default input to mic-in
14253 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14254 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14256 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14257 * the analog-loopback mixer widget
14259 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14264 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14266 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14268 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14269 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14270 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14273 * Set up output mixers (0x02 - 0x05)
14275 /* set vol=0 to output mixers */
14276 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14277 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14278 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14279 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14281 /* set up input amps for analog loopback */
14282 /* Amp Indices: DAC = 0, mixer = 1 */
14283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14285 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14286 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14287 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14289 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14296 * 3-stack pin configuration:
14297 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14299 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14301 * Set pin mode and muting
14303 /* set front pin widgets 0x14 for output */
14304 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14305 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14306 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14308 /* Mic (rear) pin: input vref at 80% */
14309 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14310 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14311 /* Front Mic pin: input vref at 80% */
14312 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14313 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14314 /* Line In pin: input */
14315 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14317 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14318 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14319 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14320 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14321 /* CD pin widget for input */
14322 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14328 * 6-stack pin configuration:
14330 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14332 * Set pin mode and muting
14334 /* set front pin widgets 0x14 for output */
14335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14336 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14337 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14339 /* Rear Pin: output 1 (0x0d) */
14340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14341 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14342 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14343 /* CLFE Pin: output 2 (0x0e) */
14344 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14345 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14346 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14347 /* Side Pin: output 3 (0x0f) */
14348 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14349 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14350 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14352 /* Mic (rear) pin: input vref at 80% */
14353 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14354 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14355 /* Front Mic pin: input vref at 80% */
14356 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14357 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14358 /* Line In pin: input */
14359 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14360 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14361 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14362 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14363 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14364 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14365 /* CD pin widget for input */
14366 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14371 static struct hda_verb alc861vd_eapd_verbs[] = {
14372 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14376 static struct hda_verb alc660vd_eapd_verbs[] = {
14377 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14378 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14382 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14386 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14387 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14391 /* toggle speaker-output according to the hp-jack state */
14392 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14394 unsigned int present;
14395 unsigned char bits;
14397 present = snd_hda_codec_read(codec, 0x1b, 0,
14398 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14399 bits = present ? HDA_AMP_MUTE : 0;
14400 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14401 HDA_AMP_MUTE, bits);
14404 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14406 unsigned int present;
14407 unsigned char bits;
14409 present = snd_hda_codec_read(codec, 0x18, 0,
14410 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14411 bits = present ? HDA_AMP_MUTE : 0;
14412 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14413 HDA_AMP_MUTE, bits);
14416 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14418 alc861vd_lenovo_hp_automute(codec);
14419 alc861vd_lenovo_mic_automute(codec);
14422 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14425 switch (res >> 26) {
14426 case ALC880_HP_EVENT:
14427 alc861vd_lenovo_hp_automute(codec);
14429 case ALC880_MIC_EVENT:
14430 alc861vd_lenovo_mic_automute(codec);
14435 static struct hda_verb alc861vd_dallas_verbs[] = {
14436 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14437 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14438 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14439 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14442 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14444 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14445 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14446 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14447 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14448 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14452 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14453 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14454 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14455 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14456 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14457 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14459 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14460 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14461 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14462 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14463 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14464 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14465 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14466 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14473 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14474 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14475 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14480 /* toggle speaker-output according to the hp-jack state */
14481 static void alc861vd_dallas_automute(struct hda_codec *codec)
14483 unsigned int present;
14485 present = snd_hda_codec_read(codec, 0x15, 0,
14486 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14487 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14488 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14491 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14493 if ((res >> 26) == ALC880_HP_EVENT)
14494 alc861vd_dallas_automute(codec);
14497 #ifdef CONFIG_SND_HDA_POWER_SAVE
14498 #define alc861vd_loopbacks alc880_loopbacks
14501 /* pcm configuration: identiacal with ALC880 */
14502 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14503 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14504 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14505 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14508 * configuration and preset
14510 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14511 [ALC660VD_3ST] = "3stack-660",
14512 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14513 [ALC660VD_ASUS_V1S] = "asus-v1s",
14514 [ALC861VD_3ST] = "3stack",
14515 [ALC861VD_3ST_DIG] = "3stack-digout",
14516 [ALC861VD_6ST_DIG] = "6stack-digout",
14517 [ALC861VD_LENOVO] = "lenovo",
14518 [ALC861VD_DALLAS] = "dallas",
14519 [ALC861VD_HP] = "hp",
14520 [ALC861VD_AUTO] = "auto",
14523 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14524 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14525 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14526 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14527 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14528 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14529 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14530 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14531 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14532 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14533 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14534 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14535 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14536 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14537 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14538 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14539 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14540 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14544 static struct alc_config_preset alc861vd_presets[] = {
14546 .mixers = { alc861vd_3st_mixer },
14547 .init_verbs = { alc861vd_volume_init_verbs,
14548 alc861vd_3stack_init_verbs },
14549 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14550 .dac_nids = alc660vd_dac_nids,
14551 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14552 .channel_mode = alc861vd_3stack_2ch_modes,
14553 .input_mux = &alc861vd_capture_source,
14555 [ALC660VD_3ST_DIG] = {
14556 .mixers = { alc861vd_3st_mixer },
14557 .init_verbs = { alc861vd_volume_init_verbs,
14558 alc861vd_3stack_init_verbs },
14559 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14560 .dac_nids = alc660vd_dac_nids,
14561 .dig_out_nid = ALC861VD_DIGOUT_NID,
14562 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14563 .channel_mode = alc861vd_3stack_2ch_modes,
14564 .input_mux = &alc861vd_capture_source,
14567 .mixers = { alc861vd_3st_mixer },
14568 .init_verbs = { alc861vd_volume_init_verbs,
14569 alc861vd_3stack_init_verbs },
14570 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14571 .dac_nids = alc861vd_dac_nids,
14572 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14573 .channel_mode = alc861vd_3stack_2ch_modes,
14574 .input_mux = &alc861vd_capture_source,
14576 [ALC861VD_3ST_DIG] = {
14577 .mixers = { alc861vd_3st_mixer },
14578 .init_verbs = { alc861vd_volume_init_verbs,
14579 alc861vd_3stack_init_verbs },
14580 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14581 .dac_nids = alc861vd_dac_nids,
14582 .dig_out_nid = ALC861VD_DIGOUT_NID,
14583 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14584 .channel_mode = alc861vd_3stack_2ch_modes,
14585 .input_mux = &alc861vd_capture_source,
14587 [ALC861VD_6ST_DIG] = {
14588 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14589 .init_verbs = { alc861vd_volume_init_verbs,
14590 alc861vd_6stack_init_verbs },
14591 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14592 .dac_nids = alc861vd_dac_nids,
14593 .dig_out_nid = ALC861VD_DIGOUT_NID,
14594 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14595 .channel_mode = alc861vd_6stack_modes,
14596 .input_mux = &alc861vd_capture_source,
14598 [ALC861VD_LENOVO] = {
14599 .mixers = { alc861vd_lenovo_mixer },
14600 .init_verbs = { alc861vd_volume_init_verbs,
14601 alc861vd_3stack_init_verbs,
14602 alc861vd_eapd_verbs,
14603 alc861vd_lenovo_unsol_verbs },
14604 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14605 .dac_nids = alc660vd_dac_nids,
14606 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14607 .channel_mode = alc861vd_3stack_2ch_modes,
14608 .input_mux = &alc861vd_capture_source,
14609 .unsol_event = alc861vd_lenovo_unsol_event,
14610 .init_hook = alc861vd_lenovo_automute,
14612 [ALC861VD_DALLAS] = {
14613 .mixers = { alc861vd_dallas_mixer },
14614 .init_verbs = { alc861vd_dallas_verbs },
14615 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14616 .dac_nids = alc861vd_dac_nids,
14617 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14618 .channel_mode = alc861vd_3stack_2ch_modes,
14619 .input_mux = &alc861vd_dallas_capture_source,
14620 .unsol_event = alc861vd_dallas_unsol_event,
14621 .init_hook = alc861vd_dallas_automute,
14624 .mixers = { alc861vd_hp_mixer },
14625 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14626 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14627 .dac_nids = alc861vd_dac_nids,
14628 .dig_out_nid = ALC861VD_DIGOUT_NID,
14629 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14630 .channel_mode = alc861vd_3stack_2ch_modes,
14631 .input_mux = &alc861vd_hp_capture_source,
14632 .unsol_event = alc861vd_dallas_unsol_event,
14633 .init_hook = alc861vd_dallas_automute,
14635 [ALC660VD_ASUS_V1S] = {
14636 .mixers = { alc861vd_lenovo_mixer },
14637 .init_verbs = { alc861vd_volume_init_verbs,
14638 alc861vd_3stack_init_verbs,
14639 alc861vd_eapd_verbs,
14640 alc861vd_lenovo_unsol_verbs },
14641 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14642 .dac_nids = alc660vd_dac_nids,
14643 .dig_out_nid = ALC861VD_DIGOUT_NID,
14644 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14645 .channel_mode = alc861vd_3stack_2ch_modes,
14646 .input_mux = &alc861vd_capture_source,
14647 .unsol_event = alc861vd_lenovo_unsol_event,
14648 .init_hook = alc861vd_lenovo_automute,
14653 * BIOS auto configuration
14655 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14656 hda_nid_t nid, int pin_type, int dac_idx)
14658 alc_set_pin_output(codec, nid, pin_type);
14661 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14663 struct alc_spec *spec = codec->spec;
14666 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14667 for (i = 0; i <= HDA_SIDE; i++) {
14668 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14669 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14671 alc861vd_auto_set_output_and_unmute(codec, nid,
14677 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14679 struct alc_spec *spec = codec->spec;
14682 pin = spec->autocfg.hp_pins[0];
14683 if (pin) /* connect to front and use dac 0 */
14684 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14685 pin = spec->autocfg.speaker_pins[0];
14687 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14690 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14691 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14693 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14695 struct alc_spec *spec = codec->spec;
14698 for (i = 0; i < AUTO_PIN_LAST; i++) {
14699 hda_nid_t nid = spec->autocfg.input_pins[i];
14700 if (alc861vd_is_input_pin(nid)) {
14701 snd_hda_codec_write(codec, nid, 0,
14702 AC_VERB_SET_PIN_WIDGET_CONTROL,
14703 i <= AUTO_PIN_FRONT_MIC ?
14704 PIN_VREF80 : PIN_IN);
14705 if (nid != ALC861VD_PIN_CD_NID)
14706 snd_hda_codec_write(codec, nid, 0,
14707 AC_VERB_SET_AMP_GAIN_MUTE,
14713 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14715 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14716 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14718 /* add playback controls from the parsed DAC table */
14719 /* Based on ALC880 version. But ALC861VD has separate,
14720 * different NIDs for mute/unmute switch and volume control */
14721 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14722 const struct auto_pin_cfg *cfg)
14725 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14726 hda_nid_t nid_v, nid_s;
14729 for (i = 0; i < cfg->line_outs; i++) {
14730 if (!spec->multiout.dac_nids[i])
14732 nid_v = alc861vd_idx_to_mixer_vol(
14734 spec->multiout.dac_nids[i]));
14735 nid_s = alc861vd_idx_to_mixer_switch(
14737 spec->multiout.dac_nids[i]));
14741 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14742 "Center Playback Volume",
14743 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14747 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14748 "LFE Playback Volume",
14749 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14753 err = add_control(spec, ALC_CTL_BIND_MUTE,
14754 "Center Playback Switch",
14755 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14759 err = add_control(spec, ALC_CTL_BIND_MUTE,
14760 "LFE Playback Switch",
14761 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14766 sprintf(name, "%s Playback Volume", chname[i]);
14767 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14768 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14772 sprintf(name, "%s Playback Switch", chname[i]);
14773 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14774 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14783 /* add playback controls for speaker and HP outputs */
14784 /* Based on ALC880 version. But ALC861VD has separate,
14785 * different NIDs for mute/unmute switch and volume control */
14786 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14787 hda_nid_t pin, const char *pfx)
14789 hda_nid_t nid_v, nid_s;
14796 if (alc880_is_fixed_pin(pin)) {
14797 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14798 /* specify the DAC as the extra output */
14799 if (!spec->multiout.hp_nid)
14800 spec->multiout.hp_nid = nid_v;
14802 spec->multiout.extra_out_nid[0] = nid_v;
14803 /* control HP volume/switch on the output mixer amp */
14804 nid_v = alc861vd_idx_to_mixer_vol(
14805 alc880_fixed_pin_idx(pin));
14806 nid_s = alc861vd_idx_to_mixer_switch(
14807 alc880_fixed_pin_idx(pin));
14809 sprintf(name, "%s Playback Volume", pfx);
14810 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14811 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14814 sprintf(name, "%s Playback Switch", pfx);
14815 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14816 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14819 } else if (alc880_is_multi_pin(pin)) {
14820 /* set manual connection */
14821 /* we have only a switch on HP-out PIN */
14822 sprintf(name, "%s Playback Switch", pfx);
14823 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14824 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14831 /* parse the BIOS configuration and set up the alc_spec
14832 * return 1 if successful, 0 if the proper config is not found,
14833 * or a negative error code
14834 * Based on ALC880 version - had to change it to override
14835 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14836 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14838 struct alc_spec *spec = codec->spec;
14840 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14842 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14846 if (!spec->autocfg.line_outs)
14847 return 0; /* can't find valid BIOS pin config */
14849 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14852 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14855 err = alc861vd_auto_create_extra_out(spec,
14856 spec->autocfg.speaker_pins[0],
14860 err = alc861vd_auto_create_extra_out(spec,
14861 spec->autocfg.hp_pins[0],
14865 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14869 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14871 if (spec->autocfg.dig_out_pin)
14872 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14874 if (spec->kctls.list)
14875 add_mixer(spec, spec->kctls.list);
14877 add_verb(spec, alc861vd_volume_init_verbs);
14879 spec->num_mux_defs = 1;
14880 spec->input_mux = &spec->private_imux[0];
14882 err = alc_auto_add_mic_boost(codec);
14886 store_pin_configs(codec);
14890 /* additional initialization for auto-configuration model */
14891 static void alc861vd_auto_init(struct hda_codec *codec)
14893 struct alc_spec *spec = codec->spec;
14894 alc861vd_auto_init_multi_out(codec);
14895 alc861vd_auto_init_hp_out(codec);
14896 alc861vd_auto_init_analog_input(codec);
14897 alc861vd_auto_init_input_src(codec);
14898 if (spec->unsol_event)
14899 alc_inithook(codec);
14902 static int patch_alc861vd(struct hda_codec *codec)
14904 struct alc_spec *spec;
14905 int err, board_config;
14907 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14911 codec->spec = spec;
14913 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14917 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14918 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14919 "ALC861VD, trying auto-probe from BIOS...\n");
14920 board_config = ALC861VD_AUTO;
14923 if (board_config == ALC861VD_AUTO) {
14924 /* automatic parse from the BIOS config */
14925 err = alc861vd_parse_auto_config(codec);
14931 "hda_codec: Cannot set up configuration "
14932 "from BIOS. Using base mode...\n");
14933 board_config = ALC861VD_3ST;
14937 err = snd_hda_attach_beep_device(codec, 0x23);
14943 if (board_config != ALC861VD_AUTO)
14944 setup_preset(spec, &alc861vd_presets[board_config]);
14946 if (codec->vendor_id == 0x10ec0660) {
14947 spec->stream_name_analog = "ALC660-VD Analog";
14948 spec->stream_name_digital = "ALC660-VD Digital";
14949 /* always turn on EAPD */
14950 add_verb(spec, alc660vd_eapd_verbs);
14952 spec->stream_name_analog = "ALC861VD Analog";
14953 spec->stream_name_digital = "ALC861VD Digital";
14956 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14957 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14959 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14960 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14962 spec->adc_nids = alc861vd_adc_nids;
14963 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14964 spec->capsrc_nids = alc861vd_capsrc_nids;
14965 spec->capture_style = CAPT_MIX;
14967 set_capture_mixer(spec);
14968 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
14970 spec->vmaster_nid = 0x02;
14972 codec->patch_ops = alc_patch_ops;
14974 if (board_config == ALC861VD_AUTO)
14975 spec->init_hook = alc861vd_auto_init;
14976 #ifdef CONFIG_SND_HDA_POWER_SAVE
14977 if (!spec->loopback.amplist)
14978 spec->loopback.amplist = alc861vd_loopbacks;
14980 codec->proc_widget_hook = print_realtek_coef;
14988 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14989 * configuration. Each pin widget can choose any input DACs and a mixer.
14990 * Each ADC is connected from a mixer of all inputs. This makes possible
14991 * 6-channel independent captures.
14993 * In addition, an independent DAC for the multi-playback (not used in this
14996 #define ALC662_DIGOUT_NID 0x06
14997 #define ALC662_DIGIN_NID 0x0a
14999 static hda_nid_t alc662_dac_nids[4] = {
15000 /* front, rear, clfe, rear_surr */
15004 static hda_nid_t alc662_adc_nids[1] = {
15009 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15012 /* FIXME: should be a matrix-type input source selection */
15013 static struct hda_input_mux alc662_capture_source = {
15017 { "Front Mic", 0x1 },
15023 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15031 static struct hda_input_mux alc662_eeepc_capture_source = {
15039 static struct hda_input_mux alc663_capture_source = {
15043 { "Front Mic", 0x1 },
15048 static struct hda_input_mux alc663_m51va_capture_source = {
15051 { "Ext-Mic", 0x0 },
15059 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15066 static struct hda_verb alc662_3ST_ch2_init[] = {
15067 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15068 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15069 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15070 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15077 static struct hda_verb alc662_3ST_ch6_init[] = {
15078 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15079 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15080 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15081 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15082 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15083 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15087 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15088 { 2, alc662_3ST_ch2_init },
15089 { 6, alc662_3ST_ch6_init },
15095 static struct hda_verb alc662_sixstack_ch6_init[] = {
15096 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15097 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15098 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15105 static struct hda_verb alc662_sixstack_ch8_init[] = {
15106 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15107 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15108 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15112 static struct hda_channel_mode alc662_5stack_modes[2] = {
15113 { 2, alc662_sixstack_ch6_init },
15114 { 6, alc662_sixstack_ch8_init },
15117 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15118 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15121 static struct snd_kcontrol_new alc662_base_mixer[] = {
15122 /* output mixer control */
15123 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15124 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15125 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15126 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15127 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15128 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15129 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15130 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15131 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15133 /*Input mixer control */
15134 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15135 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15136 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15137 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15138 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15139 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15140 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15141 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15145 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15146 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15147 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15148 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15149 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15150 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15151 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15152 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15155 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15156 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15160 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15161 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15162 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15163 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15164 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15165 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15166 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15167 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15168 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15170 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15171 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15172 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15173 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15174 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15176 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15177 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15181 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15182 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15183 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15184 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15185 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15187 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15188 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15194 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15195 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15197 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15198 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15200 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15201 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15202 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15204 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15205 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15206 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15210 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15211 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15212 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15213 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15214 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15215 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15216 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15217 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15218 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15219 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15220 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15228 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15229 .ops = &snd_hda_bind_vol,
15231 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15232 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15237 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15238 .ops = &snd_hda_bind_sw,
15240 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15241 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15246 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15247 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15248 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15254 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15255 .ops = &snd_hda_bind_sw,
15257 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15258 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15259 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15264 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15265 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15266 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15269 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15270 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15275 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15276 .ops = &snd_hda_bind_sw,
15278 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15279 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15280 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15285 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15286 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15287 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15290 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15291 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15295 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15296 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15297 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15300 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15301 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15302 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15306 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15307 .ops = &snd_hda_bind_vol,
15309 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15310 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15315 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15316 .ops = &snd_hda_bind_sw,
15318 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15319 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15324 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15325 HDA_BIND_VOL("Master Playback Volume",
15326 &alc663_asus_two_bind_master_vol),
15327 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15328 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15330 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15335 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15336 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15337 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15338 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15340 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15341 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15345 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15346 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15347 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15348 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15349 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15354 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15355 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15359 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15360 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15361 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15366 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15367 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15368 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15369 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15373 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15375 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15376 .name = "Channel Mode",
15377 .info = alc_ch_mode_info,
15378 .get = alc_ch_mode_get,
15379 .put = alc_ch_mode_put,
15384 static struct hda_verb alc662_init_verbs[] = {
15385 /* ADC: mute amp left and right */
15386 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15387 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15388 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15392 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15394 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15399 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15400 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15401 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15403 /* Front Pin: output 0 (0x0c) */
15404 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15405 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15407 /* Rear Pin: output 1 (0x0d) */
15408 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15409 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15411 /* CLFE Pin: output 2 (0x0e) */
15412 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15413 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15415 /* Mic (rear) pin: input vref at 80% */
15416 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15417 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15418 /* Front Mic pin: input vref at 80% */
15419 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15420 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15421 /* Line In pin: input */
15422 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15423 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15424 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15425 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15426 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15427 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15428 /* CD pin widget for input */
15429 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15431 /* FIXME: use matrix-type input source selection */
15432 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15434 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15435 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15437 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15439 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15440 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15441 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15444 /* always trun on EAPD */
15445 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15446 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15451 static struct hda_verb alc662_sue_init_verbs[] = {
15452 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15453 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15457 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15458 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15459 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15463 /* Set Unsolicited Event*/
15464 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15465 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15466 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15471 * generic initialization of ADC, input mixers and output mixers
15473 static struct hda_verb alc662_auto_init_verbs[] = {
15475 * Unmute ADC and set the default input to mic-in
15477 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15478 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15480 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15482 * Note: PASD motherboards uses the Line In 2 as the input for front
15483 * panel mic (mic 2)
15485 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15493 * Set up output mixers (0x0c - 0x0f)
15495 /* set vol=0 to output mixers */
15496 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15497 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15498 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15500 /* set up input amps for analog loopback */
15501 /* Amp Indices: DAC = 0, mixer = 1 */
15502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15510 /* FIXME: use matrix-type input source selection */
15511 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15518 /* additional verbs for ALC663 */
15519 static struct hda_verb alc663_auto_init_verbs[] = {
15520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15525 static struct hda_verb alc663_m51va_init_verbs[] = {
15526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15528 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15529 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15530 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15533 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15534 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15538 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15539 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15540 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15541 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15542 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15544 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15545 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15549 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15550 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15551 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15552 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15553 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15556 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15557 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15561 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15562 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15564 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15565 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15567 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15568 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15572 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15573 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15574 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15575 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15576 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15577 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15578 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15579 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15582 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15583 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15584 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15588 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15589 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15591 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15592 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15593 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15594 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15598 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15599 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15600 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15604 static struct hda_verb alc663_g71v_init_verbs[] = {
15605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15606 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15607 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15609 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15610 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15611 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15613 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15614 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15615 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15619 static struct hda_verb alc663_g50v_init_verbs[] = {
15620 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15621 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15622 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15624 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15625 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15629 static struct hda_verb alc662_ecs_init_verbs[] = {
15630 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15631 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15632 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15633 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15637 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15638 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15639 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15643 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15645 unsigned int present;
15646 unsigned char bits;
15648 present = snd_hda_codec_read(codec, 0x14, 0,
15649 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15650 bits = present ? HDA_AMP_MUTE : 0;
15651 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15652 HDA_AMP_MUTE, bits);
15655 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15657 unsigned int present;
15658 unsigned char bits;
15660 present = snd_hda_codec_read(codec, 0x1b, 0,
15661 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15662 bits = present ? HDA_AMP_MUTE : 0;
15663 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15664 HDA_AMP_MUTE, bits);
15665 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15666 HDA_AMP_MUTE, bits);
15669 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15672 if ((res >> 26) == ALC880_HP_EVENT)
15673 alc662_lenovo_101e_all_automute(codec);
15674 if ((res >> 26) == ALC880_FRONT_EVENT)
15675 alc662_lenovo_101e_ispeaker_automute(codec);
15678 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15680 unsigned int present;
15682 present = snd_hda_codec_read(codec, 0x18, 0,
15683 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15684 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15685 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15686 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15687 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15688 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15689 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15690 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15691 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15694 /* unsolicited event for HP jack sensing */
15695 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15698 if ((res >> 26) == ALC880_HP_EVENT)
15699 alc262_hippo1_automute( codec );
15701 if ((res >> 26) == ALC880_MIC_EVENT)
15702 alc662_eeepc_mic_automute(codec);
15705 static void alc662_eeepc_inithook(struct hda_codec *codec)
15707 alc262_hippo1_automute( codec );
15708 alc662_eeepc_mic_automute(codec);
15711 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15714 unsigned int present;
15716 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15717 present = snd_hda_codec_read(codec, 0x14, 0,
15718 AC_VERB_GET_PIN_SENSE, 0);
15719 present = (present & 0x80000000) != 0;
15721 /* mute internal speaker */
15722 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15723 HDA_AMP_MUTE, HDA_AMP_MUTE);
15725 /* unmute internal speaker if necessary */
15726 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15727 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15728 HDA_AMP_MUTE, mute);
15732 /* unsolicited event for HP jack sensing */
15733 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15736 if ((res >> 26) == ALC880_HP_EVENT)
15737 alc662_eeepc_ep20_automute(codec);
15740 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15742 alc662_eeepc_ep20_automute(codec);
15745 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15747 unsigned int present;
15748 unsigned char bits;
15750 present = snd_hda_codec_read(codec, 0x21, 0,
15751 AC_VERB_GET_PIN_SENSE, 0)
15752 & AC_PINSENSE_PRESENCE;
15753 bits = present ? HDA_AMP_MUTE : 0;
15754 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15755 AMP_IN_MUTE(0), bits);
15756 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15757 AMP_IN_MUTE(0), bits);
15760 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15762 unsigned int present;
15763 unsigned char bits;
15765 present = snd_hda_codec_read(codec, 0x21, 0,
15766 AC_VERB_GET_PIN_SENSE, 0)
15767 & AC_PINSENSE_PRESENCE;
15768 bits = present ? HDA_AMP_MUTE : 0;
15769 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15770 AMP_IN_MUTE(0), bits);
15771 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15772 AMP_IN_MUTE(0), bits);
15773 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15774 AMP_IN_MUTE(0), bits);
15775 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15776 AMP_IN_MUTE(0), bits);
15779 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15781 unsigned int present;
15782 unsigned char bits;
15784 present = snd_hda_codec_read(codec, 0x15, 0,
15785 AC_VERB_GET_PIN_SENSE, 0)
15786 & AC_PINSENSE_PRESENCE;
15787 bits = present ? HDA_AMP_MUTE : 0;
15788 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15789 AMP_IN_MUTE(0), bits);
15790 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15791 AMP_IN_MUTE(0), bits);
15792 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15793 AMP_IN_MUTE(0), bits);
15794 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15795 AMP_IN_MUTE(0), bits);
15798 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15800 unsigned int present;
15801 unsigned char bits;
15803 present = snd_hda_codec_read(codec, 0x1b, 0,
15804 AC_VERB_GET_PIN_SENSE, 0)
15805 & AC_PINSENSE_PRESENCE;
15806 bits = present ? 0 : PIN_OUT;
15807 snd_hda_codec_write(codec, 0x14, 0,
15808 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15811 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15813 unsigned int present1, present2;
15815 present1 = snd_hda_codec_read(codec, 0x21, 0,
15816 AC_VERB_GET_PIN_SENSE, 0)
15817 & AC_PINSENSE_PRESENCE;
15818 present2 = snd_hda_codec_read(codec, 0x15, 0,
15819 AC_VERB_GET_PIN_SENSE, 0)
15820 & AC_PINSENSE_PRESENCE;
15822 if (present1 || present2) {
15823 snd_hda_codec_write_cache(codec, 0x14, 0,
15824 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15826 snd_hda_codec_write_cache(codec, 0x14, 0,
15827 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15831 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15833 unsigned int present1, present2;
15835 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15836 AC_VERB_GET_PIN_SENSE, 0)
15837 & AC_PINSENSE_PRESENCE;
15838 present2 = snd_hda_codec_read(codec, 0x15, 0,
15839 AC_VERB_GET_PIN_SENSE, 0)
15840 & AC_PINSENSE_PRESENCE;
15842 if (present1 || present2) {
15843 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15844 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15845 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15846 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15848 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15849 AMP_IN_MUTE(0), 0);
15850 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15851 AMP_IN_MUTE(0), 0);
15855 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15857 unsigned int present;
15859 present = snd_hda_codec_read(codec, 0x18, 0,
15860 AC_VERB_GET_PIN_SENSE, 0)
15861 & AC_PINSENSE_PRESENCE;
15862 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15863 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15864 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15865 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15866 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15867 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15868 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15869 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15872 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15875 switch (res >> 26) {
15876 case ALC880_HP_EVENT:
15877 alc663_m51va_speaker_automute(codec);
15879 case ALC880_MIC_EVENT:
15880 alc663_m51va_mic_automute(codec);
15885 static void alc663_m51va_inithook(struct hda_codec *codec)
15887 alc663_m51va_speaker_automute(codec);
15888 alc663_m51va_mic_automute(codec);
15891 /* ***************** Mode1 ******************************/
15892 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15895 switch (res >> 26) {
15896 case ALC880_HP_EVENT:
15897 alc663_m51va_speaker_automute(codec);
15899 case ALC880_MIC_EVENT:
15900 alc662_eeepc_mic_automute(codec);
15905 static void alc663_mode1_inithook(struct hda_codec *codec)
15907 alc663_m51va_speaker_automute(codec);
15908 alc662_eeepc_mic_automute(codec);
15910 /* ***************** Mode2 ******************************/
15911 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15914 switch (res >> 26) {
15915 case ALC880_HP_EVENT:
15916 alc662_f5z_speaker_automute(codec);
15918 case ALC880_MIC_EVENT:
15919 alc662_eeepc_mic_automute(codec);
15924 static void alc662_mode2_inithook(struct hda_codec *codec)
15926 alc662_f5z_speaker_automute(codec);
15927 alc662_eeepc_mic_automute(codec);
15929 /* ***************** Mode3 ******************************/
15930 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15933 switch (res >> 26) {
15934 case ALC880_HP_EVENT:
15935 alc663_two_hp_m1_speaker_automute(codec);
15937 case ALC880_MIC_EVENT:
15938 alc662_eeepc_mic_automute(codec);
15943 static void alc663_mode3_inithook(struct hda_codec *codec)
15945 alc663_two_hp_m1_speaker_automute(codec);
15946 alc662_eeepc_mic_automute(codec);
15948 /* ***************** Mode4 ******************************/
15949 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15952 switch (res >> 26) {
15953 case ALC880_HP_EVENT:
15954 alc663_21jd_two_speaker_automute(codec);
15956 case ALC880_MIC_EVENT:
15957 alc662_eeepc_mic_automute(codec);
15962 static void alc663_mode4_inithook(struct hda_codec *codec)
15964 alc663_21jd_two_speaker_automute(codec);
15965 alc662_eeepc_mic_automute(codec);
15967 /* ***************** Mode5 ******************************/
15968 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15971 switch (res >> 26) {
15972 case ALC880_HP_EVENT:
15973 alc663_15jd_two_speaker_automute(codec);
15975 case ALC880_MIC_EVENT:
15976 alc662_eeepc_mic_automute(codec);
15981 static void alc663_mode5_inithook(struct hda_codec *codec)
15983 alc663_15jd_two_speaker_automute(codec);
15984 alc662_eeepc_mic_automute(codec);
15986 /* ***************** Mode6 ******************************/
15987 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15990 switch (res >> 26) {
15991 case ALC880_HP_EVENT:
15992 alc663_two_hp_m2_speaker_automute(codec);
15994 case ALC880_MIC_EVENT:
15995 alc662_eeepc_mic_automute(codec);
16000 static void alc663_mode6_inithook(struct hda_codec *codec)
16002 alc663_two_hp_m2_speaker_automute(codec);
16003 alc662_eeepc_mic_automute(codec);
16006 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16008 unsigned int present;
16009 unsigned char bits;
16011 present = snd_hda_codec_read(codec, 0x21, 0,
16012 AC_VERB_GET_PIN_SENSE, 0)
16013 & AC_PINSENSE_PRESENCE;
16014 bits = present ? HDA_AMP_MUTE : 0;
16015 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16016 HDA_AMP_MUTE, bits);
16017 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16018 HDA_AMP_MUTE, bits);
16021 static void alc663_g71v_front_automute(struct hda_codec *codec)
16023 unsigned int present;
16024 unsigned char bits;
16026 present = snd_hda_codec_read(codec, 0x15, 0,
16027 AC_VERB_GET_PIN_SENSE, 0)
16028 & AC_PINSENSE_PRESENCE;
16029 bits = present ? HDA_AMP_MUTE : 0;
16030 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16031 HDA_AMP_MUTE, bits);
16034 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16037 switch (res >> 26) {
16038 case ALC880_HP_EVENT:
16039 alc663_g71v_hp_automute(codec);
16041 case ALC880_FRONT_EVENT:
16042 alc663_g71v_front_automute(codec);
16044 case ALC880_MIC_EVENT:
16045 alc662_eeepc_mic_automute(codec);
16050 static void alc663_g71v_inithook(struct hda_codec *codec)
16052 alc663_g71v_front_automute(codec);
16053 alc663_g71v_hp_automute(codec);
16054 alc662_eeepc_mic_automute(codec);
16057 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16060 switch (res >> 26) {
16061 case ALC880_HP_EVENT:
16062 alc663_m51va_speaker_automute(codec);
16064 case ALC880_MIC_EVENT:
16065 alc662_eeepc_mic_automute(codec);
16070 static void alc663_g50v_inithook(struct hda_codec *codec)
16072 alc663_m51va_speaker_automute(codec);
16073 alc662_eeepc_mic_automute(codec);
16076 /* bind hp and internal speaker mute (with plug check) */
16077 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16078 struct snd_ctl_elem_value *ucontrol)
16080 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16081 long *valp = ucontrol->value.integer.value;
16084 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16086 valp[0] ? 0 : HDA_AMP_MUTE);
16087 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16089 valp[1] ? 0 : HDA_AMP_MUTE);
16091 alc262_hippo1_automute(codec);
16095 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16096 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16098 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16099 .name = "Master Playback Switch",
16100 .info = snd_hda_mixer_amp_switch_info,
16101 .get = snd_hda_mixer_amp_switch_get,
16102 .put = alc662_ecs_master_sw_put,
16103 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16106 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16107 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16108 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16110 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16111 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16112 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16116 #ifdef CONFIG_SND_HDA_POWER_SAVE
16117 #define alc662_loopbacks alc880_loopbacks
16121 /* pcm configuration: identiacal with ALC880 */
16122 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16123 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16124 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16125 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16128 * configuration and preset
16130 static const char *alc662_models[ALC662_MODEL_LAST] = {
16131 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16132 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16133 [ALC662_3ST_6ch] = "3stack-6ch",
16134 [ALC662_5ST_DIG] = "6stack-dig",
16135 [ALC662_LENOVO_101E] = "lenovo-101e",
16136 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16137 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16138 [ALC662_ECS] = "ecs",
16139 [ALC663_ASUS_M51VA] = "m51va",
16140 [ALC663_ASUS_G71V] = "g71v",
16141 [ALC663_ASUS_H13] = "h13",
16142 [ALC663_ASUS_G50V] = "g50v",
16143 [ALC663_ASUS_MODE1] = "asus-mode1",
16144 [ALC662_ASUS_MODE2] = "asus-mode2",
16145 [ALC663_ASUS_MODE3] = "asus-mode3",
16146 [ALC663_ASUS_MODE4] = "asus-mode4",
16147 [ALC663_ASUS_MODE5] = "asus-mode5",
16148 [ALC663_ASUS_MODE6] = "asus-mode6",
16149 [ALC662_AUTO] = "auto",
16152 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16153 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16154 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16155 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16156 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16157 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16158 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16159 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
16160 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16161 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16162 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16163 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
16164 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16165 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16166 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16167 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16168 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16169 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16170 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16171 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16172 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16173 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16174 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16175 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16176 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16177 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16178 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16179 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16180 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16181 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16182 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16183 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16184 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16185 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16186 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16187 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16188 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16189 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16190 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16191 ALC662_3ST_6ch_DIG),
16192 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16193 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16194 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16195 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16196 ALC662_3ST_6ch_DIG),
16197 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16198 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16199 ALC662_3ST_6ch_DIG),
16200 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
16201 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
16202 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
16206 static struct alc_config_preset alc662_presets[] = {
16207 [ALC662_3ST_2ch_DIG] = {
16208 .mixers = { alc662_3ST_2ch_mixer },
16209 .init_verbs = { alc662_init_verbs },
16210 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16211 .dac_nids = alc662_dac_nids,
16212 .dig_out_nid = ALC662_DIGOUT_NID,
16213 .dig_in_nid = ALC662_DIGIN_NID,
16214 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16215 .channel_mode = alc662_3ST_2ch_modes,
16216 .input_mux = &alc662_capture_source,
16218 [ALC662_3ST_6ch_DIG] = {
16219 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16220 .init_verbs = { alc662_init_verbs },
16221 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16222 .dac_nids = alc662_dac_nids,
16223 .dig_out_nid = ALC662_DIGOUT_NID,
16224 .dig_in_nid = ALC662_DIGIN_NID,
16225 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16226 .channel_mode = alc662_3ST_6ch_modes,
16228 .input_mux = &alc662_capture_source,
16230 [ALC662_3ST_6ch] = {
16231 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16232 .init_verbs = { alc662_init_verbs },
16233 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16234 .dac_nids = alc662_dac_nids,
16235 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16236 .channel_mode = alc662_3ST_6ch_modes,
16238 .input_mux = &alc662_capture_source,
16240 [ALC662_5ST_DIG] = {
16241 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16242 .init_verbs = { alc662_init_verbs },
16243 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16244 .dac_nids = alc662_dac_nids,
16245 .dig_out_nid = ALC662_DIGOUT_NID,
16246 .dig_in_nid = ALC662_DIGIN_NID,
16247 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16248 .channel_mode = alc662_5stack_modes,
16249 .input_mux = &alc662_capture_source,
16251 [ALC662_LENOVO_101E] = {
16252 .mixers = { alc662_lenovo_101e_mixer },
16253 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16254 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16255 .dac_nids = alc662_dac_nids,
16256 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16257 .channel_mode = alc662_3ST_2ch_modes,
16258 .input_mux = &alc662_lenovo_101e_capture_source,
16259 .unsol_event = alc662_lenovo_101e_unsol_event,
16260 .init_hook = alc662_lenovo_101e_all_automute,
16262 [ALC662_ASUS_EEEPC_P701] = {
16263 .mixers = { alc662_eeepc_p701_mixer },
16264 .init_verbs = { alc662_init_verbs,
16265 alc662_eeepc_sue_init_verbs },
16266 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16267 .dac_nids = alc662_dac_nids,
16268 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16269 .channel_mode = alc662_3ST_2ch_modes,
16270 .input_mux = &alc662_eeepc_capture_source,
16271 .unsol_event = alc662_eeepc_unsol_event,
16272 .init_hook = alc662_eeepc_inithook,
16274 [ALC662_ASUS_EEEPC_EP20] = {
16275 .mixers = { alc662_eeepc_ep20_mixer,
16276 alc662_chmode_mixer },
16277 .init_verbs = { alc662_init_verbs,
16278 alc662_eeepc_ep20_sue_init_verbs },
16279 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16280 .dac_nids = alc662_dac_nids,
16281 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16282 .channel_mode = alc662_3ST_6ch_modes,
16283 .input_mux = &alc662_lenovo_101e_capture_source,
16284 .unsol_event = alc662_eeepc_ep20_unsol_event,
16285 .init_hook = alc662_eeepc_ep20_inithook,
16288 .mixers = { alc662_ecs_mixer },
16289 .init_verbs = { alc662_init_verbs,
16290 alc662_ecs_init_verbs },
16291 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16292 .dac_nids = alc662_dac_nids,
16293 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16294 .channel_mode = alc662_3ST_2ch_modes,
16295 .input_mux = &alc662_eeepc_capture_source,
16296 .unsol_event = alc662_eeepc_unsol_event,
16297 .init_hook = alc662_eeepc_inithook,
16299 [ALC663_ASUS_M51VA] = {
16300 .mixers = { alc663_m51va_mixer },
16301 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16302 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16303 .dac_nids = alc662_dac_nids,
16304 .dig_out_nid = ALC662_DIGOUT_NID,
16305 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16306 .channel_mode = alc662_3ST_2ch_modes,
16307 .input_mux = &alc663_m51va_capture_source,
16308 .unsol_event = alc663_m51va_unsol_event,
16309 .init_hook = alc663_m51va_inithook,
16311 [ALC663_ASUS_G71V] = {
16312 .mixers = { alc663_g71v_mixer },
16313 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16314 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16315 .dac_nids = alc662_dac_nids,
16316 .dig_out_nid = ALC662_DIGOUT_NID,
16317 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16318 .channel_mode = alc662_3ST_2ch_modes,
16319 .input_mux = &alc662_eeepc_capture_source,
16320 .unsol_event = alc663_g71v_unsol_event,
16321 .init_hook = alc663_g71v_inithook,
16323 [ALC663_ASUS_H13] = {
16324 .mixers = { alc663_m51va_mixer },
16325 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16326 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16327 .dac_nids = alc662_dac_nids,
16328 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16329 .channel_mode = alc662_3ST_2ch_modes,
16330 .input_mux = &alc663_m51va_capture_source,
16331 .unsol_event = alc663_m51va_unsol_event,
16332 .init_hook = alc663_m51va_inithook,
16334 [ALC663_ASUS_G50V] = {
16335 .mixers = { alc663_g50v_mixer },
16336 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16337 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16338 .dac_nids = alc662_dac_nids,
16339 .dig_out_nid = ALC662_DIGOUT_NID,
16340 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16341 .channel_mode = alc662_3ST_6ch_modes,
16342 .input_mux = &alc663_capture_source,
16343 .unsol_event = alc663_g50v_unsol_event,
16344 .init_hook = alc663_g50v_inithook,
16346 [ALC663_ASUS_MODE1] = {
16347 .mixers = { alc663_m51va_mixer },
16348 .cap_mixer = alc662_auto_capture_mixer,
16349 .init_verbs = { alc662_init_verbs,
16350 alc663_21jd_amic_init_verbs },
16351 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16353 .dac_nids = alc662_dac_nids,
16354 .dig_out_nid = ALC662_DIGOUT_NID,
16355 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16356 .channel_mode = alc662_3ST_2ch_modes,
16357 .input_mux = &alc662_eeepc_capture_source,
16358 .unsol_event = alc663_mode1_unsol_event,
16359 .init_hook = alc663_mode1_inithook,
16361 [ALC662_ASUS_MODE2] = {
16362 .mixers = { alc662_1bjd_mixer },
16363 .cap_mixer = alc662_auto_capture_mixer,
16364 .init_verbs = { alc662_init_verbs,
16365 alc662_1bjd_amic_init_verbs },
16366 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16367 .dac_nids = alc662_dac_nids,
16368 .dig_out_nid = ALC662_DIGOUT_NID,
16369 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16370 .channel_mode = alc662_3ST_2ch_modes,
16371 .input_mux = &alc662_eeepc_capture_source,
16372 .unsol_event = alc662_mode2_unsol_event,
16373 .init_hook = alc662_mode2_inithook,
16375 [ALC663_ASUS_MODE3] = {
16376 .mixers = { alc663_two_hp_m1_mixer },
16377 .cap_mixer = alc662_auto_capture_mixer,
16378 .init_verbs = { alc662_init_verbs,
16379 alc663_two_hp_amic_m1_init_verbs },
16380 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16382 .dac_nids = alc662_dac_nids,
16383 .dig_out_nid = ALC662_DIGOUT_NID,
16384 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16385 .channel_mode = alc662_3ST_2ch_modes,
16386 .input_mux = &alc662_eeepc_capture_source,
16387 .unsol_event = alc663_mode3_unsol_event,
16388 .init_hook = alc663_mode3_inithook,
16390 [ALC663_ASUS_MODE4] = {
16391 .mixers = { alc663_asus_21jd_clfe_mixer },
16392 .cap_mixer = alc662_auto_capture_mixer,
16393 .init_verbs = { alc662_init_verbs,
16394 alc663_21jd_amic_init_verbs},
16395 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16397 .dac_nids = alc662_dac_nids,
16398 .dig_out_nid = ALC662_DIGOUT_NID,
16399 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16400 .channel_mode = alc662_3ST_2ch_modes,
16401 .input_mux = &alc662_eeepc_capture_source,
16402 .unsol_event = alc663_mode4_unsol_event,
16403 .init_hook = alc663_mode4_inithook,
16405 [ALC663_ASUS_MODE5] = {
16406 .mixers = { alc663_asus_15jd_clfe_mixer },
16407 .cap_mixer = alc662_auto_capture_mixer,
16408 .init_verbs = { alc662_init_verbs,
16409 alc663_15jd_amic_init_verbs },
16410 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16412 .dac_nids = alc662_dac_nids,
16413 .dig_out_nid = ALC662_DIGOUT_NID,
16414 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16415 .channel_mode = alc662_3ST_2ch_modes,
16416 .input_mux = &alc662_eeepc_capture_source,
16417 .unsol_event = alc663_mode5_unsol_event,
16418 .init_hook = alc663_mode5_inithook,
16420 [ALC663_ASUS_MODE6] = {
16421 .mixers = { alc663_two_hp_m2_mixer },
16422 .cap_mixer = alc662_auto_capture_mixer,
16423 .init_verbs = { alc662_init_verbs,
16424 alc663_two_hp_amic_m2_init_verbs },
16425 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16427 .dac_nids = alc662_dac_nids,
16428 .dig_out_nid = ALC662_DIGOUT_NID,
16429 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16430 .channel_mode = alc662_3ST_2ch_modes,
16431 .input_mux = &alc662_eeepc_capture_source,
16432 .unsol_event = alc663_mode6_unsol_event,
16433 .init_hook = alc663_mode6_inithook,
16439 * BIOS auto configuration
16442 /* add playback controls from the parsed DAC table */
16443 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16444 const struct auto_pin_cfg *cfg)
16447 static const char *chname[4] = {
16448 "Front", "Surround", NULL /*CLFE*/, "Side"
16453 for (i = 0; i < cfg->line_outs; i++) {
16454 if (!spec->multiout.dac_nids[i])
16456 nid = alc880_idx_to_dac(i);
16459 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16460 "Center Playback Volume",
16461 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16465 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16466 "LFE Playback Volume",
16467 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16471 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16472 "Center Playback Switch",
16473 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16477 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16478 "LFE Playback Switch",
16479 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16484 sprintf(name, "%s Playback Volume", chname[i]);
16485 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16486 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16490 sprintf(name, "%s Playback Switch", chname[i]);
16491 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16492 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16501 /* add playback controls for speaker and HP outputs */
16502 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16513 /* ALC663 has a mono output pin on 0x17 */
16514 sprintf(name, "%s Playback Switch", pfx);
16515 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16516 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16520 if (alc880_is_fixed_pin(pin)) {
16521 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16522 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16523 /* specify the DAC as the extra output */
16524 if (!spec->multiout.hp_nid)
16525 spec->multiout.hp_nid = nid;
16527 spec->multiout.extra_out_nid[0] = nid;
16528 /* control HP volume/switch on the output mixer amp */
16529 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16530 sprintf(name, "%s Playback Volume", pfx);
16531 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16532 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16535 sprintf(name, "%s Playback Switch", pfx);
16536 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16537 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16540 } else if (alc880_is_multi_pin(pin)) {
16541 /* set manual connection */
16542 /* we have only a switch on HP-out PIN */
16543 sprintf(name, "%s Playback Switch", pfx);
16544 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16545 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16552 /* create playback/capture controls for input pins */
16553 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16554 const struct auto_pin_cfg *cfg)
16556 struct hda_input_mux *imux = &spec->private_imux[0];
16559 for (i = 0; i < AUTO_PIN_LAST; i++) {
16560 if (alc880_is_input_pin(cfg->input_pins[i])) {
16561 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16562 err = new_analog_input(spec, cfg->input_pins[i],
16563 auto_pin_cfg_labels[i],
16567 imux->items[imux->num_items].label =
16568 auto_pin_cfg_labels[i];
16569 imux->items[imux->num_items].index =
16570 alc880_input_pin_idx(cfg->input_pins[i]);
16577 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16578 hda_nid_t nid, int pin_type,
16581 alc_set_pin_output(codec, nid, pin_type);
16582 /* need the manual connection? */
16583 if (alc880_is_multi_pin(nid)) {
16584 struct alc_spec *spec = codec->spec;
16585 int idx = alc880_multi_pin_idx(nid);
16586 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16587 AC_VERB_SET_CONNECT_SEL,
16588 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16592 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16594 struct alc_spec *spec = codec->spec;
16597 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16598 for (i = 0; i <= HDA_SIDE; i++) {
16599 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16600 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16602 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16607 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16609 struct alc_spec *spec = codec->spec;
16612 pin = spec->autocfg.hp_pins[0];
16613 if (pin) /* connect to front */
16615 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16616 pin = spec->autocfg.speaker_pins[0];
16618 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16621 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16622 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16624 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16626 struct alc_spec *spec = codec->spec;
16629 for (i = 0; i < AUTO_PIN_LAST; i++) {
16630 hda_nid_t nid = spec->autocfg.input_pins[i];
16631 if (alc662_is_input_pin(nid)) {
16632 snd_hda_codec_write(codec, nid, 0,
16633 AC_VERB_SET_PIN_WIDGET_CONTROL,
16634 (i <= AUTO_PIN_FRONT_MIC ?
16635 PIN_VREF80 : PIN_IN));
16636 if (nid != ALC662_PIN_CD_NID)
16637 snd_hda_codec_write(codec, nid, 0,
16638 AC_VERB_SET_AMP_GAIN_MUTE,
16644 #define alc662_auto_init_input_src alc882_auto_init_input_src
16646 static int alc662_parse_auto_config(struct hda_codec *codec)
16648 struct alc_spec *spec = codec->spec;
16650 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16652 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16656 if (!spec->autocfg.line_outs)
16657 return 0; /* can't find valid BIOS pin config */
16659 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16662 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16665 err = alc662_auto_create_extra_out(spec,
16666 spec->autocfg.speaker_pins[0],
16670 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16674 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16678 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16680 if (spec->autocfg.dig_out_pin)
16681 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16683 if (spec->kctls.list)
16684 add_mixer(spec, spec->kctls.list);
16686 spec->num_mux_defs = 1;
16687 spec->input_mux = &spec->private_imux[0];
16689 add_verb(spec, alc662_auto_init_verbs);
16690 if (codec->vendor_id == 0x10ec0663)
16691 add_verb(spec, alc663_auto_init_verbs);
16693 err = alc_auto_add_mic_boost(codec);
16697 store_pin_configs(codec);
16701 /* additional initialization for auto-configuration model */
16702 static void alc662_auto_init(struct hda_codec *codec)
16704 struct alc_spec *spec = codec->spec;
16705 alc662_auto_init_multi_out(codec);
16706 alc662_auto_init_hp_out(codec);
16707 alc662_auto_init_analog_input(codec);
16708 alc662_auto_init_input_src(codec);
16709 if (spec->unsol_event)
16710 alc_inithook(codec);
16713 static int patch_alc662(struct hda_codec *codec)
16715 struct alc_spec *spec;
16716 int err, board_config;
16718 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16722 codec->spec = spec;
16724 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16726 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16729 if (board_config < 0) {
16730 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16731 "trying auto-probe from BIOS...\n");
16732 board_config = ALC662_AUTO;
16735 if (board_config == ALC662_AUTO) {
16736 /* automatic parse from the BIOS config */
16737 err = alc662_parse_auto_config(codec);
16743 "hda_codec: Cannot set up configuration "
16744 "from BIOS. Using base mode...\n");
16745 board_config = ALC662_3ST_2ch_DIG;
16749 err = snd_hda_attach_beep_device(codec, 0x1);
16755 if (board_config != ALC662_AUTO)
16756 setup_preset(spec, &alc662_presets[board_config]);
16758 if (codec->vendor_id == 0x10ec0663) {
16759 spec->stream_name_analog = "ALC663 Analog";
16760 spec->stream_name_digital = "ALC663 Digital";
16761 } else if (codec->vendor_id == 0x10ec0272) {
16762 spec->stream_name_analog = "ALC272 Analog";
16763 spec->stream_name_digital = "ALC272 Digital";
16765 spec->stream_name_analog = "ALC662 Analog";
16766 spec->stream_name_digital = "ALC662 Digital";
16769 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16770 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16772 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16773 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16775 spec->adc_nids = alc662_adc_nids;
16776 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16777 spec->capsrc_nids = alc662_capsrc_nids;
16778 spec->capture_style = CAPT_MIX;
16780 if (!spec->cap_mixer)
16781 set_capture_mixer(spec);
16782 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16784 spec->vmaster_nid = 0x02;
16786 codec->patch_ops = alc_patch_ops;
16787 if (board_config == ALC662_AUTO)
16788 spec->init_hook = alc662_auto_init;
16789 #ifdef CONFIG_SND_HDA_POWER_SAVE
16790 if (!spec->loopback.amplist)
16791 spec->loopback.amplist = alc662_loopbacks;
16793 codec->proc_widget_hook = print_realtek_coef;
16801 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16802 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16803 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16804 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16805 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16806 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16807 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16808 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16809 .patch = patch_alc861 },
16810 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16811 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16812 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16813 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16814 .patch = patch_alc883 },
16815 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16816 .patch = patch_alc662 },
16817 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16818 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16819 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16820 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16821 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16822 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16823 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16824 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16825 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16826 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16827 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16828 .patch = patch_alc883 },
16829 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16830 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16831 {} /* terminator */
16834 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16836 MODULE_LICENSE("GPL");
16837 MODULE_DESCRIPTION("Realtek HD-audio codec");
16839 static struct hda_codec_preset_list realtek_list = {
16840 .preset = snd_hda_preset_realtek,
16841 .owner = THIS_MODULE,
16844 static int __init patch_realtek_init(void)
16846 return snd_hda_add_codec_preset(&realtek_list);
16849 static void __exit patch_realtek_exit(void)
16851 snd_hda_delete_codec_preset(&realtek_list);
16854 module_init(patch_realtek_init)
16855 module_exit(patch_realtek_exit)